:arg in_memory Initialize Configuration instance in memory only
  :type in_memory bool
  :type config_path str
  :type config_name str
  :rtype Configuration
  :return Configuration
484323
def get_instance(in_memory=False, config_path=None, config_name=None):
  
  global __conf

  if __conf is None:
    __conf = Configuration(in_memory=in_memory, custom_cfg_path=config_path, config_name=config_name)

  return __conf
333720
def load_config(self, path):
        ''''''

        # if no path was provided, resort to defaults
        if path == None:
            print("Path to config was null; using defaults.")
            return

        if not os.path.exists(path):
            print("[No user config file found at default location; using defaults.]\n")
            return


        user_config = None

        # read in the user's configuration file (for now, we hope it's yaml)
        with open(path) as f:
            user_config = f.read()

        # load the user's configuration file into a Config object
        extension = os.path.splitext(path)
        if extension == 'yaml':
            user_config = yaml.load(user_config)
        else:
            raise Error('Configuration file type "{}" not supported'.format(extension))

        # copy the user's preferences into the default configurations
        self.merge_config(user_config)

        # build the udpated configuration
        self.configuration = Configuration(self.data_config, self.model_config, self.conversation_config)
605526
def initialize(self, init_value, context=None, force=False):
        

        if not force and self._instance is not None:
            raise ConfigurationAlreadyInitializedError(
                'Configuration manager object is already initialized.'
            )

        self.__class__._instance = Root(init_value, context=context)
836549
def load_from_configuration(cls, path, uuid, **kwargs):
        
        cfg = ConfigParser.ConfigParser()
        kw = {}
        with open(path, 'r') as _f:
            cfg.readfp(_f)
            if cfg.has_section('General'):
                general = dict(cfg.items('General'))
                kw['filepath'] = kwargs.get('filepath', False) or general['filepath']
                kw['application_name'] = general.get('application_name', '')
                kw['application_version'] = general.get('application_version', '')
                kw['submit_interval_s'] = int(general.get('submit_interval_s', 0))
                kw['check_interval_s'] = int(general.get('check_interval_s', 0))
                kw['debug'] = bool(general.get('debug', False))

            if cfg.has_section('HQ'):
                hq_params = dict(cfg.items('HQ'))
            else:
                hq_params = None

        kw.update(**kwargs)
        tracker = cls(uuid, **kw)
        if hq_params:
            tracker.setup_hq(**hq_params)

        return tracker
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)
1170447
def load_config(self, path):
        
        self.config_path = path
        self.config.read(self.config_path)
24023
def get_config(path):
    
    if configparser is None:
        return None

    # Check for env specific configs first
    if os.path.exists(os.path.join(ROOT, 'config', NAME, path)):
        path = os.path.join(ROOT, 'config', NAME, path)
    else:
        path = os.path.join(ROOT, 'config', path)

    if not os.path.isfile(path):
        return None

    conf = open(path, 'rt').read()
    conf = os.path.expandvars(conf)

    config = configparser.SafeConfigParser()
    if sys.version_info[0] == 2:
        from io import StringIO
        config.readfp(StringIO(unicode(conf)))
    else:
        config.read_string(conf)
    return config
1328396
def _load(self, file_path: Text) -> None:
        

        # noinspection PyUnresolvedReferences
        module_ = types.ModuleType('settings')
        module_.__file__ = file_path

        try:
            with open(file_path, encoding='utf-8') as f:
                exec(compile(f.read(), file_path, 'exec'), module_.__dict__)
        except IOError as e:
            e.strerror = 'Unable to load configuration file ({})'\
                .format(e.strerror)
            raise

        for key in dir(module_):
            if CONFIG_ATTR.match(key):
                self[key] = getattr(module_, key)
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
109652
def initHashStore(data_dir, name, config=None, read_only=False) -> HashStore:
    
    config = config or getConfig()
    hsConfig = config.hashStore['type'].lower()
    if hsConfig == HS_FILE:
        return FileHashStore(dataDir=data_dir,
                             fileNamePrefix=name)
    elif hsConfig == HS_LEVELDB or hsConfig == HS_ROCKSDB:
        return DbHashStore(dataDir=data_dir,
                           fileNamePrefix=name,
                           db_type=hsConfig,
                           read_only=read_only,
                           config=config)
    else:
        return MemoryHashStore()
103383
def get_default_config(self):
        
        config = super(MemoryLxcCollector, self).get_default_config()
        config.update({
            "path":     "lxc",
            "sys_path": "/sys/fs/cgroup/lxc",
        })
        return config
598166
def getConfigRoot(cls, create = False):
        
        try:
            return manager.gettree(getattr(cls, 'configkey'), create)
        except AttributeError:
            return None
1283899
def load(self, path):
        
        config = _Config.load(os.path.join(path, 'config.pkl'))
        config.save_dir = path  # redirect root path to what user specified
        self._vocab = vocab = ParserVocabulary.load(config.save_vocab_path)
        with mx.Context(mxnet_prefer_gpu()):
            self._parser = BiaffineParser(vocab, config.word_dims, config.tag_dims, config.dropout_emb,
                                          config.lstm_layers,
                                          config.lstm_hiddens, config.dropout_lstm_input, config.dropout_lstm_hidden,
                                          config.mlp_arc_size,
                                          config.mlp_rel_size, config.dropout_mlp, config.debug)
            self._parser.load(config.save_model_path)
        return self
173508
def load_config(path):
    
    path = os.path.abspath(path)
    if os.path.isdir(path):
        config, wordlists = _load_data(path)
    elif os.path.isfile(path):
        config = _load_config(path)
        wordlists = {}
    else:
        raise InitializationError('File or directory not found: {0}'.format(path))
    for name, wordlist in wordlists.items():
        if name in config:
            raise InitializationError("Conflict: list {!r} is defined both in config "
                                      "and in *.txt file. If it's a {!r} list, "
                                      "you should remove it from config."
                                      .format(name, _CONF.TYPE.WORDS))
        config[name] = wordlist
    return config
1176075
def _load_config(self):
        
        if not os.path.exists(self._path):
            sys.exit("Config path %s does not exist" % self._path)
        # create empty config object
        self._config_dict = {}
        # read file and marshal yaml
        with open(self._path, 'r') as f:
            self._raw = f.read()
            self._config_dict = yaml.load(self._raw)
432862
def initialize_path(self, path_num=None):
        
        self.state = copy(self.initial_state)
        return self.state
623834
def load_config(force_default=False):
    '''
    '''
    def _load(cdir, recurse=False):
      confl = os.path.join(cdir, CONFIG_FNAME)
      try:
        with open(confl, 'r') as fp:
          conf = yaml.safe_load(fp)
          if type(conf) is not dict:
            raise InvalidConfiguration('Configuration at %s is not a dictionary.' % confl)
          return conf
      except EnvironmentError:
        parent = os.path.dirname(cdir)
        if recurse and parent != cdir:
          return _load(parent, recurse=True)
        else:
          return dict()
      except yaml.YAMLError:
        raise InvalidConfiguration('Configuration at %s is an invalid YAML file.' % confl)

    def _update(prev, next):
      for k, v in next.items():
        if isinstance(v, dict):
          prev[k] = _update(prev.get(k, {}), v)
        else:
          prev[k] = v
      return prev

    conf = _load(os.path.dirname(__file__))

    if not force_default:
      home_conf = _load(os.path.expanduser('~'))
      local_conf = _load(os.path.abspath(os.curdir), recurse=True)

      _update(conf, home_conf)
      _update(conf, local_conf)
    return conf