From 87cc6bf298bcc1d5b8cc32a2947b7f8477129777 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Mon, 24 Jun 2024 10:38:47 +0300 Subject: [PATCH 1/2] mypy: remove --follow-imports=skip checks --- run-mypy.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/run-mypy.sh b/run-mypy.sh index 715f9716..9c5dadd2 100755 --- a/run-mypy.sh +++ b/run-mypy.sh @@ -1,7 +1,3 @@ #! /bin/bash -set -ex - -mypy --show-error-codes pytools - -mypy --strict --follow-imports=skip pytools/datatable.py pytools/persistent_dict.py +python -m mypy --show-error-codes pytools From 5c872401f951d4e72ec86cc8e78bf567b517d951 Mon Sep 17 00:00:00 2001 From: Alexandru Fikl Date: Mon, 24 Jun 2024 10:39:21 +0300 Subject: [PATCH 2/2] mypy: silence annotation-unchecked warning --- pytools/test/test_pytools.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pytools/test/test_pytools.py b/pytools/test/test_pytools.py index 453f168a..3ca30a4a 100644 --- a/pytools/test/test_pytools.py +++ b/pytools/test/test_pytools.py @@ -172,7 +172,7 @@ def f(i, j=(1,)): assert count[0] == 2 -def test_memoize_frozen(): +def test_memoize_frozen() -> None: from dataclasses import dataclass from pytools import memoize_method @@ -187,9 +187,11 @@ class FrozenDataclass: def double_value(self): return 2 * self.value - c = FrozenDataclass(10) - assert c.double_value() == 20 - c.double_value.clear_cache(c) # pylint: disable=no-member + c0 = FrozenDataclass(10) + assert c0.double_value() == 20 + + # pylint: disable=no-member + c0.double_value.clear_cache(c0) # type: ignore[attr-defined] # }}} @@ -208,9 +210,11 @@ def __setattr__(self, key, value): def double_value(self): return 2 * self.value - c = FrozenClass(10) - assert c.double_value() == 20 - c.double_value.clear_cache(c) # pylint: disable=no-member + c1 = FrozenClass(10) + assert c1.double_value() == 20 + + # pylint: disable=no-member + c1.double_value.clear_cache(c1) # type: ignore[attr-defined] # }}}