summaryrefslogtreecommitdiff
path: root/bin/update/util/algorithms.py
blob: 5ebe648d5f002280010da232d82c79086d0d5742 (plain)
1
2
3
4
5
6
7
8
9
10
import collections

def recursive_update(d, u):
    for k, v in u.iteritems():
        if isinstance(v, collections.Mapping):
            r = recursive_update(d.get(k, {}), v)
            d[k] = r
        else:
            d[k] = u[k]
    return d