From 045dde42b16581b99539667a87d61252bf4d08ac Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 21 Aug 2024 18:06:25 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=8E=E2=80=8D=E2=99=80=EF=B8=8F=20Genuf?= =?UTF-8?q?lect=20to=20the=20types.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- importlib_resources/_common.py | 4 ++-- importlib_resources/compat/py39.py | 4 ++-- importlib_resources/simple.py | 2 +- importlib_resources/tests/test_files.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/importlib_resources/_common.py b/importlib_resources/_common.py index e95371c..7071511 100644 --- a/importlib_resources/_common.py +++ b/importlib_resources/_common.py @@ -66,10 +66,10 @@ def get_resource_reader(package: types.ModuleType) -> Optional[ResourceReader]: # zipimport.zipimporter does not support weak references, resulting in a # TypeError. That seems terrible. spec = package.__spec__ - reader = getattr(spec.loader, 'get_resource_reader', None) # type: ignore + reader = getattr(spec.loader, 'get_resource_reader', None) # type: ignore[union-attr] if reader is None: return None - return reader(spec.name) # type: ignore + return reader(spec.name) # type: ignore[union-attr] @functools.singledispatch diff --git a/importlib_resources/compat/py39.py b/importlib_resources/compat/py39.py index ab87b9d..ed5abd5 100644 --- a/importlib_resources/compat/py39.py +++ b/importlib_resources/compat/py39.py @@ -5,6 +5,6 @@ if sys.version_info >= (3, 10): - from zipfile import Path as ZipPath # type: ignore + from zipfile import Path as ZipPath else: - from zipp import Path as ZipPath # type: ignore + from zipp import Path as ZipPath diff --git a/importlib_resources/simple.py b/importlib_resources/simple.py index 96f117f..2e75299 100644 --- a/importlib_resources/simple.py +++ b/importlib_resources/simple.py @@ -77,7 +77,7 @@ class ResourceHandle(Traversable): def __init__(self, parent: ResourceContainer, name: str): self.parent = parent - self.name = name # type: ignore + self.name = name # type: ignore[misc] def is_file(self): return True diff --git a/importlib_resources/tests/test_files.py b/importlib_resources/tests/test_files.py index 9cb55d0..311581c 100644 --- a/importlib_resources/tests/test_files.py +++ b/importlib_resources/tests/test_files.py @@ -86,7 +86,7 @@ def test_module_resources(self): """ A module can have resources found adjacent to the module. """ - import mod + import mod # type: ignore[import-not-found] actual = resources.files(mod).joinpath('res.txt').read_text(encoding='utf-8') assert actual == self.spec['res.txt']