From 0cce5e058663538a7cebe7e157421045401f735e Mon Sep 17 00:00:00 2001 From: jan Date: Mon, 9 Mar 2026 01:07:50 -0700 Subject: [PATCH] [Ref] misc copy fixes -- don't deepcopy repetition or annotations in __copy__ --- masque/ref.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/masque/ref.py b/masque/ref.py index f38c1a8..8a72167 100644 --- a/masque/ref.py +++ b/masque/ref.py @@ -92,18 +92,22 @@ class Ref( rotation=self.rotation, scale=self.scale, mirrored=self.mirrored, - repetition=copy.deepcopy(self.repetition), - annotations=copy.deepcopy(self.annotations), + repetition=self.repetition, + annotations=self.annotations, ) return new def __deepcopy__(self, memo: dict | None = None) -> 'Ref': memo = {} if memo is None else memo new = copy.copy(self) + new._offset = self._offset.copy() new.repetition = copy.deepcopy(self.repetition, memo) new.annotations = copy.deepcopy(self.annotations, memo) return new + def copy(self) -> 'Ref': + return self.deepcopy() + def __lt__(self, other: 'Ref') -> bool: if (self.offset != other.offset).any(): return tuple(self.offset) < tuple(other.offset)