[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,
|
rotation=self.rotation,
|
||||||
scale=self.scale,
|
scale=self.scale,
|
||||||
mirrored=self.mirrored,
|
mirrored=self.mirrored,
|
||||||
repetition=copy.deepcopy(self.repetition),
|
repetition=self.repetition,
|
||||||
annotations=copy.deepcopy(self.annotations),
|
annotations=self.annotations,
|
||||||
)
|
)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
def __deepcopy__(self, memo: dict | None = None) -> 'Ref':
|
def __deepcopy__(self, memo: dict | None = None) -> 'Ref':
|
||||||
memo = {} if memo is None else memo
|
memo = {} if memo is None else memo
|
||||||
new = copy.copy(self)
|
new = copy.copy(self)
|
||||||
|
new._offset = self._offset.copy()
|
||||||
new.repetition = copy.deepcopy(self.repetition, memo)
|
new.repetition = copy.deepcopy(self.repetition, memo)
|
||||||
new.annotations = copy.deepcopy(self.annotations, memo)
|
new.annotations = copy.deepcopy(self.annotations, memo)
|
||||||
return new
|
return new
|
||||||
|
|
||||||
|
def copy(self) -> 'Ref':
|
||||||
|
return self.deepcopy()
|
||||||
|
|
||||||
def __lt__(self, other: 'Ref') -> bool:
|
def __lt__(self, other: 'Ref') -> bool:
|
||||||
if (self.offset != other.offset).any():
|
if (self.offset != other.offset).any():
|
||||||
return tuple(self.offset) < tuple(other.offset)
|
return tuple(self.offset) < tuple(other.offset)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue