Load settings from configfile
762589
def load_config(settings):
    ''''''
    config = ConfigParser()
    section = 'pgdocgen'
    try:
        config.read(settings['configfile'])
    except Exception as e:
        sys.stderr.write('Failed to read config: ' + str(e))
        sys.exit(1)
    for option in config.options(section):
        settings[option] = config.get(section, option)
    return settings
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
1170447
def load_config(self, path):
        
        self.config_path = path
        self.config.read(self.config_path)
1293465
def load():
    
    config = ConfigParser.RawConfigParser(DEFAULTS)
    config.readfp(open(CONF_PATH))
    for section in config.sections():
        globals()[section] = {}
        for key, val in config.items(section):
            globals()[section][key] = val
52142
function loadConfigFile(dist, paths, options, callback) {
        if (options.config) {
            fs.readFile(options.config, {encoding: 'utf8'}, function(err, contents) {
                if (err) {
                    callback(err);
                    return;
                }
                
                var config = ini.parse(contents);

                if (config && config.default) {
                    options.accessKeyId = config.default.access_key;
                    options.secretAccessKey = config.default.secret_key;
                }
                if (!options.secretAccessKey || !options.accessKeyId) {
                    callback("Config file missing access_key or secret_key");
                    return;
                }

                invalidate(dist, paths, options, callback);
            });
        } else {
            invalidate(dist, paths, options, callback);
        }
    }
969635
public static function loadSettings($iniFile)
    {
        if (!file_exists($iniFile)) {
            throw new \Genesis\Exceptions\InvalidArgument(
                'The provided configuration file is invalid or inaccessible!'
            );
        }

        $settings = parse_ini_file($iniFile, true);

        foreach ($settings['Genesis'] as $option => $value) {
            if (array_key_exists($option, self::$vault)) {
                self::$vault[$option] = $value;
            }
        }

        foreach ($settings['Interfaces'] as $option => $value) {
            if (array_key_exists($option, self::$interfaces)) {
                self::$interfaces[$option] = $value;
            }
        }
    }
39718
def setup_config(command, filename, section, vars):
    """"""
    confuri = "config:" + filename
    if ":" in section:
        confuri += "#" + section.rsplit(":", 1)[-1]
    conf = appconfig(confuri)

    load_environment(conf.global_conf, conf.local_conf)
1197072
def _load_values(self):
        """"""
        path = self._config_path()
        if path is not None and os.path.isfile(path):
            self._load_file(path)
83035
def load_config(filename):
    
    package_path = ding0.__path__[0]
    FILE = path.join(package_path, 'config', filename)

    try:
        cfg.read(FILE)
        global _loaded
        _loaded = True
    except:
        logger.exception("configfile not found.")
181561
def load_config(configfile):
    
    try:
        with open(configfile, 'r') as ymlfile:
            try:
                config = yaml.load(ymlfile)
                return config
            except yaml.parser.ParserError:
                raise PyYAMLConfigError(
                    'Could not parse config file: {}'.format(configfile),
                )
    except IOError:
        raise PyYAMLConfigError(
            'Could not open config file: {}'.format(configfile),
        )
238563
def load config_file
      config_file ||= @config_file
      newsets = YAML::load_file(config_file)
      raise 'Config file was not valid YAML' if newsets == false
      newsets.deep_symbolize.each_pair do |key, value|
        varname = "@#{key.to_s}".to_sym
        unless self.instance_variables.include? varname
          raise SettingsError.new "Key #{key.to_s} in settings file is not valid"
        end
        self.instance_variable_set(varname, value)
      end
    end
1158653
def load_config(args, config_path=".inlineplz.yml"):
    """"""
    config = {}
    try:
        with open(config_path) as configfile:
            config = yaml.safe_load(configfile) or {}
            if config:
                print("Loaded config from {}".format(config_path))
                pprint.pprint(config)
    except (IOError, OSError, yaml.parser.ParserError):
        traceback.print_exc()
    args = update_from_config(args, config)
    args.ignore_paths = args.__dict__.get("ignore_paths") or [
        "node_modules",
        ".git",
        ".tox",
        "godeps",
        "vendor",
        "site-packages",
        "venv",
        ".env",
        "spec",
        "migrate",
        "bin",
        "fixtures",
        "cassettes",
        ".cache",
        ".idea",
        ".pytest_cache",
        "__pycache__",
        "dist",
    ]
    if config_path != ".inlineplz.yml":
        return args

    # fall back to config_dir inlineplz yaml if we didn't find one locally
    if args.config_dir and not config:
        new_config_path = os.path.join(args.config_dir, config_path)
        if os.path.exists(new_config_path):
            return load_config(args, new_config_path)

    return args
271857
def load_ini(self, ini_file):
        
        if ini_file and not os.path.exists(ini_file):
            self.log.critical(f"Settings file specified but not found. {ini_file}")
            sys.exit(1)
        if not ini_file:
            ini_file = f"{self.cwd}/settings.ini"
        if os.path.exists(ini_file):
            config = configparser.RawConfigParser(allow_no_value=True)
            config.read(ini_file)
            for key, value in self.spec.items():
                entry = None
                if value['type'] == str:
                    entry = config.get("settings", option=key.lower(), fallback=None)
                elif value['type'] == bool:
                    entry = config.getboolean("settings", option=key.lower(), fallback=None)
                elif value['type'] == int:
                    entry = config.getint("settings", option=key.lower(), fallback=None)
                elif value['type'] == float:
                    entry = config.getfloat("settings", option=key.lower(), fallback=None)
                elif value['type'] in [list, dict]:
                    entries = config.get("settings", option=key.lower(), fallback=None)
                    if entries:
                        try:
                            entry = json.loads(entries)
                        except json.decoder.JSONDecodeError as _err:  #pragma: no cover
                            self.log.critical(f"Error parsing json from ini file. {entries}")
                            sys.exit(1)
                if entry is not None:
                    setattr(self, key.upper(), entry)
1150549
def load(cls, filename=None):
        """"""
        if filename is None:
            LOGGER.debug("Loading default configuration.")
            with open_text(templates, "test_config.yml",
                           encoding="utf-8") as file_handle:
                content = yaml.load(file_handle)
        else:
            LOGGER.debug("Loading custom configuration '%s'.", filename)
            try:
                with open(filename, encoding="utf-8") as file_handle:
                    content = yaml.load(file_handle)
            except IOError as err:
                LOGGER.error(
                    "Failed to load the custom configuration '%s'. Skipping.",
                    filename)
                LOGGER.debug(str(err))
                content = dict()
        return cls(content)
647628
def _load_controller_settings(self):
        
        try:
            if not os.path.exists(self._config_file):
                yield from self._import_gns3_gui_conf()
                self.save()
            with open(self._config_file) as f:
                data = json.load(f)
        except (OSError, ValueError) as e:
            log.critical("Cannot load %s: %s", self._config_file, str(e))
            self._settings = {}
            return []

        if "settings" in data and data["settings"] is not None:
            self._settings = data["settings"]
        else:
            self._settings = {}
        if "gns3vm" in data:
            self.gns3vm.settings = data["gns3vm"]

        self.load_appliances()
        return data.get("computes", [])
607850
private function loadSettings()
    {
        $filename = $this->basedir . '/Settings.php';

        // Check for settings file
        if (!file_exists($filename) || !is_readable($filename)) {
            Throw new FrameworkException('Settings file could not be loaded. Make sure Settings.php exits in projects root dir and is readable.');
        }

        // Load basic config from Settings.php
        $this->settings = include ($filename);

        if (!empty($this->settings['display_errors'])) {
            ini_set('display_errors', 0);
        }
    }
531945
def load_config(files=None, root_path=None, local_path=None):
    """"""

    config = cfg.ConfigOpts()
    config.register_opts([
        cfg.Opt('root_path', default=root_path),
        cfg.Opt('local_path', default=local_path),
    ])
    # XXX register actual config groups here
    # theme_group = config_theme.register_config(config)
    if files is not None:
        config(args=[], default_config_files=files)
    return config