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

Method __deepcopy__

box/box.py:599–612  ·  view source on GitHub ↗
(self, memodict=None)

Source from the content-addressed store, hash-verified

597 return self.copy()
598
599 def __deepcopy__(self, memodict=None):
600 config = self.__box_config()
601 out = self.__class__(**config)
602 memodict = memodict if memodict is not None else {}
603 memodict[id(self)] = out
604 # Fill it like __init__ does, still "being created", so nested Boxes get the frozen config too
605 frozen = self._box_config["frozen_box"]
606 if frozen:
607 out._box_config["__created"] = False
608 for k, v in self.items():
609 out[copy.deepcopy(k, memodict)] = copy.deepcopy(v, memodict)
610 out._box_config["__created"] = True
611 self.__copy_internals(out, deep=True, memo=memodict)
612 return out
613
614 def __setstate__(self, state):
615 self._box_config = state["_box_config"]

Callers

nothing calls this directly

Calls 3

__box_configMethod · 0.95
itemsMethod · 0.95
__copy_internalsMethod · 0.95

Tested by

no test coverage detected