MCPcopy Index your code
hub / github.com/RustPython/RustPython / new_child

Method new_child

Lib/collections/__init__.py:1064–1073  ·  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

1062 __copy__ = copy
1063
1064 def new_child(self, m=None, **kwargs): # like Django's Context.push()
1065 '''New ChainMap with a new map followed by all previous maps.
1066 If no map is provided, an empty dict is used.
1067 Keyword arguments update the map or new empty dict.
1068 '''
1069 if m is None:
1070 m = kwargs
1071 elif kwargs:
1072 m.update(kwargs)
1073 return self.__class__(m, *self.maps)
1074
1075 @property
1076 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