[Ref] misc copy fixes -- don't deepcopy repetition or annotations in __copy__
This commit is contained in:
parent
36cb86a15d
commit
0cce5e0586
1 changed files with 6 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue