(a, b, root, key_list)
Merge config dictionary a into config dictionary b, clobbering the
    options in b whenever they are also specified in a.
Merge config dictionary a into config dictionary b, clobbering the
    options in b whenever they are also specified in a.
Merge config dictionary a into config dictionary b clobbering the options in b whenever they are also specified in a .
def _merge_a_into_b(a, b, root, key_list):
    """Merge config dictionary a into config dictionary b, clobbering the
    options in b whenever they are also specified in a.
    """
    _assert_with_logging(
        isinstance(a, CfgNode),
        "`a` (cur type {}) must be an instance of {}".format(type(a), CfgNode),
    )
    _assert_with_logging(
        isinstance(b, CfgNode),
        "`b` (cur type {}) must be an instance of {}".format(type(b), CfgNode),
    )

    for k, v_ in a.items():
        full_key = ".".join(key_list + [k])

        v = copy.deepcopy(v_)
        v = b._decode_cfg_value(v)

        if k in b:
            v = _check_and_coerce_cfg_value_type(v, b[k], k, full_key)
            # Recursively merge dicts
            if isinstance(v, CfgNode):
                try:
                    _merge_a_into_b(v, b[k], root, key_list + [k])
                except BaseException:
                    raise
            else:
                b[k] = v
        elif b.is_new_allowed():
            b[k] = v
        else:
            if root.key_is_deprecated(full_key):
                continue
            elif root.key_is_renamed(full_key):
                root.raise_key_rename_error(full_key)
            else:
                raise KeyError("Non-existent config key: {}".format(full_key))
def _merge_a_into_b ( a , b , root , key_list ) : _assert_with_logging ( isinstance ( a , CfgNode ) , "`a` (cur type {}) must be an instance of {}" . format ( type ( a ) , CfgNode ) , ) _assert_with_logging ( isinstance ( b , CfgNode ) , "`b` (cur type {}) must be an instance of {}" . format ( type ( b ) , CfgNode ) , ) for k , v_ in a . items ( ) : full_key = "." . join ( key_list + [ k ] ) v = copy . deepcopy ( v_ ) v = b . _decode_cfg_value ( v ) if k in b : v = _check_and_coerce_cfg_value_type ( v , b [ k ] , k , full_key ) # Recursively merge dicts if isinstance ( v , CfgNode ) : try : _merge_a_into_b ( v , b [ k ] , root , key_list + [ k ] ) except BaseException : raise else : b [ k ] = v elif b . is_new_allowed ( ) : b [ k ] = v else : if root . key_is_deprecated ( full_key ) : continue elif root . key_is_renamed ( full_key ) : root . raise_key_rename_error ( full_key ) else : raise KeyError ( "Non-existent config key: {}" . format ( full_key ) )