Loads the core configuration from the specified path and uses its content for further setup

    :param config_path: Path to the core config file
165009
def setup_configuration(config_path):
    
    if config_path is not None:
        config_path, config_file = filesystem.separate_folder_path_and_file_name(config_path)
        global_config.load(config_file=config_file, path=config_path)
    else:
        global_config.load(path=config_path)

    # Initialize libraries
    core_singletons.library_manager.initialize()
191503
def read_config(config_path):
    
    section = "DUMMY"
    defaults = {'host': 'localhost',
                'consumerKey': '', 'consumerSecret': '',
                'token': '', 'tokenSecret':'',
                }
    # Insert an section header at the start of the config file,
    # so ConfigParser can understand it
    buf = io.StringIO()
    buf.write('[%s]\n' % section)
    with io.open(config_path, "r") as conf:
        buf.write(conf.read())

    buf.seek(0, os.SEEK_SET)
    parser = ConfigParser()
    parser.optionxform = str # Case-sensitive options
    try:
        parser.read_file(buf) # Python3
    except AttributeError:
        parser.readfp(buf) # Python2

    # Trim quotes
    config = parser.items(section)
    config = [(item[0].replace('"', ''), item[1].replace('"', ''))
              for item in config]
    config = [(item[0].replace("'", ""), item[1].replace("'", ""))
              for item in config]
    config = dict(config)

    # Apply defaults
    for key in defaults:
        if key not in config:
            config[key] = defaults[key]

    return config
607708
def _load_config(configfile, section=None):
    '''
    '''
    if os.path.exists(configfile):
        config = read_config(configfile)
        if section is not None:
            if section in config:
                return config._sections[section]
            else:
                bot.warning('%s not found in %s' %(section, configfile))
        return config
1125744
def load!(path, environment = nil)
      require 'yaml'
      environment ||= Rails.env
      conf = YAML.load(File.new(path).read).with_indifferent_access[environment]
      load_configuration(conf)
    end
586647
def load(self):
        
        data = self.dict_class()
        
        for path in self.paths:
            if path in self.paths_loaded: continue
            
            try:
                with open(path, 'r') as file:
                    path_data = yaml.load(file.read())
                    data = dict_merge(data, path_data)
                self.paths_loaded.add(path)
            except IOError:
                # TODO: Log this correctly once logging is implemented
                if not path.endswith('.local.yml'):
                    print 'CONFIG NOT FOUND: %s' % (path)

        self.data = data
220538
public static Object loadConfigGuess(String path) throws Exception {
        String input = FileUtils.readFileToString(new File(path));
        //note here that we load json BEFORE YAML. YAML
        //turns out to load just fine *accidentally*
        try {
            return MultiLayerConfiguration.fromJson(input);
        } catch (Exception e) {
            log.warn("Tried multi layer config from json", e);
            try {
                return KerasModelImport.importKerasModelConfiguration(path);
            } catch (Exception e1) {
                log.warn("Tried keras model config", e);
                try {
                    return KerasModelImport.importKerasSequentialConfiguration(path);
                } catch (Exception e2) {
                    log.warn("Tried keras sequence config", e);
                    try {
                        return ComputationGraphConfiguration.fromJson(input);
                    } catch (Exception e3) {
                        log.warn("Tried computation graph from json");
                        try {
                            return MultiLayerConfiguration.fromYaml(input);
                        } catch (Exception e4) {
                            log.warn("Tried multi layer configuration from yaml");
                            try {
                                return ComputationGraphConfiguration.fromYaml(input);
                            } catch (Exception e5) {
                                throw new ModelGuesserException("Unable to load configuration from path " + path
                                        + " (invalid config file or not a known config type)");
                            }
                        }
                    }
                }
            }
        }
    }
15498
def load_config(path):
   
   with path.open('rb') as fi:
       file_bytes = fi.read()
       config = yaml.load(file_bytes.decode('utf-8'))

   return config
595876
function loadConfig(path) {
    var glob = require('glob');
    var object = {};
    var key;

    glob.sync('*', {cwd: path}).forEach(function(option) {
      key = option.replace(/\.js$/,'');
      object[key] = require(path + option);
    });

    return object;
  }
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
934665
def make_config_get(conf_path):
    
    project_root = _get_project_root_from_conf_path(conf_path)
    config = load_config_in_dir(project_root)
    return partial(config_get, config)
907441
def read_config(config_path=CONFIG_PATH):
    
    if not os.path.isfile(config_path):
        raise IOError("No config file found at %s" % config_path)
    config_parser = configparser.ConfigParser()
    config_parser.read(config_path)
    config = _config_parser_to_defaultdict(config_parser)
    return config
357710
def load_config_file(self, path, profile=None):
        """"""
        config_cls = self.get_config_reader()
        return config_cls.load_config(self, path, profile=profile)
475648
def _loadConfiguration(self):
        
        configPath = os.path.join(self.path, "config")
        if not os.path.isdir(configPath):
            return

        config = Config(configPath)

        Config.mergeDictionaries(config.getData(), self.application.config)
991185
def _load_config(self, path):
        
        p = os.path.abspath(os.path.expanduser(path))
        logger.debug('Loading configuration from: %s', p)
        return read_json_file(p)
933145
def load(self, config_path=None):
        

        self._reset_config()

        if not config_path:
            config_path = os.path.join(
                appdirs.user_config_dir(self._app_name),
                self._config_file
            )

        try:
            # First check if it's file like. If it is, pyyaml can load it.
            # I'm checking type instead of catching exceptions to keep the
            # exception handling simple
            if hasattr(config_path, 'read'):
                config = yaml.safe_load(config_path)
            else:
                # If it isn't, it's a path. We have to open it first, otherwise
                # pyyaml will try to read it as yaml
                with open(config_path, 'rb') as config_file:
                    config = yaml.safe_load(config_file)
        except EnvironmentError:
            raise exceptions.ConfigNotFoundError('Couldn\'t read config at {config_path}'.format(
                config_path=str(config_path),
            ))
        except yaml.YAMLError:
            raise exceptions.ConfigSyntaxError('Error parsing YAML')

        if 'printer' in config:
            self._printer_config = config['printer']
            self._printer_name = self._printer_config.pop('type').title()

            if not self._printer_name or not hasattr(printer, self._printer_name):
                raise exceptions.ConfigSyntaxError(
                    'Printer type "{printer_name}" is invalid'.format(
                        printer_name=self._printer_name,
                    )
                )

        self._has_loaded = True
493776
def load_toml_path_config(filename):
    
    if not os.path.exists(filename):
        LOGGER.info(
            "Skipping path loading from non-existent config file: %s",
            filename)
        return PathConfig()

    LOGGER.info("Loading path information from config: %s", filename)

    try:
        with open(filename) as fd:
            raw_config = fd.read()
    except IOError as e:
        raise LocalConfigurationError(
            "Unable to load path configuration file: {}".format(str(e)))

    toml_config = toml.loads(raw_config)

    invalid_keys = set(toml_config.keys()).difference(
        ['data_dir', 'key_dir', 'log_dir', 'policy_dir'])
    if invalid_keys:
        raise LocalConfigurationError("Invalid keys in path config: {}".format(
            ", ".join(sorted(list(invalid_keys)))))

    config = PathConfig(
        config_dir=None,
        data_dir=toml_config.get('data_dir', None),
        key_dir=toml_config.get('key_dir', None),
        log_dir=toml_config.get('log_dir', None),
        policy_dir=toml_config.get('policy_dir', None)
    )

    return config
497282
def load_config(filename, filepath=''):
    

    FILE = path.join(filepath, filename)

    try:
        cfg.read(FILE)
        global _loaded
        _loaded = True
    except:
        print("configfile not found.")