From ecb61c9174e99062077db3bc6539dbd147e41e16 Mon Sep 17 00:00:00 2001 From: Jan Petykiewicz Date: Wed, 18 Jan 2023 17:14:35 -0800 Subject: [PATCH] get rid of "identifier" --- masque/label.py | 8 +------- masque/shapes/arc.py | 1 - masque/shapes/circle.py | 1 - masque/shapes/ellipse.py | 1 - masque/shapes/path.py | 1 - masque/shapes/polygon.py | 1 - masque/shapes/shape.py | 3 --- masque/shapes/text.py | 1 - masque/subpattern.py | 8 +------- 9 files changed, 2 insertions(+), 23 deletions(-) diff --git a/masque/label.py b/masque/label.py index af4f2e2..fc9460c 100644 --- a/masque/label.py +++ b/masque/label.py @@ -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: diff --git a/masque/shapes/arc.py b/masque/shapes/arc.py index 389d6e0..6554946 100644 --- a/masque/shapes/arc.py +++ b/masque/shapes/arc.py @@ -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)) diff --git a/masque/shapes/circle.py b/masque/shapes/circle.py index 9919831..a9beb19 100644 --- a/masque/shapes/circle.py +++ b/masque/shapes/circle.py @@ -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 diff --git a/masque/shapes/ellipse.py b/masque/shapes/ellipse.py index c97f675..2a51e8e 100644 --- a/masque/shapes/ellipse.py +++ b/masque/shapes/ellipse.py @@ -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)) diff --git a/masque/shapes/path.py b/masque/shapes/path.py index e64e380..2539c5b 100644 --- a/masque/shapes/path.py +++ b/masque/shapes/path.py @@ -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)) diff --git a/masque/shapes/polygon.py b/masque/shapes/polygon.py index e778186..05df53b 100644 --- a/masque/shapes/polygon.py +++ b/masque/shapes/polygon.py @@ -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)) diff --git a/masque/shapes/shape.py b/masque/shapes/shape.py index d84246f..a36281e 100644 --- a/masque/shapes/shape.py +++ b/masque/shapes/shape.py @@ -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) diff --git a/masque/shapes/text.py b/masque/shapes/text.py index 229e213..b820bc8 100644 --- a/masque/shapes/text.py +++ b/masque/shapes/text.py @@ -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)) diff --git a/masque/subpattern.py b/masque/subpattern.py index 87e76a3..6c18396 100644 --- a/masque/subpattern.py +++ b/masque/subpattern.py @@ -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