Add deepcopy() convenience method to Pattern
This commit is contained in:
parent
e4545bfa30
commit
37a55e0d9b
1 changed files with 10 additions and 0 deletions
|
|
@ -367,6 +367,8 @@ class Pattern:
|
||||||
Return a copy of the Pattern, deep-copying shapes and copying subpattern entries, but not
|
Return a copy of the Pattern, deep-copying shapes and copying subpattern entries, but not
|
||||||
deep-copying any referenced patterns.
|
deep-copying any referenced patterns.
|
||||||
|
|
||||||
|
See also: Pattern.deepcopy()
|
||||||
|
|
||||||
:return: A copy of the current Pattern.
|
:return: A copy of the current Pattern.
|
||||||
"""
|
"""
|
||||||
cp = copy.copy(self)
|
cp = copy.copy(self)
|
||||||
|
|
@ -374,6 +376,14 @@ class Pattern:
|
||||||
cp.subpatterns = [copy.copy(subpat) for subpat in cp.subpatterns]
|
cp.subpatterns = [copy.copy(subpat) for subpat in cp.subpatterns]
|
||||||
return cp
|
return cp
|
||||||
|
|
||||||
|
def deepcopy(self) -> 'Pattern':
|
||||||
|
"""
|
||||||
|
Convenience method for copy.deepcopy(pattern)
|
||||||
|
|
||||||
|
:return: A deep copy of the current Pattern.
|
||||||
|
"""
|
||||||
|
return copy.deepcopy(self)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def load(filename: str) -> 'Pattern':
|
def load(filename: str) -> 'Pattern':
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue