From 703c1aa6d8d5c655dc4483beebf0929351049b31 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Fri, 17 May 2019 00:31:07 -0700 Subject: [PATCH] Custom deepcopy for labels --- masque/label.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/masque/label.py b/masque/label.py index b3bbb6f..738ab20 100644 --- a/masque/label.py +++ b/masque/label.py @@ -1,4 +1,4 @@ -from typing import List, Tuple +from typing import List, Tuple, Dict import copy import numpy from numpy import pi @@ -80,6 +80,11 @@ class Label: self.offset = numpy.array(offset, dtype=float) self.layer = layer + def __deepcopy__(self, memo: Dict = None) -> 'Label': + memo = {} if memo is None else memo + new = copy.copy(self) + new._offset = self._offset.copy() + return new # ---- Non-abstract methods def copy(self) -> 'Label':