Use TypeVar for pkgutil.extend_path (#7473)

This commit is contained in:
Marc Mueller
2022-03-19 04:44:38 +01:00
committed by GitHub
parent 4d23919200
commit 37a981920f
2 changed files with 7 additions and 4 deletions

View File

@@ -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: ...