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

Method __deepcopy__

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

Source from the content-addressed store, hash-verified

606 return self.copy()
607
608 def __deepcopy__(self, memodict=None):
609 config = self.__box_config()
610 out = self.__class__(**config)
611 memodict = memodict if memodict is not None else {}
612 memodict[id(self)] = out
613 # Fill it like __init__ does, still "being created", so nested Boxes get the frozen config too
614 frozen = self._box_config["frozen_box"]
615 if frozen:
616 out._box_config["__created"] = False
617 for k, v in self.items():
618 out[copy.deepcopy(k, memodict)] = copy.deepcopy(v, memodict)
619 out._box_config["__created"] = True
620 self.__copy_internals(out, deep=True, memo=memodict)
621 return out
622
623 def __setstate__(self, state):
624 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