Skip to content

Commit 5186178

Browse files
committed
chore: remove a bunch of mypy comments
1 parent 9cac2c9 commit 5186178

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

arraycontext/container/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ def _serialize_ndarray_container(ary: numpy.ndarray) -> SerializedContainer:
299299

300300

301301
@deserialize_container.register(np.ndarray)
302-
# https://github.com/python/mypy/issues/13040
303-
def _deserialize_ndarray_container( # type: ignore[misc]
302+
def _deserialize_ndarray_container(
304303
template: numpy.ndarray,
305304
serialized: SerializedContainer) -> numpy.ndarray:
306305
# disallow subclasses
@@ -309,8 +308,7 @@ def _deserialize_ndarray_container( # type: ignore[misc]
309308

310309
result = type(template)(template.shape, dtype=object)
311310
for i, subary in serialized:
312-
# FIXME: numpy annotations don't seem to handle object arrays very well
313-
result[i] = subary # type: ignore[call-overload]
311+
result[i] = subary
314312

315313
return result
316314

arraycontext/container/traversal.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# mypy: disallow-untyped-defs
2-
31
"""
42
.. currentmodule:: arraycontext
53
@@ -976,7 +974,6 @@ def unflatten(
976974
checking is performed on the unflattened array. Otherwise, these
977975
checks are skipped.
978976
"""
979-
# NOTE: https://github.com/python/mypy/issues/7057
980977
offset: int = 0
981978
common_dtype = None
982979

@@ -1046,12 +1043,12 @@ def _unflatten(
10461043
# Checking strides for 0 sized arrays is ill-defined
10471044
# since they cannot be indexed
10481045
if (
1049-
# Mypy has a point: nobody promised a .strides attribute.
1046+
# pyright has a point: nobody promised a .strides attribute.
10501047
template_subary_c.strides != subary.strides # pyright: ignore[reportAttributeAccessIssue]
10511048
and template_subary_c.size != 0
10521049
):
10531050
raise ValueError(
1054-
# Mypy has a point: nobody promised a .strides attribute.
1051+
# pyright has a point: nobody promised a .strides attribute.
10551052
f"strides do not match template: got {subary.strides}, " # pyright: ignore[reportAttributeAccessIssue]
10561053
f"expected {template_subary_c.strides}") from None
10571054

arraycontext/pytest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ def pytest_generate_tests_for_array_contexts(
325325
if env_factory_string is not None:
326326
unique_factories = set(env_factory_string.split(","))
327327
else:
328-
unique_factories = set(factories) # type: ignore[arg-type]
328+
unique_factories = set(factories)
329329

330330
if not unique_factories:
331331
raise ValueError("no array context factories were selected")

test/testlib.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ def _serialize_dof_container(ary: DOFArray):
114114

115115

116116
@deserialize_container.register(DOFArray)
117-
# https://github.com/python/mypy/issues/13040
118-
def _deserialize_dof_container( # type: ignore[misc]
117+
def _deserialize_dof_container(
119118
template, iterable):
120119
def _raise_index_inconsistency(i, stream_i):
121120
raise ValueError(
@@ -130,8 +129,7 @@ def _raise_index_inconsistency(i, stream_i):
130129

131130

132131
@with_array_context.register(DOFArray)
133-
# https://github.com/python/mypy/issues/13040
134-
def _with_actx_dofarray(ary: DOFArray, actx: ArrayContext) -> DOFArray: # type: ignore[misc]
132+
def _with_actx_dofarray(ary: DOFArray, actx: ArrayContext) -> DOFArray:
135133
return type(ary)(actx, ary.data)
136134

137135
# }}}
@@ -227,6 +225,5 @@ class Velocity3D(Velocity2D):
227225

228226

229227
@with_array_context.register(Velocity2D)
230-
# https://github.com/python/mypy/issues/13040
231-
def _with_actx_velocity_2d(ary, actx): # type: ignore[misc]
228+
def _with_actx_velocity_2d(ary, actx):
232229
return type(ary)(ary.u, ary.v, actx)

0 commit comments

Comments
 (0)