MCPcopy Create free account
hub / github.com/OpenTalker/StyleHEAT / recursive_update

Function recursive_update

configs/config.py:203–215  ·  view source on GitHub ↗

Recursively update AttrDict d with AttrDict u

(d, u)

Source from the content-addressed store, hash-verified

201
202
203def recursive_update(d, u):
204 """Recursively update AttrDict d with AttrDict u"""
205 for key, value in u.items():
206 if isinstance(value, collections.abc.Mapping):
207 d.__dict__[key] = recursive_update(d.get(key, AttrDict({})), value)
208 elif isinstance(value, (list, tuple)):
209 if isinstance(value[0], dict):
210 d.__dict__[key] = [AttrDict(item) for item in value]
211 else:
212 d.__dict__[key] = value
213 else:
214 d.__dict__[key] = value
215 return d

Callers 1

__init__Method · 0.85

Calls 2

AttrDictClass · 0.85
getMethod · 0.45

Tested by

no test coverage detected