Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ cover
/*.stl
/.tox
/stl/*.c
/tmp/
16 changes: 8 additions & 8 deletions stl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@
_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):
Expand All @@ -93,9 +93,9 @@


# 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):
Expand Down Expand Up @@ -243,8 +243,8 @@
]).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
Expand Down Expand Up @@ -593,7 +593,7 @@
)

if non_zero_areas.any():
non_zero_areas.shape = non_zero_areas.shape[0]

Check failure on line 596 in stl/base.py

View workflow job for this annotation

GitHub Actions / type-check

The setter for property "shape" is deprecated   In-place shape modification will be deprecated in NumPy 2.5. (reportDeprecated)
areas = np.hstack((2 * areas[non_zero_areas],) * DIMENSIONS)
units[non_zero_areas] /= areas

Expand Down
17 changes: 8 additions & 9 deletions stl/stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
IO,
TYPE_CHECKING,
Any,
Final,
Literal as L, # noqa: N817
cast,
)
Expand Down Expand Up @@ -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):
Expand Down
Loading