parse all configuration files from the parfait directory
356134
public static List<Specification> parseAllSpecifications() {
        List<Specification> allMonitorables = new ArrayList<>();
        try {
            File[] files = new File(PATHNAME).listFiles();
            if (files != null) {
                for (File file : files) {
                    allMonitorables.addAll(parseSpecification(file));
                }
            }
        } catch (Exception e) {
            // reported, fallback to specification from resources
        }
        if (allMonitorables.size() < 1) {
            InputStream res = ParfaitAgent.class.getResourceAsStream(RESOURCE);
            allMonitorables.addAll(parseInputSpecification(res));
        }
        return allMonitorables;
    }
941425
def configs_in(src_dir):
    """"""
    for filename in files_in_dir(src_dir, 'json'):
        with open(os.path.join(src_dir, filename), 'rb') as in_f:
            yield json.load(in_f)
1304685
def available_configuration_files(self):
        """"""
        known_files = [GLOBAL_CONFIG, LOCAL_CONFIG, self.environment.get('PIP_ACCEL_CONFIG')]
        absolute_paths = [parse_path(pathname) for pathname in known_files if pathname]
        return [pathname for pathname in absolute_paths if os.path.isfile(pathname)]
381412
def parse_config(args=sys.argv):
    
    parser = argparse.ArgumentParser(
        description='Read in the config file')
    parser.add_argument(
        'config_file',
        help='Configuration file.',
        metavar='FILE', type=extant_file)
    return parser.parse_args(args[1:])
13615
def parse_path(f1, f2):

    """"""

    import glob

    # if second argument is missing or is a wild card, point it
    # to the current directory
    f2 = f2.strip()
    if f2 == '' or f2 == '*':
        f2 = './'

    # if the first argument is a directory, use all GEIS files
    if os.path.isdir(f1):
        f1 = os.path.join(f1, '*.??h')
    list1 = glob.glob(f1)
    list1 = [name for name in list1 if name[-1] == 'h' and name[-4] == '.']

    # if the second argument is a directory, use file names in the
    # first argument to construct file names, i.e.
    # abc.xyh will be converted to abc_xyf.fits
    if os.path.isdir(f2):
        list2 = []
        for file in list1:
            name = os.path.split(file)[-1]
            fitsname = name[:-4] + '_' + name[-3:-1] + 'f.fits'
            list2.append(os.path.join(f2, fitsname))
    else:
        list2 = [s.strip() for s in f2.split(",")]

    if list1 == [] or list2 == []:
        err_msg = ""
        if list1 == []:
            err_msg += "Input files `{:s}` not usable/available. ".format(f1)

        if list2 == []:
            err_msg += "Input files `{:s}` not usable/available. ".format(f2)

        raise IOError(err_msg)

    else:
        return list1, list2
157804
def _parse_include_section(cfg, parser, section):
    '''
    
    '''
    for _name, pattern in cfg.items(section):
        if not os.path.isabs(pattern):
            pattern = os.path.join(configure.confdir, pattern)
        matches = glob.glob(pattern)
        matches.sort()
        for filename in matches:
            f = open(filename, 'r')
            parse_file(parser, f)
476073
def parse_config_file(job, ids, input_args):
    
    samples = []
    config = input_args['config']
    with open(config, 'r') as f:
        for line in f.readlines():
            if not line.isspace():
                sample = line.strip().split(',')
                samples.append(sample)
    for sample in samples:
        job.addChildJobFn(download_sample, ids, input_args, sample)
1147867
def parse_file(self, config: Union[Path, str, RawConfigParser, 'ConfigObject'], max_index=None, config_directory=None):
        
        self.config_directory = config_directory

        if isinstance(config, Path):
            config = str(config)

        if isinstance(config, str):
            if not os.path.isfile(config):
                raise FileNotFoundError(config)
            self.raw_config_parser = RawConfigParser()
            self.raw_config_parser.read(config, encoding='utf8')
            config = self.raw_config_parser
        elif isinstance(config, RawConfigParser):
            self.raw_config_parser = config
        elif not isinstance(config, ConfigObject):
            raise TypeError("The config should be a String, RawConfigParser of a ConfigObject")
        for header_name, header in self.headers.items():
            try:
                header.parse_file(config[header_name], max_index=max_index, config_directory=config_directory)
            except KeyError:
                pass  # skip this header as it does not exist
        return self
597631
def parse_options(args=None, config=True, rootdir=CURDIR, **overrides):  # noqa
    
    args = args or []

    # Parse args from command string
    options = PARSER.parse_args(args)
    options.file_params = dict()
    options.linters_params = dict()

    # Compile options from ini
    if config:
        cfg = get_config(str(options.options), rootdir=rootdir)
        for opt, val in cfg.default.items():
            LOGGER.info('Find option %s (%s)', opt, val)
            passed_value = getattr(options, opt, _Default())
            if isinstance(passed_value, _Default):
                if opt == 'paths':
                    val = val.split()
                if opt == 'skip':
                    val = fix_pathname_sep(val)
                setattr(options, opt, _Default(val))

        # Parse file related options
        for name, opts in cfg.sections.items():

            if name == cfg.default_section:
                continue

            if name.startswith('pylama'):
                name = name[7:]

            if name in LINTERS:
                options.linters_params[name] = dict(opts)
                continue

            mask = re.compile(fnmatch.translate(fix_pathname_sep(name)))
            options.file_params[mask] = dict(opts)

    # Override options
    _override_options(options, **overrides)

    # Postprocess options
    for name in options.__dict__:
        value = getattr(options, name)
        if isinstance(value, _Default):
            setattr(options, name, process_value(name, value.value))

    if options.concurrent and 'pylint' in options.linters:
        LOGGER.warning('Can\'t parse code asynchronously with pylint enabled.')
        options.concurrent = False

    return options
841913
def load_configuration_from_file(directory, args):
    """"""
    args = copy.copy(args)

    directory_or_file = directory
    if args.config is not None:
        directory_or_file = args.config

    options = _get_options(directory_or_file, debug=args.debug)

    args.report = options.get('report', args.report)
    threshold_dictionary = docutils.frontend.OptionParser.thresholds
    args.report = int(threshold_dictionary.get(args.report, args.report))

    args.ignore_language = get_and_split(
        options, 'ignore_language', args.ignore_language)

    args.ignore_messages = options.get(
        'ignore_messages', args.ignore_messages)

    args.ignore_directives = get_and_split(
        options, 'ignore_directives', args.ignore_directives)

    args.ignore_substitutions = get_and_split(
        options, 'ignore_substitutions', args.ignore_substitutions)

    args.ignore_roles = get_and_split(
        options, 'ignore_roles', args.ignore_roles)

    return args
1019763
function parse(fileString, callback) {
	return NginxConf.parse(fileString, function(err, _config) {
		if (err) {
			return callback(err);
		}

		return parseNginxConf(_config, callback);
	});
}
449429
def _read_config(cls):
        

        cls._config_parser = configparser.ConfigParser()
        cls._config_parser.read(cls._default_attribute_values_configuration_file_path)
960805
def parse(file_path):
    ''''''

    _, ext = path.splitext(file_path)

    if ext in ('.yaml', '.yml'):
        func = yaml.load

    elif ext == '.json':
        func = json.load

    else:
        raise ValueError("Unrecognized config file type %s" % ext)

    with open(file_path, 'r') as f:
        return func(f)
1263663
def get_configparser(filename=''):
    
    filename = filename or os.environ.get('SHELTER_CONFIG_FILENAME', '')
    if not filename:
        raise ImproperlyConfiguredError(_(
            "Configuration file is not defined. You must either "
            "set 'SHELTER_CONFIG_FILENAME' environment variable or "
            "'-f/--config-file' command line argument."
        ))

    parser = six.moves.configparser.RawConfigParser()
    for conf_file in get_conf_files(filename):
        logger.info("Found config '%s'", conf_file)
        if not parser.read(conf_file):
            logger.warning("Error while parsing config '%s'", conf_file)
    return parser
768541
def dump(self):
        """"""
        try:
            import yaml
            cfg_file = self._cfg_file()
            cfg_dir, __ = os.path.split(cfg_file)
            os.makedirs(cfg_dir, exist_ok=True)
            with open(cfg_file, 'w') as f:
                yaml.dump(self, f)
        except ImportError as err:
            raise RuntimeError(
                'Cannot dump the configuration settings to file. You need to '
                'install the necessary dependencies (pyyaml, appdirs).'
            ) from err
434389
def parse_config(self, config, toplevel=False):
        """"""
        self.sitemap_path = config.get_path('sitemap')

        if self.sitemap_path is None:
            error('invalid-config',
                  'No sitemap was provided')

        self.include_paths = OrderedSet([])

        index_file = config.get_index()
        if index_file:
            if not os.path.exists(index_file):
                error('invalid-config',
                      'The provided index "%s" does not exist' %
                      index_file)
            self.include_paths |= OrderedSet([os.path.dirname(index_file)])

        self.include_paths |= OrderedSet(config.get_paths('include_paths'))

        self.is_toplevel = toplevel

        self.tree = Tree(self, self.app)

        self.__create_extensions()

        for extension in list(self.extensions.values()):
            if toplevel:
                extension.parse_toplevel_config(config)
            extension.parse_config(config)

        self.extra_asset_folders = OrderedSet(config.get_paths('extra_assets'))
1307183
def GetParserFromFilename(self, path):
    """"""
    # Find the configuration parser.
    handler_name = path.split("://")[0]
    for parser_cls in itervalues(GRRConfigParser.classes):
      if parser_cls.name == handler_name:
        return parser_cls

    # Handle the filename.
    extension = os.path.splitext(path)[1]
    if extension in [".yaml", ".yml"]:
      return YamlParser

    return ConfigFileParser