Load a config file and merge it into the default options.
486221
def cfg_from_file(self, yaml_filename, config_dict):
        """"""
        import yaml
        from easydict import EasyDict as edict
        with open(yaml_filename, 'r') as f:
            yaml_cfg = edict(yaml.load(f))

        return self._merge_a_into_b(yaml_cfg, config_dict)
24430
def load(self):
        """"""
        if not self.loaded:
            self.values = configobj.ConfigObj({}, **self.DEFAULT_CONFIG_OPTS)
            for path in self.locations():
                try:
                    part = configobj.ConfigObj(infile=path, **self.DEFAULT_CONFIG_OPTS)
                except configobj.ConfigObjError as cause:
                    raise LoggedFailure("Error in file '{path}': {cause}".format(path=pretty_path(path), cause=cause))
                self.values.merge(part)
            self.loaded = True
        return self.values
740649
def _load_file(self, f):
        """"""
        try:
            with open(f, 'r') as _fo:
                _seria_in = seria.load(_fo)
                _y = _seria_in.dump('yaml')
        except IOError:
            raise FiggypyError("could not open configuration file")
        self.values.update(yaml.load(_y))
759008
def load(self, filename=None):
        
        if not filename:
            filename = self.default_config_file

        files = self._cfgs_to_read()
        # insert last, so it will override all values,
        # which have already been set in previous files.
        files.insert(-1, filename)

        try:
            config = self.__read_cfg(files)
        except ReadConfigException as e:
            print(Config._format_msg('config.load("{file}") failed with {error}'.format(file=filename, error=e)))
        else:
            self._conf_values = config

        # notice user?
        if self.show_config_notification and not self.cfg_dir:
            print(Config._format_msg("no configuration directory set or usable."
                                      " Falling back to defaults."))
873933
def apply_config_file(self, filename):
        
        def extractor(template, options):
            """Ignore things that are existing non default values"""
            for name, val in options:
                normalised = self.normalise_key(name)
                if normalised in self.values and not isinstance(self.values[normalised], Default):
                    continue
                else:
                    yield name, val

        items = json.load(open(filename)).items()
        self.use_options(items, extractor)
1034159
def load_config(file)
      unless File.exists? file
        File.open(file, 'w') do |f| 
          YAML.dump({ default_website: 'default' }, f) 
        end
      end
      YAML.load_file(file)
    end
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
1155317
def _load_config(self):
        ""
        
        config = SafeConfigParser()
        config_file = os.path.join(self.config_path, 'settings.ini')
        config.read(config_file)

        for option, type in list(AVAILABLE_OPTIONS.items()):
            if config.has_option('DEFAULT', option):
                if type == 'int':
                    value = config.getint('DEFAULT', option)
                if type == 'float':
                    value = config.getfloat('DEFAULT', option)
                if type == 'bool':
                    value = config.getboolean('DEFAULT', option)
                if type == 'str':
                    value = config.get('DEFAULT', option)

                self.livestreamer.set_option(option, value)
530993
function configFactory(filename, options) {
    if (!_.isObject(options)) {
        options = {};
    }

    var config = WebpackConfig.loader.loadConfig(filename),
        isArray = _.isArray(config);

    if (!isArray) {
        config = [config];
    }

    config = _.map(config, function(x) {
        x.merge(options);
        x.defaults({
            output: {
                path: path.dirname(filename)
            }
        });

        return x;
    });

    return isArray ? config : _.first(config);
}
677725
def load_config(self, config_source, parameters_source):
        """"""
        with open(config_source) as config_source:
            config_raw = config_source.read()
            """Replace the parameters"""
            pattern = "(%[a-zA-Z_0-9]*%)"

            self.parameters = {}
            """Parameteres from file"""
            if os.path.isfile(parameters_source):
                self.parameters.update(self.load_parameters(parameters_source))

            """Overwrite parameteres with the environment variables"""
            self.parameters.update(os.environ)

            replaced_config = re.sub(pattern=pattern, repl=self._replace_function, string=config_raw)
            return json.loads(replaced_config)
1021908
def load_config(self):
    """"""
    config = dict([(key, value) for key, value in iteritems(self.options)
                   if key in self.cfg.settings and value is not None])
    for key, value in iteritems(config):
      self.cfg.set(key.lower(), value)
249140
public static Config loadConfig(ConfigParseOptions parseOptions,
            ConfigResolveOptions resolveOptions, File configFile) {
        return ConfigFactory.parseFile(configFile, parseOptions).resolve(resolveOptions);
    }
883117
def config_from_file(self, config_file=None):
        """"""
        if PYLINT_VERSION >= (1, 5):
            self.read_config_file(config_file)
            if self.cfgfile_parser.has_option('MASTER', 'load-plugins'):
                # pylint: disable=protected-access
                plugins = _splitstrip(self.cfgfile_parser.get('MASTER', 'load-plugins'))
                self.load_plugin_modules(plugins)
            self.load_config_file()
            return True

        self.load_file_configuration(config_file)
        return False
1146872
protected function installLoadDefaultConfig()
	{
	    $defaultsPath = $this->extension->getDir() . 'config/default';
	    if (is_dir($defaultsPath)) {
    		$defaultIterator = new DirectoryIterator ($defaultsPath);
    		foreach ($defaultIterator as $fileinfo) {
    		    if (!$fileinfo->isDot () && strpos($fileinfo->getFilename(), '.conf.php') > 0) {
                    $confKey = substr($fileinfo->getFilename(), 0, -strlen('.conf.php'));
                    if (! $this->extension->hasConfig($confKey)) {
                        $config = include $fileinfo->getPathname();
                        if ($config instanceof ConfigurableService) {
                            $this->getServiceManager()->register($this->extension->getId() . '/' . $confKey, $config);
                        } else {
                            $this->extension->setConfig($confKey, $config);
                        }
                        $this->extension->setConfig($confKey, $config);
                    }
    		    }
    		}
	    }
	}
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
1188215
function loadConfigFile(file) {
    const filePath = file.filePath;
    let config;

    switch (path.extname(filePath)) {
        case '.yaml':
        case '.yml':
            config = loadYAMLConfigFile(filePath);
            break;

        default:
            config = loadJSONConfigFile(filePath);
    }

    return ConfigOps.merge(ConfigOps.createEmptyConfig(), config);
}
608435
public function loadConfig()
    {
        $fileName = File::path(dirname($this->getPath()), 'config/config.php');
        if(is_file($fileName))
        {
            Config::addConfig('@' . $this->moduleName, include $fileName);
        }
    }