Extract the configuration located at ``config_path``.

        Returns:
            paramiko.SSHConfig: the configuration instance.
344613
def _get_ssh_config(config_path='~/.ssh/config'):
        
        ssh_config = paramiko.SSHConfig()
        try:
            with open(os.path.realpath(os.path.expanduser(config_path))) as f:
                ssh_config.parse(f)
        except IOError:
            pass
        return ssh_config
151843
def get_config_path(config_file):
    
    config_path = os.getenv('XDG_CONFIG_HOME')
    if not config_path:
        config_path = os.path.join(os.getenv('HOME'), ".config")
    if not config_file:
        config_file = "default"
    return os.path.join(config_path, "trovebox", config_file)
587878
def config(self):
        
        # TODO more efficient to read once and put watch on the file
        config = {}
        if self.config_file.exists():
            with open(self.config_file.as_posix(), 'rt') as f:  # 3.5/pypy3 can't open Path directly
                config = {k:self._override[k] if
                        k in self._override else
                        v for k, v in yaml.safe_load(f).items()}

        return config
396165
def set_config(path):
    
    logging.info("LOADING FROM: {}".format(path))
    session.config = load_config(path)
    return session.config
763698
def _get_or_create_config(path, prompt=True):
    
    dirname = os.path.dirname(path)
    filename = os.path.basename(path)

    try:
        os.makedirs(dirname)
    except OSError:
        pass

    try:
        with open(path, 'r+') as f:
            if os.path.isfile(path):
                puts("{0} already exists, backing up".format(colored.green(path)))
                _backup(dirname, filename)
            return yaml.load(f)
    except IOError:
        return {}
663342
def getSettingsPath() :
	""""""
	parser = SafeConfigParser()
	try :
		parser.read(os.path.normpath(pyGeno_SETTINGS_DIR+'/config.ini'))
		return parser.get('pyGeno_config', 'settings_dir')
	except :
		createDefaultConfigFile()
		return getSettingsPath()
662417
def get_config():
    
    config_path = find_config_file()
    if not config_path:
        return CONFIG_NOT_FOUND, None

    try:
        config_data = read_config_file(config_path)
    except Exception as error:
        return CONFIG_NOT_VALID, error

    return CONFIG_VALID, config_data
914945
def _build_ssh_config(self, config):
        
        ssh_config_injection = ssh_config_template % {
            'host': config.get('host'),
            'hostname': config.get('hostname'),
            'ssh_key_path': config.get('ssh_key_path'),
            'user': config.get('user')
        }
        if config.has('port'):
            ssh_config_injection += "  Port {0}\n".format(config.get('port'))
        return ssh_config_injection
737335
def parse_config_path(args=sys.argv):
    

    config = CONFIG_PATH
    if '--config' in args:
        idx = args.index('--config')
        if len(args) > idx + 1:
            config = args.pop(idx + 1)
        args.pop(idx)
    return config
363969
def __install_ssh_config(self, config):
        
        if not config.is_affirmative('use_global_ssh', default="no"):
            ssh_config_injection = self._build_ssh_config(config)

            if not os.path.exists(ssh_config_path):

                if self.injections.in_noninjected_file(ssh_config_path, "Host %s" % config.get('host')):
                    if config.is_affirmative('override'):
                        self.injections.inject(ssh_config_path, ssh_config_injection)
                else:
                    self.injections.inject(ssh_config_path, ssh_config_injection)

            else:
                self.injections.inject(ssh_config_path, ssh_config_injection)

            self.injections.commit()
907441
def read_config(config_path=CONFIG_PATH):
    
    if not os.path.isfile(config_path):
        raise IOError("No config file found at %s" % config_path)
    config_parser = configparser.ConfigParser()
    config_parser.read(config_path)
    config = _config_parser_to_defaultdict(config_parser)
    return config
31141
def get_user_config_dir():
    
    user_home = os.getenv('XDG_CONFIG_HOME')
    if user_home is None or not user_home:
        config_path = os.path.expanduser(os.path.join('~', '.config', 's-tui'))
    else:
        config_path = os.path.join(user_home, 's-tui')

    return config_path
24023
def get_config(path):
    
    if configparser is None:
        return None

    # Check for env specific configs first
    if os.path.exists(os.path.join(ROOT, 'config', NAME, path)):
        path = os.path.join(ROOT, 'config', NAME, path)
    else:
        path = os.path.join(ROOT, 'config', path)

    if not os.path.isfile(path):
        return None

    conf = open(path, 'rt').read()
    conf = os.path.expandvars(conf)

    config = configparser.SafeConfigParser()
    if sys.version_info[0] == 2:
        from io import StringIO
        config.readfp(StringIO(unicode(conf)))
    else:
        config.read_string(conf)
    return config
483272
def get_config(ini_path=None, rootdir=None):
    
    config = Namespace()
    config.default_section = 'pylama'

    if not ini_path:
        path = get_default_config_file(rootdir)
        if path:
            config.read(path)
    else:
        config.read(ini_path)

    return config
934479
def from_user_config(cls):
        
        # Try in the current directory.
        path = os.path.join(os.getcwd(), cls.YAML_FILE)

        if os.path.exists(path):
            return cls.from_file(path)

        # Try in the configuration directory.
        path = os.path.join(cls.USER_CONFIG_DIR, cls.YAML_FILE)

        if os.path.exists(path):
            return cls.from_file(path)

        raise cls.Error("Cannot locate %s neither in current directory nor in %s" % (cls.YAML_FILE, path))
937695
def load_config(paths=DEFAULT_CONFIG_PATHS):
    
    config = Config()
    for path in paths:
        if os.path.isfile(path):
            config.load_pyfile(path)

    return config
133280
def load(config_path: str):
    
    # we bind the config to _ to keep it alive
    if os.path.splitext(config_path)[1] in ('.yaml', '.yml'):
        _ = load_yaml_configuration(config_path, translator=PipelineTranslator())
    elif os.path.splitext(config_path)[1] == '.py':
        _ = load_python_configuration(config_path)
    else:
        raise ValueError('Unknown configuration extension: %r' % os.path.splitext(config_path)[1])
    yield