Skip to content

Commit

Permalink
flake8 (other peoples' files)
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurlovekin committed Jan 21, 2025
1 parent e9a36a1 commit a3bf4a8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
3 changes: 2 additions & 1 deletion stl/stl.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ def _load_ascii(cls, fh, header, speedups=True):
name = next(iterator)
return name, np.fromiter(iterator, dtype=cls.dtype)

def save(self, filename, fh=None, mode=AUTOMATIC, update_normals=True): # noqa: C901
def save(self, filename, fh=None, mode=AUTOMATIC, update_normals=True):
# noqa: C901
"""Save the STL to a (binary) file
If mode is :py:data:`AUTOMATIC` an :py:data:`ASCII` file will be
Expand Down
3 changes: 2 additions & 1 deletion tests/stl_corruption.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,5 @@ def test_duplicate_polygons():
data['vectors'][0] = np.array([[0, 0, 0], [2, 0, 0], [0, 2, 1.0]])
data['vectors'][0] = np.array([[0, 0, 0], [3, 0, 0], [0, 3, 1.0]])

assert not mesh.Mesh(data, remove_empty_areas=False).check() # type: ignore[reportAttributeAccessIssue]
assert not mesh.Mesh(data, remove_empty_areas=False).check()
# type: ignore[reportAttributeAccessIssue]
3 changes: 2 additions & 1 deletion tests/test_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def test_stl_mesh(ascii_file, tmpdir, speedups):

mesh = stl.StlMesh(ascii_file, speedups=speedups)
with pytest.raises(ValueError):
mesh.save(filename=str(tmp_file), mode='test') # type: ignore[reportArgumentType]
mesh.save(filename=str(tmp_file), mode='test')
# type: ignore[reportArgumentType]

mesh.save(str(tmp_file))
mesh.save(str(tmp_file), update_normals=False)
12 changes: 4 additions & 8 deletions tests/test_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,31 +179,27 @@ def test_base_mesh():

# Check item 0 (contains v0, v1 and v2)
assert (
mesh[0]
== np.array(
mesh[0] == np.array(
[1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0], dtype=np.float32
)
).all()
assert (
mesh.vectors[0]
== np.array(
mesh.vectors[0] == np.array(
[[1.0, 1.0, 1.0], [2.0, 2.0, 2.0], [0.0, 0.0, 0.0]],
dtype=np.float32,
)
).all()
assert (mesh.v0[0] == np.array([1.0, 1.0, 1.0], dtype=np.float32)).all()
assert (
mesh.points[0]
== np.array(
mesh.points[0] == np.array(
[1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 0.0, 0.0, 0.0], dtype=np.float32
)
).all()
assert (mesh.x[0] == np.array([1.0, 2.0, 0.0], dtype=np.float32)).all()

mesh[0] = 3
assert (
mesh[0]
== np.array(
mesh[0] == np.array(
[3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0], dtype=np.float32
)
).all()
Expand Down

0 comments on commit a3bf4a8

Please sign in to comment.