MCPcopy Index your code
hub / github.com/python/cpython / new_child

Method new_child

Lib/collections/__init__.py:1105–1114  ·  view source on GitHub ↗

New ChainMap with a new map followed by all previous maps. If no map is provided, an empty dict is used. Keyword arguments update the map or new empty dict.

(self, m=None, **kwargs)

Source from the content-addressed store, hash-verified

1103 __copy__ = copy
1104
1105 def new_child(self, m=None, **kwargs): # like Django's Context.push()
1106 '''New ChainMap with a new map followed by all previous maps.
1107 If no map is provided, an empty dict is used.
1108 Keyword arguments update the map or new empty dict.
1109 '''
1110 if m is None:
1111 m = kwargs
1112 elif kwargs:
1113 m.update(kwargs)
1114 return self.__class__(m, *self.maps)
1115
1116 @property
1117 def parents(self): # like Django's Context.pop()

Callers 3

test_basicsMethod · 0.95
test_new_childMethod · 0.95
subTestMethod · 0.80

Calls 2

updateMethod · 0.45
__class__Method · 0.45

Tested by 2

test_basicsMethod · 0.76
test_new_childMethod · 0.76