Skip to content

Commit

Permalink
type: Ignore warnings related to differences in backport annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Dec 9, 2024
1 parent 809bc6d commit 01aa783
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/acres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@

@cache
def _cache_resource(resource: Traversable) -> Path:
return EXIT_STACK.enter_context(as_file(resource))
# PY310(importlib_resources): no-any-return, PY311+(importlib.resources): unused-ignore
return EXIT_STACK.enter_context(as_file(resource)) # type: ignore[no-any-return,unused-ignore]


class Loader:
Expand Down Expand Up @@ -179,7 +180,8 @@ def readable(self, *segments: str) -> Traversable:
This result is not cached or copied to the filesystem in cases where
that would be necessary.
"""
return self.files.joinpath(*segments)
# PY310(importlib_resources): no-any-return, PY311+(importlib.resources): unused-ignore
return self.files.joinpath(*segments) # type: ignore[no-any-return,unused-ignore]

def as_path(self, *segments: str) -> AbstractContextManager[Path]:
"""Ensure data is available as a :class:`~pathlib.Path`.
Expand All @@ -190,7 +192,8 @@ def as_path(self, *segments: str) -> AbstractContextManager[Path]:
This result is not cached, and any temporary files that are created
are deleted when the context is exited.
"""
return as_file(self.files.joinpath(*segments))
# PY310(importlib_resources): no-any-return, PY311+(importlib.resources): unused-ignore
return as_file(self.files.joinpath(*segments)) # type: ignore[no-any-return,unused-ignore]

def cached(self, *segments: str) -> Path:
"""Ensure data resource is available as a :class:`~pathlib.Path`.
Expand All @@ -202,6 +205,7 @@ def cached(self, *segments: str) -> Path:
data multiple times, but directories and their contents being
requested separately may result in some duplication.
"""
return _cache_resource(self.files.joinpath(*segments)) # type: ignore[arg-type]
# PY310(importlib_resources): unused-ignore, PY311+(importlib.resources) arg-type
return _cache_resource(self.files.joinpath(*segments)) # type: ignore[arg-type,unused-ignore]

__call__ = cached

0 comments on commit 01aa783

Please sign in to comment.