diff --git a/masque/ports.py b/masque/ports.py index 3fc556a..740636e 100644 --- a/masque/ports.py +++ b/masque/ports.py @@ -2,6 +2,7 @@ from typing import overload, Self, NoReturn, Any from collections.abc import Iterable, KeysView, ValuesView, Mapping import logging import functools +import copy from collections import Counter from abc import ABCMeta, abstractmethod from itertools import chain @@ -91,6 +92,12 @@ class Port(PositionableImpl, Rotatable, PivotableImpl, Copyable, Flippable): def copy(self) -> Self: return self.deepcopy() + def __deepcopy__(self, memo: dict | None = None) -> Self: + memo = {} if memo is None else memo + new = copy.copy(self) + new._offset = self._offset.copy() + return new + def get_bounds(self) -> NDArray[numpy.float64]: return numpy.vstack((self.offset, self.offset))