From 37a55e0d9bbaa1cb386022d54dd8bcb12089e721 Mon Sep 17 00:00:00 2001 From: jan Date: Sat, 14 Apr 2018 15:02:35 -0700 Subject: [PATCH] Add deepcopy() convenience method to Pattern --- masque/pattern.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/masque/pattern.py b/masque/pattern.py index 8b8575f..a019a1b 100644 --- a/masque/pattern.py +++ b/masque/pattern.py @@ -367,6 +367,8 @@ class Pattern: Return a copy of the Pattern, deep-copying shapes and copying subpattern entries, but not deep-copying any referenced patterns. + See also: Pattern.deepcopy() + :return: A copy of the current Pattern. """ cp = copy.copy(self) @@ -374,6 +376,14 @@ class Pattern: cp.subpatterns = [copy.copy(subpat) for subpat in cp.subpatterns] 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 def load(filename: str) -> 'Pattern': """