Skip to content

Commit ad033e8

Browse files
committed
Keep _ModuleLike not Any
1 parent a9d4e1f commit ad033e8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg_resources/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@
122122
_ResolvedEntryPoint = Any # Can be any attribute in the module
123123
_ResourceStream = Any # TODO / Incomplete: A readable file-like object
124124
# Any object works, but let's indicate we expect something like a module (optionally has __loader__ or __file__)
125-
_ModuleLike = Any
126-
_ProviderFactoryType = Callable[[_ModuleLike], "IResourceProvider"]
125+
_ModuleLike = Union[object, types.ModuleType]
126+
# Any: Should be _ModuleLike but we end up with issues where _ModuleLike doesn't have _ZipLoaderModule's __loader__
127+
_ProviderFactoryType = Callable[[Any], "IResourceProvider"]
127128
_DistFinderType = Callable[[_T, str, bool], Iterable["Distribution"]]
128129
_NSHandlerType = Callable[[_T, str, str, types.ModuleType], Union[str, None]]
129130
_AdapterT = TypeVar(

0 commit comments

Comments
 (0)