Find the configuration files as set file names or in the classpath.
972550
private void findConfigFiles() {
    // Find the materialized_JSON configuration file.
    if (configFileName == null) {
      String jsonConfigFileString = conf.getConfigFile().replace(
                                         CoronaConf.DEFAULT_CONFIG_FILE,
                                         Configuration.MATERIALIZEDJSON);
      File jsonConfigFile = new File(jsonConfigFileString);
      String jsonConfigFileName = null;
      if (jsonConfigFile.exists()) {
        jsonConfigFileName = jsonConfigFileString;
      } else {
          URL u = classLoader.getResource(jsonConfigFileString);
          jsonConfigFileName = (u != null) ? u.getPath() : null;
      }
      // Check that the materialized_JSON contains the resources
      // of corona.xml
      if (jsonConfigFileName != null) {
        try {
          jsonConfigFile = new File(jsonConfigFileName);
          InputStream in = new BufferedInputStream(new FileInputStream(
        		                                           jsonConfigFile));
          JSONObject json = conf.instantiateJsonObject(in);
          if (json.has(conf.xmlToThrift(CoronaConf.DEFAULT_CONFIG_FILE))) {
            configFileName = jsonConfigFileName;
            LOG.info("Attempt to find config file " + jsonConfigFileString +
                     " as a file and in class loader returned " + configFileName);
          }
        } catch (IOException e) {
            LOG.warn("IOException: " + "while parsing corona JSON configuration");
        } catch (JSONException e) {
            LOG.warn("JSONException: " + "while parsing corona JSON configuration");
        }
      }
    }
    if (configFileName == null) {
      // Parsing the JSON configuration failed.  Look for
      // the xml configuration.
      String configFileString = conf.getConfigFile();
      File configFile = new File(configFileString);
      if (configFile.exists()) {
        configFileName = configFileString;
      } else {
        URL u = classLoader.getResource(configFileString);
        configFileName = (u != null) ? u.getPath() : null;
      }
      LOG.info("Attempt to find config file " + configFileString +
          " as a file and in class loader returned " + configFileName);
    }
    if (poolsConfigFileName == null) {
      String poolsConfigFileString = conf.getPoolsConfigFile();
      File poolsConfigFile = new File(poolsConfigFileString);
      if (poolsConfigFile.exists()) {
        poolsConfigFileName = poolsConfigFileString;
      } else {
        URL u = classLoader.getResource(poolsConfigFileString);
        poolsConfigFileName = (u != null) ? u.getPath() : null;
      }
      LOG.info("Attempt to find pools config file " + poolsConfigFileString +
          " as a file and in class loader returned " + poolsConfigFileName);
    }
  }
97210
def _read_configuration_file(self, path):
        
        parser = RawConfigParser(inline_comment_prefixes=('#', ';'))
        options = None
        should_inherit = True

        if parser.read(path) and self._get_section_name(parser):
            all_options = self._parser.option_list[:]
            for group in self._parser.option_groups:
                all_options.extend(group.option_list)

            option_list = {o.dest: o.type or o.action
                                for o in all_options}

            # First, read the default values
            new_options, _ = self._parse_args([])

            # Second, parse the configuration
            section_name = self._get_section_name(parser)
            for opt in parser.options(section_name):
                if opt == 'inherit':
                    should_inherit = parser.getboolean(section_name, opt)
                    continue

                if opt.replace('_', '-') not in self.CONFIG_FILE_OPTIONS:
                    log.warning("Unknown option '{}' ignored".format(opt))
                    continue

                normalized_opt = opt.replace('-', '_')
                opt_type = option_list[normalized_opt]
                if opt_type in ('int', 'count'):
                    value = parser.getint(section_name, opt)
                elif opt_type == 'string':
                    value = parser.get(section_name, opt)
                else:
                    assert opt_type in ('store_true', 'store_false')
                    value = parser.getboolean(section_name, opt)
                setattr(new_options, normalized_opt, value)

            # Third, fix the set-options
            options = self._fix_set_options(new_options)

        if options is not None:
            if not self._validate_options(options):
                raise IllegalConfiguration('in file: {}'.format(path))

        return options, should_inherit
570335
def find_class_files(self):
        
        files = self._find_files()
        self.announce(
            "found '{}' compiled class files in '{}'".format(
                len(files), self.root
            )
        )
        return files
547045
def config(self):
        '''  '''
        if self.__config is None:
            config_path = self.locate_config()
            if config_path:
                self.__config = self.read_file(config_path)
                self.__config_path = config_path
        return self.__config
314904
def search_configuration_files(findstr, replacestr = None):
    ''''''

    F = open(configurationFilesLocation, "r")
    lines = F.readlines()
    F.close()
    allerrors = {}
    alloutput = {}

    for line in lines:
        line = line.strip()
        if line:
            if line.endswith("generate_fragments.py"):
                # Do not parse the Python script but check that it exists
                if not(os.path.exists(line)):
                    allerrors[line] = "File/directory %s does not exist." % line
            else:
                cmd = ["grep", "-n", "-i",  findstr, line]
                output = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
                errors = output[1]
                output = output[0]
                if errors:
                    errors = errors.strip()
                    allerrors[line] = errors
                if output:
                    output = output.strip()
                    alloutput[line] = output.split("\n")
    return alloutput, allerrors
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
1174839
def read_config_files(files):
    """"""

    config = ConfigObj()

    for _file in files:
        _config = read_config_file(_file)
        if bool(_config) is True:
            config.merge(_config)
            config.filename = _config.filename

    return config
272837
def ls(system, user, local, include_missing):
    """"""

    # default action is to list *all* auto-detected files
    if not (system or user or local):
        system = user = local = True

    for path in get_configfile_paths(system=system, user=user, local=local,
                                     only_existing=not include_missing):
        click.echo(path)
449429
def _read_config(cls):
        

        cls._config_parser = configparser.ConfigParser()
        cls._config_parser.read(cls._default_attribute_values_configuration_file_path)
1021322
def filepaths(self):
        
        if self.path is not None:
            yield from utils.filepaths(self.path, exclude=self.exclude,
                                       hidden=False, empty=False)
460848
def get_default_filepath(cls):
        """"""
        if not cls.config_files:
            return None
        if not cls.config_searchpath:
            return None
        filename = cls.config_files[0]
        filepath = cls.config_searchpath[0]
        return os.path.join(filepath, filename)
317574
private List<ConfigurationHelper.ConfigurationInfo<String>>
      getFilePathConfigurationListWithDefault(@Nullable List<String> filePaths,
       String defaultFilePath) {
    List<ConfigurationHelper.ConfigurationInfo<String>> defaultConfigList =
        ConfigurationHelper.newList(true, defaultFilePath);
    List<ConfigurationHelper.ConfigurationInfo<String>> filePathConfigList =
        ConfigurationHelper.newList(filePaths, true);
    if (defaultConfigList != null) {
      if (filePathConfigList == null) {
        filePathConfigList = defaultConfigList;
      } else {
        filePathConfigList.addAll(defaultConfigList);
      } 
    }
    return filePathConfigList;
  }
560505
public static Path[] getArchiveClassPaths(Configuration conf) {
    String classpath = conf.get("mapred.job.classpath.archives");
    if (classpath == null)
      return null;
    ArrayList list = Collections.list(new StringTokenizer(classpath, System
                                                          .getProperty("path.separator")));
    Path[] paths = new Path[list.size()];
    for (int i = 0; i < list.size(); i++) {
      paths[i] = new Path((String) list.get(i));
    }
    return paths;
  }
742904
protected void loadConfigs() {
        configs = new Properties();
        // If run as a jar, find in file system classpath first, if not found, then get resource in jar.
        if (ClassPathUtil.testRunMainInJar()) {
            String[] classPathsInFileSystem = ClassPathUtil.getAllClassPathNotInJar();
            String workDir = System.getProperty("user.dir");
            String mainJarRelativePath = ClassPathUtil.getClassPathsInSystemProperty()[0];
            File mainJar = new File(workDir, mainJarRelativePath);
            File mainJarDir = mainJar.getParentFile();
            for (String classPath : classPathsInFileSystem) {
                File classPathFile = new File(classPath);
                File configFile;
                if (classPathFile.isAbsolute()) {
                    configFile = new File(classPathFile, propertiesAbsoluteClassPath);
                } else {
                    configFile = new File(new File(mainJarDir, classPath), propertiesAbsoluteClassPath);
                }
                if (configFile.exists() && configFile.isFile()) {
                    InputStream is = null;
                    try {
                        is = new FileInputStream(configFile);
                        loadConfigsFromStream(is);
                    } catch (FileNotFoundException e) {
                        LOGGER.warn("Load config file " + configFile.getPath() + " error!", e);
                    }
                    return;
                }
            }
        }
        if (propertiesFilePath == null) {
            if (propertiesAbsoluteClassPath == null) {
                return;
            }
            InputStream is = OneProperties.class.getResourceAsStream(propertiesAbsoluteClassPath);
            loadConfigsFromStream(is);
        } else {
            configs = PropertiesIO.load(propertiesFilePath);
        }
    }
704784
private boolean findFiles(String[] args, String option, Set<String> suffixes,
                              Map<String,Source> found_files, Map<String, Module> found_modules,
                              Module current_module, boolean inLinksrc)
        throws ProblemException, ProblemException
    {
        // Track which source roots, source path roots and class path roots have been added.
        Set<File> roots = new HashSet<File>();
        // Track the current set of package includes,excludes as well as excluded source files,
        // to be used in the next -src/-sourcepath/-classpath
        List<String> includes = new LinkedList<String>();
        List<String> excludes = new LinkedList<String>();
        List<String> excludefiles = new LinkedList<String>();
        List<String> includefiles = new LinkedList<String>();
        // This include is used to find all modules in the source.
        List<String> moduleinfo = new LinkedList<String>();
        moduleinfo.add("module-info.java");

        for (int i = 0; i<args.length; ++i) {
            if (args[i].equals("-i")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a package pattern following -i");
                }
                String incl = args[i+1];
                checkPattern(incl);
                includes.add(incl);
            }
            if (args[i].equals("-x")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a package pattern following -x");
                }
                String excl = args[i+1];
                checkPattern(excl);
                excludes.add(excl);
            }
            if (args[i].equals("-xf")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a file following -xf");
                }
                String exclf = args[i+1];
                checkFilePattern(exclf);
                exclf = Util.normalizeDriveLetter(exclf);
                excludefiles.add(fixupSeparator(exclf));
            }
            if (args[i].equals("-if")) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a file following -xf");
                }
                String inclf = args[i+1];
                checkFilePattern(inclf);
                inclf = Util.normalizeDriveLetter(inclf);
                includefiles.add(fixupSeparator(inclf));
            }
            if (args[i].equals(option)) {
                if (i+1 >= args.length) {
                    throw new ProblemException("You have to specify a directory following "+option);
                }
                String[] root_dirs = args[i+1].split(File.pathSeparator);
                for (String r : root_dirs) {
                    File root = new File(r);
                    if (!root.isDirectory()) {
                        throw new ProblemException("\""+r+"\" is not a directory.");
                    }
                    try {
                        root = root.getCanonicalFile();
                    } catch (IOException e) {
                        throw new ProblemException(""+e);
                    }
                    if (roots.contains(root)) {
                        throw new ProblemException("\""+r+"\" has already been used for "+option);
                    }
                    if (root.equals(bin_dir)) {
                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -d");
                    }
                    if (root.equals(gensrc_dir)) {
                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -s");
                    }
                    if (root.equals(header_dir)) {
                        throw new ProblemException("\""+r+"\" cannot be used both for "+option+" and -h");
                    }
                    roots.add(root);
                    Source.scanRoot(root, suffixes, excludes, includes, excludefiles, includefiles,
                                    found_files, found_modules, current_module,
                                    findBooleanOption(args, "--permit-sources-without-package"),
                                    false, inLinksrc);
                }
            }
            if (args[i].equals("-src") ||
                args[i].equals("-sourcepath") ||
                args[i].equals("-modulepath") ||
                args[i].equals("-classpath") ||
                args[i].equals("-cp"))
            {
                // Reset the includes,excludes and excludefiles after they have been used.
                includes = new LinkedList<String>();
                excludes = new LinkedList<String>();
                excludefiles = new LinkedList<String>();
                includefiles = new LinkedList<String>();
            }
        }
        return true;
    }
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
19707
def _find_observable_paths(extra_files=None):
    """"""
    rv = set(
        os.path.dirname(os.path.abspath(x)) if os.path.isfile(x) else os.path.abspath(x)
        for x in sys.path
    )

    for filename in extra_files or ():
        rv.add(os.path.dirname(os.path.abspath(filename)))

    for module in list(sys.modules.values()):
        fn = getattr(module, "__file__", None)
        if fn is None:
            continue
        fn = os.path.abspath(fn)
        rv.add(os.path.dirname(fn))

    return _find_common_roots(rv)