Search all `config_paths` for any config file.
        Returns the first path that exists (and is a config file).
779042
def _find_config_file(self):
        
        log.info("Searching for config in: {0}".format(
            ", ".join(str(p) for p in self._config_paths)))

        for cp in self._config_paths:
            f = self._search_in_path(cp)
            if f != "":
                return f

        raise errors.ConfigFileNotFoundError(
            self._config_name, self._config_paths)
1367138
def get_configuration_file():
    
    path = os.path.abspath(os.curdir)
    while path != os.sep:
        config_path = os.path.join(path, CONFIG_FILE_NAME)
        if os.path.exists(config_path):
            return config_path
        path = os.path.dirname(path)
    return None
559291
def find_schema_paths(schema_files_path=DEFAULT_SCHEMA_FILES_PATH):
    
    paths = []
    for path in schema_files_path:
        if os.path.isdir(path):
            paths.append(path)
    if paths:
        return paths
    raise SchemaFilesNotFound("Searched " + os.pathsep.join(schema_files_path))
839648
def get_default_config_directory():
        
        test_path = os.path.dirname(os.path.realpath(inspect.getouterframes(inspect.currentframe())[2][1]))
        return os.path.join(test_path, 'conf')
243654
def find_config():
    
    config_locations = [
        '/etc/foremast/foremast.cfg',
        expanduser('~/.foremast/foremast.cfg'),
        './.foremast/foremast.cfg',
    ]
    configurations = ConfigParser()

    cfg_file = configurations.read(config_locations)
    dynamic_config_file = getenv('FOREMAST_CONFIG_FILE', DEFAULT_DYNAMIC_CONFIG_FILE)

    if cfg_file:
        LOG.info('Loading static configuration file.')
    elif exists(dynamic_config_file):
        LOG.info('Loading dynamic configuration file.')
        configurations = load_dynamic_config(config_file=dynamic_config_file)
    else:
        config_locations.append(dynamic_config_file)
        LOG.warning('No configuration found in the following locations:\n%s', '\n'.join(config_locations))
        LOG.warning('Using defaults...')

    return dict(configurations)
837537
public function findConfigFile($path)
    {
        $configFilePath = rtrim($path, '/') . '/' . PHPFormatter::CONFIG_FILE_NAME;
        $config = [];
        if (is_file($configFilePath)) {
            $yamlParser = new Yaml();
            $config = $yamlParser->parse(file_get_contents($configFilePath));
        }

        return $config;
    }
773480
function findConfigFile() {
	let configDir
	try {
		configDir = findup.sync(process.cwd(), CONFIG_FILENAME)
	} catch (exception) {
		return false
	}

	return path.join(configDir, CONFIG_FILENAME)
}
855010
def parse_conf_files(conf_paths):
    
    conf_file = ConfigParser.RawConfigParser()
    conf_read = conf_file.read(conf_paths)
    conf = {}
    try:
        if conf_read:
            conf['client_id'] = conf_file.get('runkeeper', 'client_id')
            conf['client_secret'] = conf_file.get('runkeeper', 'client_secret')
            if conf_file.has_option('runkeeper', 'bindport'):
                conf['bindport'] = conf_file.getint('runkeeper', 'bindport')
            if conf_file.has_option('runkeeper', 'bindaddr'):
                conf['bindaddr'] = conf_file.get('runkeeper', 'bindaddr')
            if conf_file.has_option('runkeeper', 'baseurl'):
                conf['baseurl'] = conf_file.get('runkeeper', 'baseurl')
            return conf
    except ConfigParser.Error:
        raise ConfigurationError("Error parsing configuration file(s): %s\n" 
                                 % sys.exc_info()[1])
    else:
        raise ConfigurationError("No valid configuration file (%s) found." 
                                 % defaultConfFilename)
486011
def scan_config_path(cls, project, scan_config):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/scanConfigs/{scan_config}",
            project=project,
            scan_config=scan_config,
        )
932321
def get_config_file():
    # type: () -> AnyStr
    """"""
    parser = argparse.ArgumentParser(description="Read configuration file.")
    parser.add_argument('-ini', help="Full path of configuration file")
    args = parser.parse_args()
    ini_file = args.ini
    if not FileClass.is_file_exists(ini_file):
        print("Usage: -ini <full path to the configuration file.>")
        exit(-1)
    return ini_file
776041
def _get_config_file_in_folder(cls, path):
        
        if os.path.isfile(path):
            path = os.path.dirname(path)

        for fn in cls.PROJECT_CONFIG_FILES:
            config = RawConfigParser()
            full_path = os.path.join(path, fn)
            if config.read(full_path) and cls._get_section_name(config):
                return full_path
904046
def _get_config(self, path=None):
        
        if not path and not self.option("config"):
            raise Exception("The --config|-c option is missing.")

        if not path:
            path = self.option("config")

        filename, ext = os.path.splitext(path)
        if ext in [".yml", ".yaml"]:
            with open(path) as fd:
                config = yaml.load(fd)
        elif ext in [".py"]:
            config = {}

            with open(path) as fh:
                exec(fh.read(), {}, config)
        else:
            raise RuntimeError("Config file [%s] is not supported." % path)

        return config
175236
def _find_path(self, search_dirs, file_name):
        
        for dir_path in search_dirs:
            file_path = os.path.join(dir_path, file_name)
            if os.path.exists(file_path):
                return file_path

        return None
974658
def get_config(filename, *search_dirs, **kwargs):
    """"""
    config = kwargs.get("config_reader_class", configparser.ConfigParser)()

    paths = config_search_paths(filename, *search_dirs)
    successes = config.read(reversed(paths))
    if successes:
        LOG.debug("Read config from %s", str(successes))
        return config, successes

    LOG.warning("Couldn't file any config file matching %s", filename)
    return None, []
1120121
def has_default_file(cls):
        """"""
        for filename in cls.config_files:
            for searchpath in cls.config_searchpath:
                path = os.path.join(searchpath, filename)
                if os.path.exists(path):
                    return True

        return False
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
1355016
def get_yaml_config(config_path):
    
    config_path = os.path.expanduser(config_path)
    if not os.path.isfile(config_path):
        raise IpaUtilsException(
            'Config file not found: %s' % config_path
        )

    with open(config_path, 'r') as f:
        config = yaml.safe_load(f)
    return config