get rid of "identifier"

This commit is contained in:
Jan Petykiewicz 2023-01-18 17:14:35 -08:00
parent 1741cfb755
commit ecb61c9174
9 changed files with 2 additions and 23 deletions

View File

@ -18,14 +18,11 @@ class Label(PositionableImpl, LayerableImpl, RepeatableImpl, AnnotatableImpl,
"""
A text annotation with a position and layer (but no size; it is not drawn)
"""
__slots__ = ( '_string', 'identifier')
__slots__ = ( '_string', )
_string: str
""" Label string """
identifier: Tuple
""" Arbitrary identifier tuple, useful for keeping track of history when flattening """
'''
---- Properties
'''
@ -49,9 +46,7 @@ class Label(PositionableImpl, LayerableImpl, RepeatableImpl, AnnotatableImpl,
layer: layer_t = 0,
repetition: Optional[Repetition] = None,
annotations: Optional[annotations_t] = None,
identifier: Tuple = (),
) -> None:
self.identifier = identifier
self.string = string
self.offset = numpy.array(offset, dtype=float, copy=True)
self.layer = layer
@ -64,7 +59,6 @@ class Label(PositionableImpl, LayerableImpl, RepeatableImpl, AnnotatableImpl,
offset=self.offset.copy(),
layer=self.layer,
repetition=self.repetition,
identifier=self.identifier,
)
def __deepcopy__(self: L, memo: Optional[Dict] = None) -> L:

View File

@ -167,7 +167,6 @@ class Arc(Shape, metaclass=AutoSlots):
annotations: Optional[annotations_t] = None,
raw: bool = False,
) -> None:
self.identifier = ()
if raw:
assert(isinstance(radii, numpy.ndarray))
assert(isinstance(angles, numpy.ndarray))

View File

@ -55,7 +55,6 @@ class Circle(Shape, metaclass=AutoSlots):
annotations: Optional[annotations_t] = None,
raw: bool = False,
) -> None:
self.identifier = ()
if raw:
assert(isinstance(offset, numpy.ndarray))
self._radius = radius

View File

@ -102,7 +102,6 @@ class Ellipse(Shape, metaclass=AutoSlots):
annotations: Optional[annotations_t] = None,
raw: bool = False,
) -> None:
self.identifier = ()
if raw:
assert(isinstance(radii, numpy.ndarray))
assert(isinstance(offset, numpy.ndarray))

View File

@ -158,7 +158,6 @@ class Path(Shape, metaclass=AutoSlots):
) -> None:
self._cap_extensions = None # Since .cap setter might access it
self.identifier = ()
if raw:
assert(isinstance(vertices, numpy.ndarray))
assert(isinstance(offset, numpy.ndarray))

View File

@ -84,7 +84,6 @@ class Polygon(Shape, metaclass=AutoSlots):
annotations: Optional[annotations_t] = None,
raw: bool = False,
) -> None:
self.identifier = ()
if raw:
assert(isinstance(vertices, numpy.ndarray))
assert(isinstance(offset, numpy.ndarray))

View File

@ -34,9 +34,6 @@ class Shape(PositionableImpl, LayerableImpl, DoseableImpl, Rotatable, Mirrorable
"""
__slots__ = () # Children should use AutoSlots
identifier: Tuple
""" An arbitrary identifier for the shape, usually empty but used by `Pattern.flatten()` """
def __copy__(self) -> 'Shape':
cls = self.__class__
new = cls.__new__(cls)

View File

@ -75,7 +75,6 @@ class Text(RotatableImpl, Shape, metaclass=AutoSlots):
annotations: Optional[annotations_t] = None,
raw: bool = False,
) -> None:
self.identifier = ()
if raw:
assert(isinstance(offset, numpy.ndarray))
assert(isinstance(mirrored, numpy.ndarray))

View File

@ -34,7 +34,7 @@ class SubPattern(PositionableImpl, DoseableImpl, RotatableImpl, ScalableImpl, Mi
SubPattern provides basic support for nesting Pattern objects within each other, by adding
offset, rotation, scaling, and associated methods.
"""
__slots__ = ('_target', '_mirrored', 'identifier')
__slots__ = ('_target', '_mirrored')
_target: Optional[str]
""" The name of the `Pattern` being instanced """
@ -42,9 +42,6 @@ class SubPattern(PositionableImpl, DoseableImpl, RotatableImpl, ScalableImpl, Mi
_mirrored: NDArray[numpy.bool_]
""" Whether to mirror the instance across the x and/or y axes. """
identifier: Tuple[Any, ...]
""" Arbitrary identifier, used internally by some `masque` functions. """
def __init__(
self,
target: Optional[str],
@ -56,7 +53,6 @@ class SubPattern(PositionableImpl, DoseableImpl, RotatableImpl, ScalableImpl, Mi
scale: float = 1.0,
repetition: Optional[Repetition] = None,
annotations: Optional[annotations_t] = None,
identifier: Tuple[Any, ...] = (),
) -> None:
"""
Args:
@ -67,9 +63,7 @@ class SubPattern(PositionableImpl, DoseableImpl, RotatableImpl, ScalableImpl, Mi
dose: Scaling factor applied to the dose.
scale: Scaling factor applied to the pattern's geometry.
repetition: `Repetition` object, default `None`
identifier: Arbitrary tuple, used internally by some `masque` functions.
"""
self.identifier = identifier
self.target = target
self.offset = offset
self.rotation = rotation