in mujoco_worldgen/parser/parser.py [0:0]
def update_mujoco_dict(dict_a, dict_b):
'''
Update mujoco dict_a with the contents of another mujoco dict_b.
'''
other = (str, int, float, np.ndarray, tuple)
for key, value in dict_b.items():
if key not in dict_a:
dict_a[key] = value
elif isinstance(dict_a[key], list):
assert isinstance(value, list), "Expected %s to be a list" % value
dict_a[key] += value
elif isinstance(value, other):
assert(isinstance(dict_a[key], other))
assert dict_a[key] == value, "key=%s\n,Trying to merge dictionaries. " \
"They don't agree on value: %s vs %s" % (key, dict_a[key], value)
else:
assert isinstance(dict_a[key], OrderedDict), "dict_a = %s\nkey=%s\nExpected dict_a[key] to be a OrderedDict." % (dict_a, key)
assert(isinstance(value, OrderedDict))
update_mujoco_dict(dict_a[key], value)