A convenience method which coerces the option in the specified section to a directory.
970383
def getdir(self, section, option, raw=False, vars=None, fallback="", validate=False):
        
        v = self.get(section, option, raw=raw, vars=vars, fallback=fallback)
        v = self._convert_to_path(v)
        return v if not validate or os.path.isdir(v) else fallback
1299865
def from_directory(cls, directory):
        """"""
        cert_path = os.path.join(directory, 'skein.crt')
        key_path = os.path.join(directory, 'skein.pem')
        for path, name in [(cert_path, 'cert'), (key_path, 'key')]:
            if not os.path.exists(path):
                raise context.FileNotFoundError(
                    "Security %s file not found at %r" % (name, path)
                )
        return Security(cert_file=cert_path, key_file=key_path)
195461
def remove_option(self, section, option):
        """"""
        if not section or section == self.default_section:
            sectdict = self._defaults
        else:
            try:
                sectdict = self._sections[section]
            except KeyError:
                raise from_none(NoSectionError(section))
        option = self.optionxform(option)
        existed = option in sectdict
        if existed:
            del sectdict[option]
        return existed
704258
def set(config, section, opt, value):
        
        if section not in config.keys():
            config[section] = {}

        config[section][opt] = value
1135102
def write_option(option, value, section="cli", system=False):
    
    # deny rwx to Group and World -- don't bother storing the returned old mask
    # value, since we'll never restore it in the CLI anyway
    # do this on every call to ensure that we're always consistent about it
    os.umask(0o077)

    # FIXME: DRY violation with config_commands.helpers
    conf = get_config_obj(system=system)

    # add the section if absent
    if section not in conf:
        conf[section] = {}

    conf[section][option] = value
    conf.write()
1166877
def subdir_path(directory, relative):
    """"""
    item_bits = directory.split(os.sep)
    relative_bits = relative.split(os.sep)
    for i, _item in enumerate(item_bits):
        if i == len(relative_bits) - 1:
            return os.sep.join(item_bits[i:])
        else:
            if item_bits[i] != relative_bits[i]:
                return None

    return None
111283
def set(self, section, option, value=None):
        
        if isinstance(section, bytes):
            section = section.decode('utf8')

        if isinstance(option, bytes):
            option = option.decode('utf8')

        if isinstance(value, bytes):
            value = value.decode('utf8')

        return super(VSGConfigParser, self).set(section, option, value)
1266285
function _mkdirpSync (directory, mode) {

			if ("undefined" === typeof directory) {
				throw new ReferenceError("missing \"directory\" argument");
			}
				else if ("string" !== typeof directory) {
					throw new TypeError("\"directory\" argument is not a string");
				}
				else if ("" === directory.trim()) {
					throw new Error("\"directory\" argument is empty");
				}
			else if ("undefined" !== typeof mode && "number" !== typeof mode) {
				throw new TypeError("\"mode\" argument is not a number");
			}
			else if (!isDirectorySync(directory)) {

				const SUB_DIRECTORY = dirname(directory);

				if (!isDirectorySync(SUB_DIRECTORY)) {
					_mkdirpSync(SUB_DIRECTORY);
				}

				mkdirSync(directory, mode ? mode : DEFAULT_OPTION);

			}

		}
377389
public static Optional<Path> moveDir(Path sourceDirPath,
            Path destinationDirPath, CopyOption... options) {
        return operateDir(sourceDirPath, destinationDirPath, sourceDirPath,
                path -> move(path, destinationDirPath, options));
    }
1129993
def _remove_setting(section, name, configfile, save=False):
    '''
    '''
    removed = False
    config = _load_config(configfile)
    if section in config:
        if name.lower() in config[section]:
            removed = config.remove_option(section, name)

    # Does the user want to save the file?
    if removed and save:
        write_config(configfile, config)

    return removed
195090
def foldx_dir(self):
        """"""
        if self.root_dir:
            return op.join(self.root_dir, self._foldx_dirname)
        else:
            log.warning('Root directory not set')
            return None
29583
def mkdir(cls, directory):
        
        directory = path_expand(directory)
        try:
            os.makedirs(directory)
        except OSError as e:

            # EEXIST (errno 17) occurs under two conditions when the path exists:
            # - it is a file
            # - it is a directory
            #
            # if it is a file, this is a valid error, otherwise, all
            # is fine.
            if e.errno == errno.EEXIST and os.path.isdir(directory):
                pass
            else:
                raise
213839
function coerceOptions (opts) {
  return fp.pipe(
    () => (fp.isEmpty(opts) ? {} : opts),
    opts => (fp.isString(opts) ? { name: opts } : opts),
    opts => fp.set('name', fp.getOr(APP_NAME, 'name', opts), opts),
    opts => fp.set('base', extrasToBase(opts), opts),
    fp.pick(WHITELISTED_FIELDS),
    opts => Object.assign({}, DEFAULTS, opts)
  )()

  function extrasToBase (opts) {
    const current = fp.getOr({}, 'base', opts)
    const extras = fp.omit(BLACKLISTED_FIELDS, opts)
    return Object.assign({}, current, extras)
  }
}
1063091
def chdir(method):
    
    def wrapper(self, dir, *args, **kw):
        dirstack = ChdirStack()
        dirstack.push(dir)
        try:
            return method(self, dir, *args, **kw)
        finally:
            dirstack.pop()

    return functools.wraps(method)(wrapper)
1053789
private void mkDir(String dir) throws Exception {
        Session session = getSession();
        session.connect();
        Channel channel = session.openChannel("sftp");
        channel.connect();

        ChannelSftp c = (ChannelSftp) channel;
        if (!fileExists(dir, c))
            c.mkdir(dir);
        c.exit();
        session.disconnect();
    }
1116714
def _config_section(config, section):
    """"""
    path = os.path.join(config.get('config_path'), config.get('config_file'))
    conf = _config_ini(path)
    return conf.get(section)
80199
def remove_option(self, section, option):
        """"""
        if not section or section == DEFAULTSECT:
            sectdict = self._defaults
        else:
            try:
                sectdict = self._sections[section]
            except KeyError:
                raise NoSectionError(section)
        option = self.optionxform(option)
        existed = option in sectdict
        if existed:
            del sectdict[option]
        return existed