Custom deepcopy() implementations to help speed things up
This commit is contained in:
parent
94410dffc9
commit
a461446059
9 changed files with 80 additions and 8 deletions
|
|
@ -3,7 +3,7 @@
|
|||
offset, rotation, scaling, and other such properties to the reference.
|
||||
"""
|
||||
|
||||
from typing import Union, List
|
||||
from typing import Union, List, Dict
|
||||
import copy
|
||||
|
||||
import numpy
|
||||
|
|
@ -45,6 +45,14 @@ class SubPattern:
|
|||
mirrored = [False, False]
|
||||
self.mirrored = mirrored
|
||||
|
||||
def __deepcopy__(self, memo: Dict = None) -> 'SubPattern':
|
||||
memo = {} if memo is None else memo
|
||||
new = copy.copy(self)
|
||||
new.pattern = copy.deepcopy(self.pattern, memo)
|
||||
new._offset = self._offset.copy()
|
||||
new._mirrored = copy.deepcopy(self._mirrored, memo)
|
||||
return new
|
||||
|
||||
# offset property
|
||||
@property
|
||||
def offset(self) -> numpy.ndarray:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue