diff --git a/stdlib/@python2/pkgutil.pyi b/stdlib/@python2/pkgutil.pyi index 3b006b376641..8b54a72ec0f3 100644 --- a/stdlib/@python2/pkgutil.pyi +++ b/stdlib/@python2/pkgutil.pyi @@ -1,13 +1,14 @@ from _typeshed import SupportsRead -from typing import IO, Any, Callable, Iterable, Iterator, Union +from typing import IO, Any, Callable, Iterable, Iterator, TypeVar, Union Loader = Any MetaPathFinder = Any PathEntryFinder = Any +_PathT = TypeVar("_PathT", bound=Iterable[str]) _ModuleInfoLike = tuple[Union[MetaPathFinder, PathEntryFinder], str, bool] -def extend_path(path: list[str], name: str) -> list[str]: ... +def extend_path(path: _PathT, name: str) -> _PathT: ... class ImpImporter: def __init__(self, path: str | None = ...) -> None: ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index 607c6b371507..7c27f6702a7e 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import SupportsRead from importlib.abc import Loader, MetaPathFinder, PathEntryFinder -from typing import IO, Any, Callable, Iterable, Iterator, NamedTuple +from typing import IO, Any, Callable, Iterable, Iterator, NamedTuple, TypeVar __all__ = [ "get_importer", @@ -18,12 +18,14 @@ __all__ = [ "ModuleInfo", ] +_PathT = TypeVar("_PathT", bound=Iterable[str]) + class ModuleInfo(NamedTuple): module_finder: MetaPathFinder | PathEntryFinder name: str ispkg: bool -def extend_path(path: list[str], name: str) -> list[str]: ... +def extend_path(path: _PathT, name: str) -> _PathT: ... class ImpImporter: def __init__(self, path: str | None = ...) -> None: ...