Skip to content

Commit

Permalink
Conditional deep cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jun 21, 2020
1 parent ca7b7bd commit 588fc59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/quorum/model.py
Expand Up @@ -2119,11 +2119,11 @@ def json_v(self, *args, **kwargs):
return self.model

def map_v(self, *args, **kwargs):
cls = self.__class__
cls = self.__class__
clone = kwargs.pop("clone", False)
resolve = kwargs.get("resolve", True)
evaluator = kwargs.get("evaluator", "map_v")
if clone: base = self.clone(reset = False)
if clone: base = self.clone(reset = False, deep = True)
else: base = self
return cls._resolve_all(
base.model,
Expand Down Expand Up @@ -2202,9 +2202,9 @@ def copy(self, build = False, rules = True):
build and cls.build(_copy.model, map = False, rules = rules)
return _copy

def clone(self, reset = True):
def clone(self, reset = True, deep = False):
cls = self.__class__
model = dict(self.model)
model = dict(self.model) if deep else self.model
if not reset: return cls(model = model)
indexes = cls.increments()
indexes = indexes + cls.unique_names() + ["_id"]
Expand Down

0 comments on commit 588fc59

Please sign in to comment.