Did I find the right examples for you? yes no

All Samples(18)  |  Call(16)  |  Derive(0)  |  Import(2)

        def update_config(conf, overwrites):
    wildcard_keys = []
    for k, v in overwrites.iteritems():
        if k == '__all__':
            continue
        if  k.startswith('___') or k.endswith('___'):
            wildcard_keys.append(k)
            continue

        if k.endswith('__extend__'):
            k = k[:-len('__extend__')]
            if k not in conf:
                conf[k] = v
            elif isinstance(v, list):
                conf[k].extend(v)
            else:
                raise ValueError('cannot extend non-list:', v)
        elif k not in conf:
            conf[k] = copy(v)
        else:
            if isinstance(conf[k], dict) and isinstance(v, dict):
                conf[k] = update_config(conf[k], v)
            else:
                conf[k] = copy(v)

    if '__all__' in overwrites:
        v = overwrites['__all__']
        for conf_k, conf_v in conf.iteritems():
            if isinstance(conf_v, dict):
                conf[conf_k] = update_config(conf_v, v)
            else:
                conf[conf_k] = v

    if wildcard_keys:
        for key in wildcard_keys:
            v = overwrites[key]
            if key.startswith('___'):
                key = key[3:]
                key_check = lambda x: x.endswith(key)
            else:
                key = key[:-3]
                key_check = lambda x: x.startswith(key)
            for conf_k, conf_v in conf.iteritems():
                if not key_check(conf_k):
                    continue
                if isinstance(conf_v, dict):
                    conf[conf_k] = update_config(conf_v, v)
                else:
                    conf[conf_k] = v

    return conf
        


src/p/a/parabird-HEAD/parabird_build.py   parabird(Download)
from seven_zip import SevenZip
 
from utils import ParaLogger, detect_stick, dependency_check, download_application, get_extension_id, copy_from_cache, configtransport, suite, update_config
from extract_files import extract_tarfile, extract_zipfile
from cleanup import cleanup, cleanup_failed
    #
 
    update_config("DEFAULT", "device", args.device)
    update_config("thunderbird_linux", "version", args.thunder)
    update_config("thunderbird_windows", "version", args.thunder)
    update_config("thunderbird_mac", "version", args.thunder)

src/m/a/mapproxy-HEAD/mapproxy/script/conf/app.py   mapproxy(Download)
from .caches import caches
from .seeds import seeds
from .utils import update_config, MapProxyYAMLDumper, download_capabilities
 
from mapproxy.config.loader import load_configuration
    conf['services'] = {'wms': {'md': {'title': cap.metadata()['title']}}}
    if overwrite:
        conf['services'] = update_config(conf['services'], overwrite.pop('service', {}))
 
    conf['sources'] = sources(cap)
    if overwrite:
        conf['sources'] = update_config(conf['sources'], overwrite.pop('sources', {}))
    conf['caches'] = caches(cap, conf['sources'], srs_grids=srs_grids)
    if overwrite:
        conf['caches'] = update_config(conf['caches'], overwrite.pop('caches', {}))
 
    conf['layers'] = layers(cap, conf['caches'])
    if overwrite:
        conf['layers'] = update_config(conf['layers'], overwrite.pop('layers', {}))