[Port] add custom __deepcopy__
This commit is contained in:
parent
2d63e72802
commit
2b7ad00204
1 changed files with 7 additions and 0 deletions
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue