mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Big diff: use lower-case list and dict (#5888)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import importlib.abc
|
||||
import types
|
||||
from typing import Any, Callable, List, Sequence, Tuple
|
||||
from typing import Any, Callable, Sequence, Tuple
|
||||
|
||||
# TODO: the loaders seem a bit backwards, attribute is protocol but __init__ arg isn't?
|
||||
class ModuleSpec:
|
||||
@@ -16,7 +16,7 @@ class ModuleSpec:
|
||||
name: str
|
||||
loader: importlib.abc._LoaderProtocol | None
|
||||
origin: str | None
|
||||
submodule_search_locations: List[str] | None
|
||||
submodule_search_locations: list[str] | None
|
||||
loader_state: Any
|
||||
cached: str | None
|
||||
parent: str | None
|
||||
@@ -90,20 +90,20 @@ class PathFinder:
|
||||
@classmethod
|
||||
def find_module(cls, fullname: str, path: Sequence[bytes | str] | None = ...) -> importlib.abc.Loader | None: ...
|
||||
|
||||
SOURCE_SUFFIXES: List[str]
|
||||
DEBUG_BYTECODE_SUFFIXES: List[str]
|
||||
OPTIMIZED_BYTECODE_SUFFIXES: List[str]
|
||||
BYTECODE_SUFFIXES: List[str]
|
||||
EXTENSION_SUFFIXES: List[str]
|
||||
SOURCE_SUFFIXES: list[str]
|
||||
DEBUG_BYTECODE_SUFFIXES: list[str]
|
||||
OPTIMIZED_BYTECODE_SUFFIXES: list[str]
|
||||
BYTECODE_SUFFIXES: list[str]
|
||||
EXTENSION_SUFFIXES: list[str]
|
||||
|
||||
def all_suffixes() -> List[str]: ...
|
||||
def all_suffixes() -> list[str]: ...
|
||||
|
||||
class FileFinder(importlib.abc.PathEntryFinder):
|
||||
path: str
|
||||
def __init__(self, path: str, *loader_details: Tuple[importlib.abc.Loader, List[str]]) -> None: ...
|
||||
def __init__(self, path: str, *loader_details: Tuple[importlib.abc.Loader, list[str]]) -> None: ...
|
||||
@classmethod
|
||||
def path_hook(
|
||||
cls, *loader_details: Tuple[importlib.abc.Loader, List[str]]
|
||||
cls, *loader_details: Tuple[importlib.abc.Loader, list[str]]
|
||||
) -> Callable[[str], importlib.abc.PathEntryFinder]: ...
|
||||
|
||||
class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader):
|
||||
|
||||
@@ -7,10 +7,10 @@ from email.message import Message
|
||||
from importlib.abc import MetaPathFinder
|
||||
from os import PathLike
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, Iterable, List, NamedTuple, Tuple, overload
|
||||
from typing import Any, Iterable, NamedTuple, Tuple, overload
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def packages_distributions() -> Mapping[str, List[str]]: ...
|
||||
def packages_distributions() -> Mapping[str, list[str]]: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
class PackageNotFoundError(ModuleNotFoundError): ...
|
||||
@@ -21,7 +21,7 @@ if sys.version_info >= (3, 8):
|
||||
class EntryPoint(_EntryPointBase):
|
||||
def load(self) -> Any: ... # Callable[[], Any] or an importable module
|
||||
@property
|
||||
def extras(self) -> List[str]: ...
|
||||
def extras(self) -> list[str]: ...
|
||||
class PackagePath(pathlib.PurePosixPath):
|
||||
def read_text(self, encoding: str = ...) -> str: ...
|
||||
def read_binary(self) -> bytes: ...
|
||||
@@ -47,7 +47,7 @@ if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
@classmethod
|
||||
def discover(
|
||||
cls, *, context: None = ..., name: str | None = ..., path: List[str] = ..., **kwargs: Any
|
||||
cls, *, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any
|
||||
) -> Iterable[Distribution]: ...
|
||||
@staticmethod
|
||||
def at(path: StrPath) -> PathDistribution: ...
|
||||
@@ -56,17 +56,17 @@ if sys.version_info >= (3, 8):
|
||||
@property
|
||||
def version(self) -> str: ...
|
||||
@property
|
||||
def entry_points(self) -> List[EntryPoint]: ...
|
||||
def entry_points(self) -> list[EntryPoint]: ...
|
||||
@property
|
||||
def files(self) -> List[PackagePath] | None: ...
|
||||
def files(self) -> list[PackagePath] | None: ...
|
||||
@property
|
||||
def requires(self) -> List[str] | None: ...
|
||||
def requires(self) -> list[str] | None: ...
|
||||
class DistributionFinder(MetaPathFinder):
|
||||
class Context:
|
||||
name: str | None
|
||||
def __init__(self, *, name: str | None = ..., path: List[str] = ..., **kwargs: Any) -> None: ...
|
||||
def __init__(self, *, name: str | None = ..., path: list[str] = ..., **kwargs: Any) -> None: ...
|
||||
@property
|
||||
def path(self) -> List[str]: ...
|
||||
def path(self) -> list[str]: ...
|
||||
@abc.abstractmethod
|
||||
def find_distributions(self, context: DistributionFinder.Context = ...) -> Iterable[Distribution]: ...
|
||||
class MetadataPathFinder(DistributionFinder):
|
||||
@@ -81,10 +81,10 @@ if sys.version_info >= (3, 8):
|
||||
def distributions(*, context: DistributionFinder.Context) -> Iterable[Distribution]: ...
|
||||
@overload
|
||||
def distributions(
|
||||
*, context: None = ..., name: str | None = ..., path: List[str] = ..., **kwargs: Any
|
||||
*, context: None = ..., name: str | None = ..., path: list[str] = ..., **kwargs: Any
|
||||
) -> Iterable[Distribution]: ...
|
||||
def metadata(distribution_name: str) -> Message: ...
|
||||
def version(distribution_name: str) -> str: ...
|
||||
def entry_points() -> Dict[str, Tuple[EntryPoint, ...]]: ...
|
||||
def files(distribution_name: str) -> List[PackagePath] | None: ...
|
||||
def requires(distribution_name: str) -> List[str] | None: ...
|
||||
def entry_points() -> dict[str, Tuple[EntryPoint, ...]]: ...
|
||||
def files(distribution_name: str) -> list[PackagePath] | None: ...
|
||||
def requires(distribution_name: str) -> list[str] | None: ...
|
||||
|
||||
@@ -2,7 +2,7 @@ import importlib.abc
|
||||
import importlib.machinery
|
||||
import types
|
||||
from _typeshed import StrOrBytesPath
|
||||
from typing import Any, Callable, List
|
||||
from typing import Any, Callable
|
||||
|
||||
def module_for_loader(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ...
|
||||
def set_loader(fxn: Callable[..., types.ModuleType]) -> Callable[..., types.ModuleType]: ...
|
||||
@@ -23,7 +23,7 @@ def spec_from_file_location(
|
||||
location: StrOrBytesPath | None = ...,
|
||||
*,
|
||||
loader: importlib.abc.Loader | None = ...,
|
||||
submodule_search_locations: List[str] | None = ...,
|
||||
submodule_search_locations: list[str] | None = ...,
|
||||
) -> importlib.machinery.ModuleSpec | None: ...
|
||||
def module_from_spec(spec: importlib.machinery.ModuleSpec) -> types.ModuleType: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user