gfw.common.collections.DeepChainMap#
- class DeepChainMap(*maps)[source]#
A recursive version of ChainMap.
Example
>>> base = {"a": {"x": 1}, "b": 2} >>> override = {"a": {"y": 3}} >>> dcm = DeepChainMap(override, base) >>> dcm["a"]["x"] 1 >>> dcm["a"].to_dict() {'x': 1, 'y': 3}
Methods
Clear maps[0], leaving maps[1:] intact.
New ChainMap or subclass with a new copy of maps[0] and refs to maps[1:]
Create a ChainMap with a single dict created from the iterable.
D.get(k[,d]) -> D[k] if k in D, else d.
D.items() -> a set-like object providing a view on D's items
D.keys() -> a set-like object providing a view on D's keys
New ChainMap with a new map followed by all previous maps.
Remove key from maps[0] and return its value.
Remove and return an item pair from maps[0].
D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
Returns a dictionary repr, taking care of any nested DeepChainMap instances.
D.update([E, ]**F) -> None.
D.values() -> an object providing a view on D's values
Attributes
].