Skip to content

Commit 06e5a5c

Browse files
alexfiklinducer
authored andcommitted
chore: remove a bunch of mypy ignores
1 parent a80a8f4 commit 06e5a5c

File tree

7 files changed

+19
-26
lines changed

7 files changed

+19
-26
lines changed

pytential/source.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ def get_p2p(self,
124124
def p2p(target_kernels: tuple[Kernel, ...],
125125
source_kernels: tuple[Kernel, ...] | None) -> P2P:
126126
if any(knl.is_complex_valued for knl in target_kernels):
127-
value_dtype = self.complex_dtype # type: ignore[attr-defined]
127+
value_dtype = self.complex_dtype
128128
else:
129-
value_dtype = self.real_dtype # type: ignore[attr-defined]
129+
value_dtype = self.real_dtype
130130

131131
from sumpy.p2p import P2P
132132
return P2P(actx.context,

pytential/symbolic/dof_desc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def __init__(self,
183183

184184
def copy(self,
185185
geometry: GeometryId | None = None,
186-
discr_stage: DiscretizationStage | None = _NoArgSentinel, # type: ignore[assignment]
186+
discr_stage: DiscretizationStage | None = _NoArgSentinel,
187187
granularity: DOFGranularity | None = None) -> DOFDescriptor:
188188
if isinstance(geometry, DOFDescriptor):
189189
discr_stage = geometry.discr_stage \
@@ -262,7 +262,6 @@ def as_dofdesc(desc: DOFDescriptorLike) -> DOFDescriptor:
262262
return desc
263263

264264
if desc in (QBX_SOURCE_STAGE1, QBX_SOURCE_STAGE2, QBX_SOURCE_QUAD_STAGE2):
265-
# NOTE: mypy is not able to be more specific about the type of `desc`
266265
return DOFDescriptor(discr_stage=desc)
267266

268267
if desc in (GRANULARITY_NODE, GRANULARITY_CENTER, GRANULARITY_ELEMENT):

pytential/symbolic/mappers.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,7 @@ def __init__(self,
323323
self.default_target: DOFDescriptor = prim.as_dofdesc(default_target)
324324

325325
def map_common_subexpression_uncached(self, expr) -> Expression:
326-
# Mypy 1.13 complains about this:
327-
# error: Too few arguments for "map_common_subexpression" of "IdentityMapper" [call-arg] # noqa: E501
328-
# error: Argument 1 to "map_common_subexpression" of "IdentityMapper" has incompatible type "LocationTagger"; expected "IdentityMapper[P]" [arg-type] # noqa: E501
329-
# This seems spurious?
330-
return IdentityMapper.map_common_subexpression(self, expr) # type: ignore[arg-type, call-arg]
326+
return IdentityMapper.map_common_subexpression(self, expr)
331327

332328
def _default_dofdesc(self, dofdesc):
333329
if dofdesc.geometry is None:

pytential/symbolic/primitives.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ class IsShapeClass(DiscretizationProperty):
626626
# FIXME: this is added for backwards compatibility with pre-dataclass expressions
627627
def __init__(self, shape: mp.Shape, dofdesc: DOFDescriptor) -> None:
628628
object.__setattr__(self, "shape", shape)
629-
super().__init__(dofdesc) # type: ignore[arg-type]
629+
super().__init__(dofdesc)
630630

631631

632632
@expr_dataclass()
@@ -648,7 +648,7 @@ def __init__(self,
648648
ambient_axis: int,
649649
dofdesc: DOFDescriptor) -> None:
650650
object.__setattr__(self, "ambient_axis", ambient_axis)
651-
super().__init__(dofdesc) # type: ignore[arg-type]
651+
super().__init__(dofdesc)
652652

653653

654654
def nodes(ambient_dim: int, dofdesc: DOFDescriptorLike = None):
@@ -695,9 +695,7 @@ def __new__(cls,
695695
def make_op(operand_i):
696696
return cls(ref_axes, operand_i, as_dofdesc(dofdesc))
697697

698-
# FIXME: mypy is right: new should return `cls` instances and we're
699-
# abusing it to vectorize the call like this.
700-
return componentwise(make_op, operand) # type: ignore[return-value]
698+
return componentwise(make_op, operand)
701699
else:
702700
return DiscretizationProperty.__new__(cls)
703701

@@ -731,7 +729,7 @@ def __init__(self,
731729

732730
object.__setattr__(self, "ref_axes", ref_axes)
733731
object.__setattr__(self, "operand", operand)
734-
super().__init__(dofdesc) # type: ignore[arg-type]
732+
super().__init__(dofdesc)
735733

736734

737735
@for_each_expression
@@ -1363,7 +1361,7 @@ def __new__(cls,
13631361
to_dd = as_dofdesc(to_dd)
13641362

13651363
if from_dd == to_dd:
1366-
return operand # type: ignore[return-value]
1364+
return operand
13671365

13681366
if isinstance(operand, np.ndarray | MultiVector):
13691367
warn(f"Passing {type(operand)} directly to {cls.__name__!r} "
@@ -1374,7 +1372,7 @@ def __new__(cls,
13741372
def make_op(operand_i):
13751373
return cls(from_dd, to_dd, operand_i)
13761374

1377-
return componentwise(make_op, operand) # type: ignore[return-value]
1375+
return componentwise(make_op, operand)
13781376
else:
13791377
return ExpressionNode.__new__(cls)
13801378

@@ -1439,7 +1437,7 @@ def __new__(cls,
14391437
def make_op(operand_i):
14401438
return cls(operand_i)
14411439

1442-
return componentwise(make_op, operand) # type: ignore[return-value]
1440+
return componentwise(make_op, operand)
14431441
else:
14441442
return ExpressionNode.__new__(cls)
14451443

@@ -1525,7 +1523,7 @@ def __new__(cls,
15251523
def make_op(operand_i):
15261524
return cls(operand_i, as_dofdesc(dofdesc))
15271525

1528-
return componentwise(make_op, operand) # type: ignore[return-value]
1526+
return componentwise(make_op, operand)
15291527
else:
15301528
return ExpressionNode.__new__(cls)
15311529

pytential/target.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def ambient_dim(self) -> int:
110110
@property
111111
def ndofs(self) -> int:
112112
# NOTE: arraycontext.Array is not iterable theoretically
113-
for coord_ary in self._nodes: # type: ignore[attr-defined]
113+
for coord_ary in self._nodes:
114114
return coord_ary.shape[0]
115115

116116
raise AttributeError

test/extra_int_eq_data.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class HelmholtzEllisoidTestCase(Helmholtz3DTestCase):
365365

366366
# test case
367367
resolutions: list[int] = field(
368-
default_factory=lambda: [2.0, 0.8]) # type: ignore[list-item]
368+
default_factory=lambda: [2.0, 0.8])
369369
inner_radius: float = 0.4
370370
outer_radius: float = 5.0
371371
check_gradient: bool = True
@@ -455,7 +455,7 @@ class GMSHSphereTestCase(SphereTestCase):
455455

456456
radius: float = 1.5
457457
resolutions: list[int] = field(
458-
default_factory=lambda: [0.4]) # type: ignore[list-item]
458+
default_factory=lambda: [0.4])
459459

460460
def get_mesh(self, resolution, mesh_order):
461461
from meshmode.mesh import SimplexElementGroup, TensorProductElementGroup
@@ -531,7 +531,7 @@ class MergedCubesTestCase(Helmholtz3DTestCase):
531531

532532
# test case
533533
resolutions: list[int] = field(
534-
default_factory=lambda: [1.4]) # type: ignore[list-item]
534+
default_factory=lambda: [1.4])
535535
inner_radius: float = 0.4
536536
outer_radius: float = 12.0
537537

@@ -612,7 +612,7 @@ class EllipticPlaneTestCase(IntegralEquationTestCase):
612612

613613
# test case
614614
resolutions: list[int] = field(
615-
default_factory=lambda: [0.1]) # type: ignore[list-item]
615+
default_factory=lambda: [0.1])
616616
inner_radius: float = 0.2
617617
outer_radius: float = 12 # was '-13' in some large-scale run (?)
618618
check_gradient: bool = False
@@ -662,7 +662,7 @@ class BetterPlaneTestCase(IntegralEquationTestCase):
662662

663663
# test case
664664
resolutions: list[int] = field(
665-
default_factory=lambda: [0.2]) # type: ignore[list-item]
665+
default_factory=lambda: [0.2])
666666
inner_radius: float = 0.2
667667
outer_radius: float = 15
668668
check_gradient: bool = False

test/test_linalg_skeletonization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def test_skeletonize_by_proxy(actx_factory, case, visualize=False):
403403
extra.GMSHSphereTestCase(
404404
target_order=8,
405405
op_type="scalar",
406-
resolutions=[0.4]), # type: ignore[list-item]
406+
resolutions=[0.4]),
407407
]
408408

409409

0 commit comments

Comments
 (0)