mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Use TypeVar for pkgutil.extend_path (#7473)
This commit is contained in:
@@ -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: ...
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user