Skip to content

Commit

Permalink
Fixes for mypy 1.15
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Feb 5, 2025
1 parent d2c44a2 commit c187f16
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
14 changes: 6 additions & 8 deletions pytato/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
Stack,
)
from pytato.function import Call, FunctionDefinition, NamedCallResult
from pytato.transform import ArrayOrNames, CachedWalkMapper, CombineMapper, Mapper, P
from pytato.transform import ArrayOrNames, CachedWalkMapper, CombineMapper, Mapper


if TYPE_CHECKING:
Expand Down Expand Up @@ -615,20 +615,18 @@ def __init__(self, tags: pytools.tag.Tag | Iterable[pytools.tag.Tag]) -> None:
def combine(self, *args: int) -> int:
return sum(args)

def rec(self, expr: ArrayOrNames, *args: P.args, **kwargs: P.kwargs) -> int:
key = self._cache.get_key(expr, *args, **kwargs)
def rec(self, expr: ArrayOrNames) -> int:
key = self._cache.get_key(expr)
try:
return self._cache.retrieve((expr, args, kwargs), key=key)
return self._cache.retrieve(expr, key=key)
except KeyError:
s = super().rec(expr, *args, **kwargs)
s = super().rec(expr)
if isinstance(expr, Array) and self._tags <= expr.tags:
result = 1 + s
else:
result = 0 + s

self._cache.add((expr, args, kwargs),
0,
key=key)
self._cache.add(expr, 0, key=key)
return result


Expand Down
4 changes: 1 addition & 3 deletions pytato/loopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,7 @@ def keys(self) -> frozenset[str]: # type: ignore[override]


@array_dataclass()
# https://github.com/python/mypy/issues/18115
# https://github.com/python/mypy/issues/17623
class LoopyCallResult(NamedArray): # type: ignore[override]
class LoopyCallResult(NamedArray):
"""
Named array for :class:`LoopyCall`'s result.
Inherits from :class:`~pytato.array.NamedArray`.
Expand Down

0 comments on commit c187f16

Please sign in to comment.