You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
462 B
18 lines
462 B
try:
|
|
from collections.abc import Mapping
|
|
except ImportError:
|
|
from collections import Mapping
|
|
|
|
|
|
def update(d, u):
|
|
"""
|
|
Custom recursive update of dictionary
|
|
from http://stackoverflow.com/questions/3232943/update-value-of-a-nested-dictionary-of-varying-depth
|
|
"""
|
|
for k, v in u.iteritems():
|
|
if isinstance(v, Mapping):
|
|
r = update(d.get(k, {}), v)
|
|
d[k] = r
|
|
else:
|
|
d[k] = u[k]
|
|
return d
|