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

Method update

Lib/_collections_abc.py:963–979  ·  view source on GitHub ↗

D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. If E present and has a .keys() method, does: for k in E.keys(): D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: fo

(self, other=(), /, **kwds)

Source from the content-addressed store, hash-verified

961 pass
962
963 def update(self, other=(), /, **kwds):
964 ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F.
965 If E present and has a .keys() method, does: for k in E.keys(): D[k] = E[k]
966 If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v
967 In either case, this is followed by: for k, v in F.items(): D[k] = v
968 '''
969 if isinstance(other, Mapping):
970 for key in other:
971 self[key] = other[key]
972 elif hasattr(other, "keys"):
973 for key in other.keys():
974 self[key] = other[key]
975 else:
976 for key, value in other:
977 self[key] = value
978 for key, value in kwds.items():
979 self[key] = value
980
981 def setdefault(self, key, default=None):
982 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D'

Callers

nothing calls this directly

Calls 4

isinstanceFunction · 0.85
hasattrFunction · 0.85
keysMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected