Skip to content

Commit

Permalink
made pyright happy
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Nov 25, 2024
1 parent 01fd596 commit 1b7f9dc
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions stl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def logged(class_):
# systems while this works on OS X. Please let me know if you can tell me
# what silly mistake I made here

logger_name = logger.Logged._Logged__get_name(
logger_name = logger.Logged._Logged__get_name( # type: ignore[reportAttributeAccessIssue]
__name__,
class_.__name__,
)
Expand Down Expand Up @@ -94,7 +94,7 @@ def __set(self, value):


@logged
class BaseMesh(logger.Logged, abc.Mapping):
class BaseMesh(logger.Logged, abc.Mapping): # type: ignore[reportGeneralTypeIssues]
"""
Mesh object with easy access to the vectors through v0, v1 and v2.
The normals, areas, min, max and units are calculated automatically.
Expand Down
1 change: 1 addition & 0 deletions stl/stl.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# type: ignore[reportAttributeAccessIssue]
import datetime
import enum
import io
Expand Down
2 changes: 1 addition & 1 deletion tests/stl_corruption.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,4 @@ 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()
assert not mesh.Mesh(data, remove_empty_areas=False).check() # type: ignore[reportAttributeAccessIssue]
1 change: 1 addition & 0 deletions tests/test_ascii.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# type: ignore[reportAttributeAccessIssue]
import io
import locale
import os
Expand Down
4 changes: 2 additions & 2 deletions tests/test_commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def test_main(ascii_file, binary_file, tmpdir, speedups):
def test_args(ascii_file, tmpdir):
parser = main._get_parser('')

def _get_name(*args):
return main._get_name(parser.parse_args(list(map(str, args))))
def _get_name(*args) -> str:
return str(main._get_name(parser.parse_args(list(map(str, args)))))

assert _get_name('--name', 'foobar') == 'foobar'
assert _get_name('-', tmpdir.join('binary.stl')).endswith('binary.stl')
Expand Down
4 changes: 2 additions & 2 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import tempfile

import py.path
import py.path # type: ignore[import]
import pytest

from stl import stl
Expand Down Expand Up @@ -53,7 +53,7 @@ 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')
mesh.save(filename=str(tmp_file), mode='test') # type: ignore[reportArgumentType]

mesh.save(str(tmp_file))
mesh.save(str(tmp_file), update_normals=False)
1 change: 1 addition & 0 deletions tests/test_mesh.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# type: ignore[reportAttributeAccessIssue]
import numpy as np

from stl.base import BaseMesh, RemoveDuplicates
Expand Down
2 changes: 2 additions & 0 deletions tests/test_multiple.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_multiple_stl(tmpdir, speedups):
for _ in range(10):
fh.write(_STL_FILE)
fh.seek(0)
i = 0
for i, m in enumerate(
mesh.Mesh.from_multi_file(str(tmp_file), fh=fh, speedups=speedups)
):
Expand All @@ -58,6 +59,7 @@ def test_multiple_stl_file(tmpdir, speedups):
fh.write(_STL_FILE)

fh.seek(0)
i = -1
for i, m in enumerate(
mesh.Mesh.from_multi_file(str(tmp_file), speedups=speedups)
):
Expand Down
1 change: 1 addition & 0 deletions tests/test_rotate.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# type: ignore[reportAttributeAccessIssue]
import math

import numpy as np
Expand Down

0 comments on commit 1b7f9dc

Please sign in to comment.