Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for mypy 1.15 #581

Merged
merged 1 commit into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading