From 608fa1f4f1c7cf9f7ac4bac13fad9b48455da522 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl <alexfikl@gmail.com> Date: Mon, 14 Oct 2024 15:17:27 +0300 Subject: [PATCH] fix: new mypy 1.12 errors --- pytools/__init__.py | 6 +++--- pytools/graph.py | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pytools/__init__.py b/pytools/__init__.py index 2694de2..1b1608b 100644 --- a/pytools/__init__.py +++ b/pytools/__init__.py @@ -950,7 +950,7 @@ class memoize_in: # noqa: N801 try: return self.cache_dict[args] except KeyError: - result = inner(*args) + result = inner(*args, **kwargs) self.cache_dict[args] = result return result @@ -984,12 +984,12 @@ class keyed_memoize_in(Generic[P, R]): # noqa: N801 @wraps(inner) def new_inner(*args: P.args, **kwargs: P.kwargs) -> R: assert not kwargs - key = self.key(*args) + key = self.key(*args, **kwargs) try: return self.cache_dict[key] except KeyError: - result = inner(*args) + result = inner(*args, **kwargs) self.cache_dict[key] = result return result diff --git a/pytools/graph.py b/pytools/graph.py index f00547b..359e806 100644 --- a/pytools/graph.py +++ b/pytools/graph.py @@ -258,7 +258,7 @@ class CycleError(Exception): class _SupportsLT(Protocol): - def __lt__(self, other: object) -> bool: + def __lt__(self, other: Any) -> bool: ... @@ -278,9 +278,10 @@ class _HeapEntry(Generic[NodeT]): return self.key < other.key -def compute_topological_order(graph: GraphT[NodeT], - key: Optional[Callable[[NodeT], Any]] = None) \ - -> List[NodeT]: +def compute_topological_order( + graph: GraphT[NodeT], + key: Optional[Callable[[NodeT], _SupportsLT]] = None, + ) -> List[NodeT]: """Compute a topological order of nodes in a directed graph. :arg key: A custom key function may be supplied to determine the order in -- GitLab