diff --git a/.gitignore b/.gitignore index 84fc547..fac819b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ cover /*.stl /.tox /stl/*.c +/tmp/ diff --git a/stl/base.py b/stl/base.py index 9b4be41..dd2824a 100644 --- a/stl/base.py +++ b/stl/base.py @@ -76,11 +76,11 @@ class _Logged(logger.LoggerProtocol, Protocol): # pragma: no cover _data_1d: 'TypeAlias' = np.ndarray[tuple[int], np.dtype[np.void]] #: When removing empty areas, remove areas that are smaller than this -AREA_SIZE_THRESHOLD: Final[L[0]] = 0 +AREA_SIZE_THRESHOLD: L[0] = 0 #: Vectors in a point -VECTORS: Final[L[3]] = 3 +VECTORS: L[3] = 3 #: Dimensions used in a vector -DIMENSIONS: Final[L[3]] = 3 +DIMENSIONS: L[3] = 3 class Dimension(enum.IntEnum): @@ -93,9 +93,9 @@ class Dimension(enum.IntEnum): # For backwards compatibility, leave the original references -X: Final[L[Dimension.X]] = Dimension.X -Y: Final[L[Dimension.Y]] = Dimension.Y -Z: Final[L[Dimension.Z]] = Dimension.Z +X: L[Dimension.X] = Dimension.X +Y: L[Dimension.Y] = Dimension.Y +Z: L[Dimension.Z] = Dimension.Z class RemoveDuplicates(enum.Enum): @@ -243,8 +243,8 @@ class BaseMesh(logger.Logged, abc.Mapping['_ToIndices', np.ndarray]): ]).newbyteorder('<') # Even on big endian arches, use little e. speedups: Final[bool] - name: Final['bytes | str'] - data: Final[_data_1d] + name: 'bytes | str' + data: _data_1d _min: _f32_1d _max: _f32_1d diff --git a/stl/stl.py b/stl/stl.py index 948a143..168f9e7 100644 --- a/stl/stl.py +++ b/stl/stl.py @@ -9,7 +9,6 @@ IO, TYPE_CHECKING, Any, - Final, Literal as L, # noqa: N817 cast, ) @@ -58,20 +57,20 @@ class Mode(enum.IntEnum): # For backwards compatibility, leave the original references -AUTOMATIC: Final[L[Mode.AUTOMATIC]] = Mode.AUTOMATIC -ASCII: Final[L[Mode.ASCII]] = Mode.ASCII -BINARY: Final[L[Mode.BINARY]] = Mode.BINARY +AUTOMATIC: L[Mode.AUTOMATIC] = Mode.AUTOMATIC +ASCII: L[Mode.ASCII] = Mode.ASCII +BINARY: L[Mode.BINARY] = Mode.BINARY #: Amount of bytes to read while using buffered reading -BUFFER_SIZE: Final[L[4096]] = 4096 +BUFFER_SIZE: L[4096] = 4096 #: The amount of bytes in the header field -HEADER_SIZE: Final[L[80]] = 80 +HEADER_SIZE: L[80] = 80 #: The amount of bytes in the count field -COUNT_SIZE: Final[L[4]] = 4 +COUNT_SIZE: L[4] = 4 #: The maximum amount of triangles we can read from binary files -MAX_COUNT: Final[float] = 1e8 +MAX_COUNT: float = 1e8 #: The header format, can be safely monkeypatched. Limited to 80 characters -HEADER_FORMAT: Final[str] = '{package_name} ({version}) {now} {name}' +HEADER_FORMAT: str = '{package_name} ({version}) {now} {name}' class BaseStl(base.BaseMesh):