MCPcopy Create free account
hub / github.com/cdgriffith/Box / update

Method update

box/box.py:1132–1146  ·  view source on GitHub ↗
(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

1130 return out_dict
1131
1132 def update(self, *args, **kwargs):
1133 if self._box_config["frozen_box"]:
1134 raise BoxError("Box is frozen")
1135 if len(args) > 1:
1136 raise BoxTypeError(f"update expected at most 1 argument, got {len(args)}")
1137 single_arg = next(iter(args), None)
1138 if single_arg:
1139 if hasattr(single_arg, "keys"):
1140 for k in single_arg:
1141 self._update_store(k, single_arg[k])
1142 else:
1143 for k, v in single_arg:
1144 self._update_store(k, v)
1145 for k in kwargs:
1146 self._update_store(k, kwargs[k])
1147
1148 def _update_store(self, key, value):
1149 self.__setitem__(key, value)

Calls 3

_update_storeMethod · 0.95
BoxErrorClass · 0.90
BoxTypeErrorClass · 0.90