get rid of "identifier"

master
Jan Petykiewicz 1 year ago committed by jan
parent 7ca017d993
commit a0ca53f57a

@ -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:

@ -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))

@ -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

@ -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))

@ -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))

@ -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))

@ -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)

@ -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))

@ -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

Loading…
Cancel
Save