mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-08 10:50:59 +08:00
Big diff: use lower-case list and dict (#5888)
This commit is contained in:
@@ -2,7 +2,7 @@ import importlib.abc
|
||||
import types
|
||||
import zipimport
|
||||
from abc import ABCMeta
|
||||
from typing import IO, Any, Callable, Dict, Generator, Iterable, List, Optional, Sequence, Set, Tuple, TypeVar, Union, overload
|
||||
from typing import IO, Any, Callable, Generator, Iterable, Optional, Sequence, Set, Tuple, TypeVar, Union, overload
|
||||
|
||||
LegacyVersion = Any # from packaging.version
|
||||
Version = Any # from packaging.version
|
||||
@@ -20,7 +20,7 @@ def declare_namespace(name: str) -> None: ...
|
||||
def fixup_namespace_packages(path_item: str) -> None: ...
|
||||
|
||||
class WorkingSet:
|
||||
entries: List[str]
|
||||
entries: list[str]
|
||||
def __init__(self, entries: Iterable[str] | None = ...) -> None: ...
|
||||
def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ...
|
||||
def run_script(self, requires: str, script_name: str) -> None: ...
|
||||
@@ -31,12 +31,12 @@ class WorkingSet:
|
||||
def find(self, req: Requirement) -> Distribution | None: ...
|
||||
def resolve(
|
||||
self, requirements: Iterable[Requirement], env: Environment | None = ..., installer: _InstallerType | None = ...
|
||||
) -> List[Distribution]: ...
|
||||
) -> list[Distribution]: ...
|
||||
def add(self, dist: Distribution, entry: str | None = ..., insert: bool = ..., replace: bool = ...) -> None: ...
|
||||
def subscribe(self, callback: Callable[[Distribution], None]) -> None: ...
|
||||
def find_plugins(
|
||||
self, plugin_env: Environment, full_env: Environment | None = ..., fallback: bool = ...
|
||||
) -> Tuple[List[Distribution], Dict[Distribution, Exception]]: ...
|
||||
) -> Tuple[list[Distribution], dict[Distribution, Exception]]: ...
|
||||
|
||||
working_set: WorkingSet = ...
|
||||
|
||||
@@ -47,7 +47,7 @@ add_activation_listener = working_set.subscribe
|
||||
|
||||
class Environment:
|
||||
def __init__(self, search_path: Sequence[str] | None = ..., platform: str | None = ..., python: str | None = ...) -> None: ...
|
||||
def __getitem__(self, project_name: str) -> List[Distribution]: ...
|
||||
def __getitem__(self, project_name: str) -> list[Distribution]: ...
|
||||
def __iter__(self) -> Generator[str, None, None]: ...
|
||||
def add(self, dist: Distribution) -> None: ...
|
||||
def remove(self, dist: Distribution) -> None: ...
|
||||
@@ -71,7 +71,7 @@ class Requirement:
|
||||
project_name: str
|
||||
key: str
|
||||
extras: Tuple[str, ...]
|
||||
specs: List[Tuple[str, str]]
|
||||
specs: list[Tuple[str, str]]
|
||||
# TODO: change this to packaging.markers.Marker | None once we can import
|
||||
# packaging.markers
|
||||
marker: Any | None
|
||||
@@ -83,9 +83,9 @@ class Requirement:
|
||||
def load_entry_point(dist: _EPDistType, group: str, name: str) -> Any: ...
|
||||
def get_entry_info(dist: _EPDistType, group: str, name: str) -> EntryPoint | None: ...
|
||||
@overload
|
||||
def get_entry_map(dist: _EPDistType) -> Dict[str, Dict[str, EntryPoint]]: ...
|
||||
def get_entry_map(dist: _EPDistType) -> dict[str, dict[str, EntryPoint]]: ...
|
||||
@overload
|
||||
def get_entry_map(dist: _EPDistType, group: str) -> Dict[str, EntryPoint]: ...
|
||||
def get_entry_map(dist: _EPDistType, group: str) -> dict[str, EntryPoint]: ...
|
||||
|
||||
class EntryPoint:
|
||||
name: str
|
||||
@@ -104,11 +104,11 @@ class EntryPoint:
|
||||
@classmethod
|
||||
def parse(cls, src: str, dist: Distribution | None = ...) -> EntryPoint: ...
|
||||
@classmethod
|
||||
def parse_group(cls, group: str, lines: str | Sequence[str], dist: Distribution | None = ...) -> Dict[str, EntryPoint]: ...
|
||||
def parse_group(cls, group: str, lines: str | Sequence[str], dist: Distribution | None = ...) -> dict[str, EntryPoint]: ...
|
||||
@classmethod
|
||||
def parse_map(
|
||||
cls, data: Dict[str, str | Sequence[str]] | str | Sequence[str], dist: Distribution | None = ...
|
||||
) -> Dict[str, EntryPoint]: ...
|
||||
cls, data: dict[str, str | Sequence[str]] | str | Sequence[str], dist: Distribution | None = ...
|
||||
) -> dict[str, EntryPoint]: ...
|
||||
def load(self, require: bool = ..., env: Environment | None = ..., installer: _InstallerType | None = ...) -> Any: ...
|
||||
def require(self, env: Environment | None = ..., installer: _InstallerType | None = ...) -> None: ...
|
||||
def resolve(self) -> Any: ...
|
||||
@@ -121,7 +121,7 @@ class Distribution(IResourceProvider, IMetadataProvider):
|
||||
location: str
|
||||
project_name: str
|
||||
key: str
|
||||
extras: List[str]
|
||||
extras: list[str]
|
||||
version: str
|
||||
parsed_version: Tuple[str, ...]
|
||||
py_version: str
|
||||
@@ -143,17 +143,17 @@ class Distribution(IResourceProvider, IMetadataProvider):
|
||||
) -> Distribution: ...
|
||||
@classmethod
|
||||
def from_filename(cls, filename: str, metadata: _MetadataType = ..., **kw: str | None | int) -> Distribution: ...
|
||||
def activate(self, path: List[str] | None = ...) -> None: ...
|
||||
def activate(self, path: list[str] | None = ...) -> None: ...
|
||||
def as_requirement(self) -> Requirement: ...
|
||||
def requires(self, extras: Tuple[str, ...] = ...) -> List[Requirement]: ...
|
||||
def requires(self, extras: Tuple[str, ...] = ...) -> list[Requirement]: ...
|
||||
def clone(self, **kw: str | int | None) -> Requirement: ...
|
||||
def egg_name(self) -> str: ...
|
||||
def __cmp__(self, other: Any) -> bool: ...
|
||||
def get_entry_info(self, group: str, name: str) -> EntryPoint | None: ...
|
||||
@overload
|
||||
def get_entry_map(self) -> Dict[str, Dict[str, EntryPoint]]: ...
|
||||
def get_entry_map(self) -> dict[str, dict[str, EntryPoint]]: ...
|
||||
@overload
|
||||
def get_entry_map(self, group: str) -> Dict[str, EntryPoint]: ...
|
||||
def get_entry_map(self, group: str) -> dict[str, EntryPoint]: ...
|
||||
def load_entry_point(self, group: str, name: str) -> Any: ...
|
||||
|
||||
EGG_DIST: int
|
||||
@@ -166,20 +166,20 @@ def resource_exists(package_or_requirement: _PkgReqType, resource_name: str) ->
|
||||
def resource_stream(package_or_requirement: _PkgReqType, resource_name: str) -> IO[bytes]: ...
|
||||
def resource_string(package_or_requirement: _PkgReqType, resource_name: str) -> bytes: ...
|
||||
def resource_isdir(package_or_requirement: _PkgReqType, resource_name: str) -> bool: ...
|
||||
def resource_listdir(package_or_requirement: _PkgReqType, resource_name: str) -> List[str]: ...
|
||||
def resource_listdir(package_or_requirement: _PkgReqType, resource_name: str) -> list[str]: ...
|
||||
def resource_filename(package_or_requirement: _PkgReqType, resource_name: str) -> str: ...
|
||||
def set_extraction_path(path: str) -> None: ...
|
||||
def cleanup_resources(force: bool = ...) -> List[str]: ...
|
||||
def cleanup_resources(force: bool = ...) -> list[str]: ...
|
||||
|
||||
class IResourceManager:
|
||||
def resource_exists(self, package_or_requirement: _PkgReqType, resource_name: str) -> bool: ...
|
||||
def resource_stream(self, package_or_requirement: _PkgReqType, resource_name: str) -> IO[bytes]: ...
|
||||
def resource_string(self, package_or_requirement: _PkgReqType, resource_name: str) -> bytes: ...
|
||||
def resource_isdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> bool: ...
|
||||
def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> List[str]: ...
|
||||
def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> list[str]: ...
|
||||
def resource_filename(self, package_or_requirement: _PkgReqType, resource_name: str) -> str: ...
|
||||
def set_extraction_path(self, path: str) -> None: ...
|
||||
def cleanup_resources(self, force: bool = ...) -> List[str]: ...
|
||||
def cleanup_resources(self, force: bool = ...) -> list[str]: ...
|
||||
def get_cache_path(self, archive_name: str, names: Iterable[str] = ...) -> str: ...
|
||||
def extraction_error(self) -> None: ...
|
||||
def postprocess(self, tempname: str, filename: str) -> None: ...
|
||||
@@ -192,10 +192,10 @@ def get_provider(package_or_requirement: Requirement) -> Distribution: ...
|
||||
class IMetadataProvider:
|
||||
def has_metadata(self, name: str) -> bool: ...
|
||||
def metadata_isdir(self, name: str) -> bool: ...
|
||||
def metadata_listdir(self, name: str) -> List[str]: ...
|
||||
def metadata_listdir(self, name: str) -> list[str]: ...
|
||||
def get_metadata(self, name: str) -> str: ...
|
||||
def get_metadata_lines(self, name: str) -> Generator[str, None, None]: ...
|
||||
def run_script(self, script_name: str, namespace: Dict[str, Any]) -> None: ...
|
||||
def run_script(self, script_name: str, namespace: dict[str, Any]) -> None: ...
|
||||
|
||||
class ResolutionError(Exception): ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user