From 539198435cbd007a0acae95e86cadc726636d291 Mon Sep 17 00:00:00 2001 From: jan Date: Sun, 31 Mar 2019 14:13:12 -0700 Subject: [PATCH] Add .copy() and .deepcopy() convenience methods --- masque/subpattern.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/masque/subpattern.py b/masque/subpattern.py index 2ff0033..811c670 100644 --- a/masque/subpattern.py +++ b/masque/subpattern.py @@ -4,6 +4,7 @@ """ from typing import Union, List +import copy import numpy from numpy import pi @@ -183,3 +184,19 @@ class SubPattern: """ self.scale *= c return self + + def copy(self) -> 'SubPattern': + """ + Return a shallow copy of the subpattern. + + :return: copy.copy(self) + """ + return copy.copy(self) + + def deepcopy(self) -> 'SubPattern': + """ + Return a deep copy of the subpattern. + + :return: copy.copy(self) + """ + return copy.deepcopy(self)