Updates the content types database with the given configuration.

        :param config:
            The configuration dictionary.
        :param config_filename:
            The path of the configuration file.
13666
def add_config(self, config, config_filename):
        
        content_types = config['content-types']
        comment_groups = config['comment-groups']

        self._comment_groups.update(comment_groups)
        self._content_types.update(content_types)

        for content_type, patterns in content_types.iteritems():
            if not patterns:
                raise ValueError('''error: config parse error: \
%s: Missing pattern for content type - `%s`"''' % (config_file, content_type))
            for pattern in patterns:
                first_character = pattern[0]
                last_character = pattern[-1]
                if first_character == '.':
                    # Extension map.
                    pattern = extension_case_transform_func(pattern)
                    self._extension_map[pattern] = content_type
                elif first_character == '/' and last_character == '/':
                    # Regular expression map.
                    self._regexp_map[re.compile(pattern[1:-1])] = content_type
                else:
                    # Filename map.
                    self._filename_map[pattern] = content_type
537224
def _load(self, config):
        
        if isstring(config):
            self.filename = config
            params = yaml.load(open(config))
        elif isinstance(config, Config):
            # This is the copy constructor...
            self.filename = config.filename
            params = copy.deepcopy(config)
        elif isinstance(config, dict):
            params = copy.deepcopy(config)
        elif config is None:
            params = {}
        else:
            raise Exception('Unrecognized input')

        return params
787229
def config(config_dict: typing.Mapping) -> Config:
    
    logger.debug(f"Updating with {config_dict}")
    _cfg.update(config_dict)
    return _cfg
1046751
public void load(FileConfiguration config) {
        this.config = config;
        
        try {
            parse();
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }
    }
497282
def load_config(filename, filepath=''):
    

    FILE = path.join(filepath, filename)

    try:
        cfg.read(FILE)
        global _loaded
        _loaded = True
    except:
        print("configfile not found.")
1361150
public void setConfig(LogFileConfiguration config) {
        this.config = config == null ? null : config.readOnlyCopy();
        if (config == null) {
            Log.w(
                DOMAIN,
                "Database.log.getFile().getConfig() is now null, meaning file logging is disabled.  "
                    + "Log files required for product support are not being generated.");
        }

        updateConfig();
    }
1003875
def update_config(self, svc_config, **rt_configs):
    
    path = self._path() + '/config'

    if svc_config:
      data = config_to_api_list(svc_config)
    else:
      data = { }
    if rt_configs:
      rt_list = [ ]
      for rt, cfg in rt_configs.iteritems():
        rt_data = config_to_api_list(cfg)
        rt_data['roleType'] = rt
        rt_list.append(rt_data)
      data[ROLETYPES_CFG_KEY] = rt_list

    resp = self._get_resource_root().put(path, data = json.dumps(data))
    return self._parse_svc_config(resp)
802901
def _update_config(self,directory,filename):
        """"""
        basefilename=os.path.splitext(filename)[0]
        ext=os.path.splitext(filename)[1].lower()
        #if filename==LOCATION_FILE:
            #return self._update_config_location(directory)
        #FIXME
        #elif filename==TAG_FILE:
            #return self._update_config_tags(directory)
        if filename==SET_FILE:
            print("%s - Moving photos to album"%(filename))
            return self._upload_media(directory,movealbum_request=True)
        elif filename==MEGAPIXEL_FILE:
            print("%s - Resizing photos"%(filename))
            return self._upload_media(directory,resize_request=True)
        elif ext in self.FB_META_EXTENSIONS:
            print("%s - Changing photo title"%(basefilename))
            return self._upload_media(directory,basefilename,changetitle_request=True)

        return False
669824
public function updateConfigToFile($fileName, Configuration $config)
    {
        $configArray = [
            'api_key' => $config->getApiKey(),
            'api_uri' => $config->getApiUri(),
            'organization' => $config->getOrganizationName() ? $config->getOrganizationName() : '',
        ];

        $yml = [];
        if (file_exists($fileName)) {
            $yml = Yaml::parse(file_get_contents($fileName));
        }

        $yml = array_merge($yml, ['rokka_cli' => $configArray]);

        return file_put_contents($fileName, Yaml::dump($yml));
    }
1254508
def read_config(desired_type: Type[ConfigParser], file_object: TextIOBase,
                logger: Logger, *args, **kwargs) -> ConfigParser:
    

    # see https://docs.python.org/3/library/configparser.html for details
    config = ConfigParser()
    config.read_file(file_object)

    return config
1361661
def _update(self):
        
        with self._lock:
            if getmtime(self._filename) > self._last_modified:
                self._last_modified = getmtime(self._filename)
                self._book = ConfigParser(default_section='format')
                self._book.read(self._filename)
1026974
def _update_config(self,directory,filename):
        """"""
        basefilename=os.path.splitext(filename)[0]
        ext=os.path.splitext(filename)[1].lower()
        if filename==LOCATION_FILE:
            print("%s - Updating geotag information"%(LOCATION_FILE))
            return self._update_config_location(directory)
        elif filename==TAG_FILE:
            print("%s - Updating tags"%(TAG_FILE))
            return self._update_config_tags(directory)
        elif filename==SET_FILE:
            print("%s - Updating sets"%(SET_FILE))
            return self._update_config_sets(directory)
        elif filename==MEGAPIXEL_FILE:
            print("%s - Updating photo size"%(MEGAPIXEL_FILE))
            return self._upload_media(directory,resize_request=True)
        elif ext in self.FLICKR_META_EXTENSIONS:
            return self._update_meta(directory,basefilename)

        return False
492170
def _read_configuration_file(self, config_filename):
        
        config = configparser.ConfigParser()
        config.read(config_filename)

        self._source_directory = config.get('loader', 'source_directory')
        self._source_file_extension = config.get('loader', 'extension')
        self._source_file_encoding = config.get('loader', 'encoding')
        self.__shadow_directory = config.get('loader', 'shadow_directory', fallback=None)

        self._pystratum_metadata_filename = config.get('wrapper', 'metadata')

        self._constants_class_name = config.get('constants', 'class')
1000196
def configToJson(self, fileName):
        
        config = self.getConfig()
        with open(fileName, "w") as outfile:
            dump(config, outfile, indent=4, sort_keys=True)
437276
def jiggle_config_file(self):  # type: () ->int
        
        changed = 0
        # setup.py related. setup.py itself should read __init__.py or __version__.py

        other_files = ["setup.cfg"]

        for file_name in other_files:
            filepath = os.path.join(self.SRC, file_name)

            # only create setup.cfg if we have setup.py
            if (
                self.create_configs
                and not os.path.isfile(filepath)
                and os.path.isfile("setup.py")
            ):
                logger.info("Creating " + unicode(filepath))
                self.file_maker.create_setup_cfg(filepath)

            if os.path.isfile(filepath):
                config = configparser.ConfigParser()
                config.read(filepath)
                try:
                    version = config["metadata"]["version"]
                except KeyError:
                    version = ""
                if version:
                    with io.open(filepath, "w") as configfile:  # save
                        config["metadata"]["version"] = unicode(self.version_to_write())
                        config.write(configfile)
                        changed += 1
        return changed
1184512
def with_updated_configuration(self, options=None,
                                   attribute_options=None):
        
        new_cfg = self.__configurations[-1].copy()
        if not options is None:
            for o_name, o_value in iteritems_(options):
                new_cfg.set_option(o_name, o_value)
        if not attribute_options is None:
            for attr_name, ao_opts in iteritems_(attribute_options):
                for ao_name, ao_value in iteritems_(ao_opts):
                    new_cfg.set_attribute_option(attr_name, ao_name, ao_value)
#        upd_cfg = type(new_cfg)(options=options,
#                                attribute_options=attribute_options)
#        new_cfg.update(upd_cfg)
        return MappingConfigurationContext(self, new_cfg)
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."))