Determines the final additions and replacements.

    Combines the config module with the defaults.

    Args:
        config_module: The loaded local configuration module.

    Returns:
        Config: the final configuration.
197704
def determine_final_config(config_module):
    
    config = Config(
        DEFAULT_LIBRARY_RC_ADDITIONS, DEFAULT_LIBRARY_RC_REPLACEMENTS,
        DEFAULT_TEST_RC_ADDITIONS, DEFAULT_TEST_RC_REPLACEMENTS)

    for field in config._fields:
        if hasattr(config_module, field):
            config = config._replace(**{field: getattr(config_module, field)})

    return config
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)
876484
def add_config(self, config):
        
        self.pre_configure()

        self.config = config

        if not self.has_revision_file():
            #: Create new revision file.
            touch_file(self.revfile_path)

        self.history.load(self.revfile_path)

        self.archiver.target_path = self.dest_path
        self.archiver.zip_path = self.tmp_file_path

        self.state.state_path = os.path.join(
            REVISION_HOME,
            "clients",
            self.key
        )
        self.state.prepare()

        self.post_configure()

        self.prepared = True
201214
def merge_config(self, user_config):
        '''
        
        '''

        # provisioanlly update the default configurations with the user preferences
        temp_data_config = copy.deepcopy(self.data_config).update(user_config)
        temp_model_config = copy.deepcopy(self.model_config).update(user_config)
        temp_conversation_config = copy.deepcopy(self.conversation_config).update(user_config)

        # if the new configurations validate, apply them
        if validate_data_config(temp_data_config):
            self.data_config = temp_data_config
        if validate_model_config(temp_model_config):
            self.model_config = temp_model_config
        if validate_conversation_config(temp_conversation_config):
            self.conversation_config = temp_conversation_config
1272648
def _merge_configuration(self, parent_config, child_options):
        
        # Copy the parent error codes so we won't override them
        error_codes = copy.deepcopy(parent_config.checked_codes)
        if self._has_exclusive_option(child_options):
            error_codes = self._get_exclusive_error_codes(child_options)

        self._set_add_options(error_codes, child_options)

        kwargs = dict(checked_codes=error_codes)
        for key in ('match', 'match_dir', 'ignore_decorators'):
            kwargs[key] = \
                getattr(child_options, key) or getattr(parent_config, key)
        return CheckConfiguration(**kwargs)
1294251
def get_default_config_converters(conv_finder: ConversionFinder) -> List[Union[Converter[Any, ConfigParser], Converter[ConfigParser, Any]]]:
    
    return [ConverterFunction(ConfigParser, DictOfDict, config_to_dict_of_dict, custom_name='config_to_dict_of_dict',
                              function_args={'conversion_finder': conv_finder}),
            ConverterFunction(ConfigParser, dict, merge_all_config_sections_into_a_single_dict,
                              custom_name='merge_all_config_sections_into_a_single_dict',
                              function_args={'conversion_finder': conv_finder})]
69436
def handle_default_options(options):
    
    if options.settings:
        #Set the percept_settings_module (picked up by settings in conf.base)
        os.environ['PERCEPT_SETTINGS_MODULE'] = options.settings
    if options.pythonpath:
        #Append the pythonpath and the directory one up from the pythonpath to sys.path for importing

        options.pythonpath = os.path.abspath(os.path.expanduser(options.pythonpath))
        up_one_path = os.path.abspath(os.path.join(options.pythonpath, ".."))
        sys.path.append(options.pythonpath)
        sys.path.append(up_one_path)
    return options
21395
def _config_parser_to_defaultdict(config_parser):
    
    config = defaultdict(defaultdict)
    for section, section_content in config_parser.items():
        if section != 'DEFAULT':
            for option, option_value in section_content.items():
                config[section][option] = option_value
    return config
222428
def load_from_name(module_name):
    
    global _CONFIG_CACHE
    if module_name not in _CONFIG_CACHE:
        settings = OrderedDict()
        if isinstance(module_name, six.string_types):
            settings = _load_from_module(_import_module(module_name))
        _CONFIG_CACHE[module_name] = settings
    return _CONFIG_CACHE[module_name]
592436
def get_conf_from_module(mod):
    

    conf = ModuleConfig(CONF_SPEC)

    # get imported module
    mod = _get_correct_module(mod)

    conf.set_module(mod)

    # extarct from default object or from module
    if hasattr(mod, 'default'):
        default = mod.default
        conf = extract_conf_from(default, conf)
    else:
        conf = extract_conf_from(mod, conf)
    return conf
95685
def _setDefaults(self):
        

        for configName, configDict in self.configs.items():
            self._setConfig(configName, configDict['default'])
787229
def config(config_dict: typing.Mapping) -> Config:
    
    logger.debug(f"Updating with {config_dict}")
    _cfg.update(config_dict)
    return _cfg
1082496
def propagate_defaults(config_doc):
    
    for group_name, group_doc in config_doc.items():
        if isinstance(group_doc, dict):
            defaults = group_doc.get('defaults', {})

            for item_name, item_doc in group_doc.items():
                if item_name == 'defaults':
                    continue
                if isinstance(item_doc, dict):

                    group_doc[item_name] = \
                        dict_merge_pair(copy.deepcopy(defaults), item_doc)

    return config_doc
68412
def extend_config(config, config_items):
    
    for key, val in list(config_items.items()):
        if hasattr(config, key):
            setattr(config, key, val)

    return config
1135708
def update_config(self, config_dict, config_file):
        
        config_path = path.dirname(config_file)
        self.config.config_file_path = config_file
        self.config.path = config_path
        for config_key, config_value in config_dict.items():
            if config_value != self.config.get_config_value(config_key):
                self.set_preliminary_config_value(config_key, config_value)
247813
function getCustomConfiguration(){
    for(var i = 0; i < cacheModules.length; i++){
      var cacheModule = cacheModules[i];
      if(isEmpty(cacheModule)){
        log(true, 'Cache module at index ' + i + ' is \'empty\'.');
        continue;
      }
      cacheModule = addSettings(cacheModule);
      self.caches.push(cacheModule);
    }
  }
712442
def get_config_object():
    """"""
    global _DEFAULT_CONFIG_WRAPPER
    if _DEFAULT_CONFIG_WRAPPER is not None:
        return _DEFAULT_CONFIG_WRAPPER
    with _DEFAULT_CONFIG_WRAPPER_LOCK:
        if _DEFAULT_CONFIG_WRAPPER is not None:
            return _DEFAULT_CONFIG_WRAPPER
        _DEFAULT_CONFIG_WRAPPER = ConfigWrapper()
        return _DEFAULT_CONFIG_WRAPPER