Skip to content

Commit

Permalink
Address LoaderProtocol comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed May 12, 2024
1 parent 43c23c1 commit 37f0392
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion pkg_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@

if TYPE_CHECKING:
from _typeshed import StrPath
from types import _LoaderProtocol

T = TypeVar("T")
# Type aliases
Expand All @@ -137,6 +136,8 @@
# Any object works, but let's indicate we expect something like a module (optionally has __loader__ or __file__)
_ModuleLike = Union[object, types.ModuleType]
_AdapterType = Callable[..., Any] # Incomplete
# Use _typeshed.importlib.LoaderProtocol once available https://github.com/python/typeshed/pull/11890
_LoaderProtocol = Any # Incomplete


_PEP440_FALLBACK = re.compile(r"^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)", re.I)
Expand Down
2 changes: 1 addition & 1 deletion pkg_resources/extern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def find_spec(
):
"""Return a module spec for vendored names."""
return (
# https://github.com/python/typeshed/issues/11882
# This should fix itself next mypy release https://github.com/python/typeshed/pull/11890
importlib.util.spec_from_loader(fullname, self) # type: ignore[arg-type]
if self._module_matches_namespace(fullname)
else None
Expand Down

0 comments on commit 37f0392

Please sign in to comment.