Skip to content

Commit 1358976

Browse files
committed
[SymForce] Enable ignore-without-code in mypy
Requires ignore codes (e.g. `type: ignore[arg-type]`) for all ignores. Reviewers: brad,nathan,ryan-b,william-a Topic: sf-ignore-without-code GitOrigin-RevId: 7994d17696bc68c8e11816a7580555f84188ce08
1 parent 6dea914 commit 1358976

File tree

44 files changed

+48
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+48
-46
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ disallow_untyped_defs = true
193193
mypy_path = [".", "gen/python", "$SYMFORCE_LCMTYPES_DIR", "symforce/pybind"]
194194
explicit_package_bases = true
195195

196+
enable_error_code = ["ignore-without-code"]
197+
196198
[[tool.mypy.overrides]]
197199
module = [
198200
"IPython.*",

symforce/benchmarks/matrix_multiplication/matrices/fetch_matrices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Script to download the matrices used for the benchmark into this folder, in Matrix Market format.
88
"""
99

10-
import ssgetpy # type: ignore
10+
import ssgetpy # type: ignore[import-not-found]
1111

1212
# Matrix ID's used by the benchmark
1313
matrices = [449, 1528, 2086, 1920, 1326, 664]

symforce/test_util/epsilon_handling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
try:
1111
# Attempt, works if we're in ipython
12-
_default_display_func = display # type: ignore
12+
_default_display_func = display # type: ignore[name-defined]
1313
except NameError:
1414
_default_display_func = print
1515

symforce/test_util/random_expressions/unary_binary_expression_gen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ def build_tree_sequence(self, num_ops_target: int) -> T.List:
166166

167167
# The annotations in numpy are wrong, and don't include the Sequence[Any] overload
168168
if arity == 1:
169-
op = np.random.choice(self.unary_ops, p=self.unary_ops_probs) # type: ignore
169+
op = np.random.choice(self.unary_ops, p=self.unary_ops_probs) # type: ignore[arg-type]
170170
else:
171-
op = np.random.choice(self.binary_ops, p=self.binary_ops_probs) # type: ignore
171+
op = np.random.choice(self.binary_ops, p=self.binary_ops_probs) # type: ignore[arg-type]
172172

173173
e += arity - 1 - k # created empty nodes - skipped future leaves
174174
t_leaves += arity - 1 # update number of total leaves

test/geo_matrix_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def test_multiply_elementwise(self) -> None:
383383

384384
with self.assertRaises(TypeError):
385385
# This should fail mypy, since it's actually wrong
386-
a.multiply_elementwise(sf.M43()) # type: ignore
386+
a.multiply_elementwise(sf.M43()) # type: ignore[arg-type]
387387

388388
def test_dot_product(self) -> None:
389389
"""

test/symforce_function_codegen_test_data/symengine/codegen_cpp_test_data/python/lcmtypes/codegen_cpp_test/_constants_t.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __eq__(self, other: object) -> bool:
5454
(self.epsilon==other.epsilon)
5555
)
5656
# Disallow hashing for python struct lcmtypes.
57-
__hash__ = None # type: ignore
57+
__hash__ = None # type: ignore[assignment]
5858

5959
def encode(self) -> bytes:
6060
buf = BytesIO()

test/symforce_function_codegen_test_data/symengine/codegen_cpp_test_data/python/lcmtypes/codegen_cpp_test/_states_t.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __eq__(self, other: object) -> bool:
5555
(self.p==other.p)
5656
)
5757
# Disallow hashing for python struct lcmtypes.
58-
__hash__ = None # type: ignore
58+
__hash__ = None # type: ignore[assignment]
5959

6060
def encode(self) -> bytes:
6161
buf = BytesIO()

test/symforce_function_codegen_test_data/symengine/codegen_cpp_test_data/python/lcmtypes/codegen_cpp_test/_values_vec_t.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __eq__(self, other: object) -> bool:
8080
(self.list_of_lists==other.list_of_lists)
8181
)
8282
# Disallow hashing for python struct lcmtypes.
83-
__hash__ = None # type: ignore
83+
__hash__ = None # type: ignore[assignment]
8484

8585
def encode(self) -> bytes:
8686
buf = BytesIO()

test/symforce_function_codegen_test_data/symengine/codegen_dataclass_in_values_test_data/python/lcmtypes/codegen_test/_my_dataclass_t.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __eq__(self, other: object) -> bool:
5555
(self.rot==other.rot)
5656
)
5757
# Disallow hashing for python struct lcmtypes.
58-
__hash__ = None # type: ignore
58+
__hash__ = None # type: ignore[assignment]
5959

6060
def encode(self) -> bytes:
6161
buf = BytesIO()

test/symforce_function_codegen_test_data/symengine/codegen_explicit_template_instantiation_test_data/python/lcmtypes/codegen_explicit_template_instantiation_test/_constants_t.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __eq__(self, other: object) -> bool:
5454
(self.epsilon==other.epsilon)
5555
)
5656
# Disallow hashing for python struct lcmtypes.
57-
__hash__ = None # type: ignore
57+
__hash__ = None # type: ignore[assignment]
5858

5959
def encode(self) -> bytes:
6060
buf = BytesIO()

0 commit comments

Comments
 (0)