Custom deepcopy for labels

This commit is contained in:
Jan Petykiewicz 2019-05-17 00:31:07 -07:00
parent 17451cd995
commit 703c1aa6d8

View File

@ -1,4 +1,4 @@
from typing import List, Tuple from typing import List, Tuple, Dict
import copy import copy
import numpy import numpy
from numpy import pi from numpy import pi
@ -80,6 +80,11 @@ class Label:
self.offset = numpy.array(offset, dtype=float) self.offset = numpy.array(offset, dtype=float)
self.layer = layer 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 # ---- Non-abstract methods
def copy(self) -> 'Label': def copy(self) -> 'Label':