get rid of "identifier"

This commit is contained in:
Jan Petykiewicz 2023-01-18 17:14:35 -08:00 committed by jan
parent 7ca017d993
commit a0ca53f57a
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) A text annotation with a position and layer (but no size; it is not drawn)
""" """
__slots__ = ( '_string', 'identifier') __slots__ = ( '_string', )
_string: str _string: str
""" Label string """ """ Label string """
identifier: Tuple
""" Arbitrary identifier tuple, useful for keeping track of history when flattening """
''' '''
---- Properties ---- Properties
''' '''
@ -49,9 +46,7 @@ class Label(PositionableImpl, LayerableImpl, RepeatableImpl, AnnotatableImpl,
layer: layer_t = 0, layer: layer_t = 0,
repetition: Optional[Repetition] = None, repetition: Optional[Repetition] = None,
annotations: Optional[annotations_t] = None, annotations: Optional[annotations_t] = None,
identifier: Tuple = (),
) -> None: ) -> None:
self.identifier = identifier
self.string = string self.string = string
self.offset = numpy.array(offset, dtype=float, copy=True) self.offset = numpy.array(offset, dtype=float, copy=True)
self.layer = layer self.layer = layer
@ -64,7 +59,6 @@ class Label(PositionableImpl, LayerableImpl, RepeatableImpl, AnnotatableImpl,
offset=self.offset.copy(), offset=self.offset.copy(),
layer=self.layer, layer=self.layer,
repetition=self.repetition, repetition=self.repetition,
identifier=self.identifier,
) )
def __deepcopy__(self: L, memo: Optional[Dict] = None) -> L: 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, annotations: Optional[annotations_t] = None,
raw: bool = False, raw: bool = False,
) -> None: ) -> None:
self.identifier = ()
if raw: if raw:
assert(isinstance(radii, numpy.ndarray)) assert(isinstance(radii, numpy.ndarray))
assert(isinstance(angles, numpy.ndarray)) assert(isinstance(angles, numpy.ndarray))

View File

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

View File

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

View File

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

View File

@ -84,7 +84,6 @@ class Polygon(Shape, metaclass=AutoSlots):
annotations: Optional[annotations_t] = None, annotations: Optional[annotations_t] = None,
raw: bool = False, raw: bool = False,
) -> None: ) -> None:
self.identifier = ()
if raw: if raw:
assert(isinstance(vertices, numpy.ndarray)) assert(isinstance(vertices, numpy.ndarray))
assert(isinstance(offset, 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 __slots__ = () # Children should use AutoSlots
identifier: Tuple
""" An arbitrary identifier for the shape, usually empty but used by `Pattern.flatten()` """
def __copy__(self) -> 'Shape': def __copy__(self) -> 'Shape':
cls = self.__class__ cls = self.__class__
new = cls.__new__(cls) new = cls.__new__(cls)

View File

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