Use __slots__ for class members

Also use the other sort of type hints for instance variables
This commit is contained in:
Jan Petykiewicz 2019-05-17 00:37:56 -07:00
commit 38f64f7c62
11 changed files with 89 additions and 72 deletions

View file

@ -24,18 +24,13 @@ class Shape(metaclass=ABCMeta):
"""
Abstract class specifying functions common to all shapes.
"""
__slots__ = ('_offset', '_layer', '_dose', 'identifier')
# [x_offset, y_offset]
_offset = numpy.array([0.0, 0.0]) # type: numpy.ndarray
# Layer (integer >= 0 or tuple)
_layer = 0 # type: int or Tuple
# Dose
_dose = 1.0 # type: float
# An arbitrary identifier for the shape, usually not set but used by Pattern.flatten()
identifier = () # type: Tuple
_offset: numpy.ndarray # [x_offset, y_offset]
_layer: int or Tuple # Layer (integer >= 0 or tuple)
_dose: float # Dose
identifier: Tuple # An arbitrary identifier for the shape,
# usually empty but used by Pattern.flatten()
# --- Abstract methods
@abstractmethod