Esempio n. 1
0
 def merge_configs(defaults: OptionValues,
                   vals: OptionValues) -> OptionValues:
     return {
         k: (merge_dicts(v, vals.get(k, {}))
             if isinstance(v, dict) else vals.get(k, v))
         for k, v in defaults.items()
     }
Esempio n. 2
0
def merge_configs(defaults: Dict, vals: Dict) -> Dict:
    ans = {}
    for k, v in defaults.items():
        if isinstance(v, dict):
            newvals = vals.get(k, {})
            ans[k] = merge_dicts(v, newvals)
        else:
            ans[k] = vals.get(k, v)
    return ans
Esempio n. 3
0
def merge_result_dicts(defaults: typing.Dict[str, typing.Any], vals: typing.Dict[str, typing.Any]) -> typing.Dict[str, typing.Any]:
    ans = {}
    for k, v in defaults.items():
        if isinstance(v, dict):
            ans[k] = merge_dicts(v, vals.get(k, {}))
        elif k in actions:
            ans[k] = v + vals.get(k, [])
        else:
            ans[k] = vals.get(k, v)
    return ans