Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -21,21 +21,21 @@ def fixup_namespace_packages(path_item: str) -> None: ...
class WorkingSet:
entries: List[str]
def __init__(self, entries: Optional[Iterable[str]] = ...) -> None: ...
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: ...
def iter_entry_points(self, group: str, name: Optional[str] = ...) -> Generator[EntryPoint, None, None]: ...
def iter_entry_points(self, group: str, name: str | None = ...) -> Generator[EntryPoint, None, None]: ...
def add_entry(self, entry: str) -> None: ...
def __contains__(self, dist: Distribution) -> bool: ...
def __iter__(self) -> Generator[Distribution, None, None]: ...
def find(self, req: Requirement) -> Optional[Distribution]: ...
def find(self, req: Requirement) -> Distribution | None: ...
def resolve(
self, requirements: Iterable[Requirement], env: Optional[Environment] = ..., installer: Optional[_InstallerType] = ...
self, requirements: Iterable[Requirement], env: Environment | None = ..., installer: _InstallerType | None = ...
) -> List[Distribution]: ...
def add(self, dist: Distribution, entry: Optional[str] = ..., insert: bool = ..., replace: bool = ...) -> None: ...
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: Optional[Environment] = ..., fallback: bool = ...
self, plugin_env: Environment, full_env: Environment | None = ..., fallback: bool = ...
) -> Tuple[List[Distribution], Dict[Distribution, Exception]]: ...
working_set: WorkingSet = ...
@@ -46,16 +46,14 @@ iter_entry_points = working_set.iter_entry_points
add_activation_listener = working_set.subscribe
class Environment:
def __init__(
self, search_path: Optional[Sequence[str]] = ..., platform: Optional[str] = ..., python: Optional[str] = ...
) -> None: ...
def __init__(self, search_path: Sequence[str] | None = ..., platform: str | None = ..., python: str | None = ...) -> None: ...
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: ...
def can_add(self, dist: Distribution) -> bool: ...
def __add__(self, other: Union[Distribution, Environment]) -> Environment: ...
def __iadd__(self, other: Union[Distribution, Environment]) -> Environment: ...
def __add__(self, other: Distribution | Environment) -> Environment: ...
def __iadd__(self, other: Distribution | Environment) -> Environment: ...
@overload
def best_match(self, req: Requirement, working_set: WorkingSet) -> Distribution: ...
@overload
@@ -64,9 +62,9 @@ class Environment:
def obtain(self, requirement: Requirement) -> None: ...
@overload
def obtain(self, requirement: Requirement, installer: Callable[[Requirement], _T] = ...) -> _T: ...
def scan(self, search_path: Optional[Sequence[str]] = ...) -> None: ...
def scan(self, search_path: Sequence[str] | None = ...) -> None: ...
def parse_requirements(strs: Union[str, Iterable[str]]) -> Generator[Requirement, None, None]: ...
def parse_requirements(strs: str | Iterable[str]) -> Generator[Requirement, None, None]: ...
class Requirement:
unsafe_name: str
@@ -74,16 +72,16 @@ class Requirement:
key: str
extras: Tuple[str, ...]
specs: List[Tuple[str, str]]
# TODO: change this to Optional[packaging.markers.Marker] once we can import
# TODO: change this to packaging.markers.Marker | None once we can import
# packaging.markers
marker: Optional[Any]
marker: Any | None
@staticmethod
def parse(s: Union[str, Iterable[str]]) -> Requirement: ...
def __contains__(self, item: Union[Distribution, str, Tuple[str, ...]]) -> bool: ...
def parse(s: str | Iterable[str]) -> Requirement: ...
def __contains__(self, item: Distribution | str | Tuple[str, ...]) -> bool: ...
def __eq__(self, other_requirement: Any) -> bool: ...
def load_entry_point(dist: _EPDistType, group: str, name: str) -> Any: ...
def get_entry_info(dist: _EPDistType, group: str, name: str) -> Optional[EntryPoint]: ...
def get_entry_info(dist: _EPDistType, group: str, name: str) -> EntryPoint | None: ...
@overload
def get_entry_map(dist: _EPDistType) -> Dict[str, Dict[str, EntryPoint]]: ...
@overload
@@ -94,31 +92,29 @@ class EntryPoint:
module_name: str
attrs: Tuple[str, ...]
extras: Tuple[str, ...]
dist: Optional[Distribution]
dist: Distribution | None
def __init__(
self,
name: str,
module_name: str,
attrs: Tuple[str, ...] = ...,
extras: Tuple[str, ...] = ...,
dist: Optional[Distribution] = ...,
dist: Distribution | None = ...,
) -> None: ...
@classmethod
def parse(cls, src: str, dist: Optional[Distribution] = ...) -> EntryPoint: ...
def parse(cls, src: str, dist: Distribution | None = ...) -> EntryPoint: ...
@classmethod
def parse_group(
cls, group: str, lines: Union[str, Sequence[str]], dist: Optional[Distribution] = ...
) -> 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: Union[Dict[str, Union[str, Sequence[str]]], str, Sequence[str]], dist: Optional[Distribution] = ...
cls, data: Dict[str, str | Sequence[str]] | str | Sequence[str], dist: Distribution | None = ...
) -> Dict[str, EntryPoint]: ...
def load(self, require: bool = ..., env: Optional[Environment] = ..., installer: Optional[_InstallerType] = ...) -> Any: ...
def require(self, env: Optional[Environment] = ..., installer: Optional[_InstallerType] = ...) -> None: ...
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: ...
def find_distributions(path_item: str, only: bool = ...) -> Generator[Distribution, None, None]: ...
def get_distribution(dist: Union[Requirement, str, Distribution]) -> Distribution: ...
def get_distribution(dist: Requirement | str | Distribution) -> Distribution: ...
class Distribution(IResourceProvider, IMetadataProvider):
PKG_INFO: str
@@ -129,31 +125,31 @@ class Distribution(IResourceProvider, IMetadataProvider):
version: str
parsed_version: Tuple[str, ...]
py_version: str
platform: Optional[str]
platform: str | None
precedence: int
def __init__(
self,
location: Optional[str] = ...,
location: str | None = ...,
metadata: _MetadataType = ...,
project_name: Optional[str] = ...,
version: Optional[str] = ...,
project_name: str | None = ...,
version: str | None = ...,
py_version: str = ...,
platform: Optional[str] = ...,
platform: str | None = ...,
precedence: int = ...,
) -> None: ...
@classmethod
def from_location(
cls, location: str, basename: str, metadata: _MetadataType = ..., **kw: Union[str, None, int]
cls, location: str, basename: str, metadata: _MetadataType = ..., **kw: str | None | int
) -> Distribution: ...
@classmethod
def from_filename(cls, filename: str, metadata: _MetadataType = ..., **kw: Union[str, None, int]) -> Distribution: ...
def activate(self, path: Optional[List[str]] = ...) -> None: ...
def from_filename(cls, filename: str, metadata: _MetadataType = ..., **kw: str | None | int) -> Distribution: ...
def activate(self, path: List[str] | None = ...) -> None: ...
def as_requirement(self) -> Requirement: ...
def requires(self, extras: Tuple[str, ...] = ...) -> List[Requirement]: ...
def clone(self, **kw: Union[str, int, None]) -> 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) -> Optional[EntryPoint]: ...
def get_entry_info(self, group: str, name: str) -> EntryPoint | None: ...
@overload
def get_entry_map(self) -> Dict[str, Dict[str, EntryPoint]]: ...
@overload
@@ -218,11 +214,11 @@ class VersionConflict(ResolutionError):
@property
def req(self) -> Any: ...
def report(self) -> str: ...
def with_context(self, required_by: Set[Union[Distribution, str]]) -> VersionConflict: ...
def with_context(self, required_by: Set[Distribution | str]) -> VersionConflict: ...
class ContextualVersionConflict(VersionConflict):
@property
def required_by(self) -> Set[Union[Distribution, str]]: ...
def required_by(self) -> Set[Distribution | str]: ...
class UnknownExtra(ResolutionError): ...
@@ -257,9 +253,9 @@ empty_provider: EmptyProvider
class FileMetadata(EmptyProvider, IResourceProvider):
def __init__(self, path_to_pkg_info: str) -> None: ...
def parse_version(v: str) -> Union[Version, LegacyVersion]: ...
def parse_version(v: str) -> Version | LegacyVersion: ...
def yield_lines(strs: _NestedStr) -> Generator[str, None, None]: ...
def split_sections(strs: _NestedStr) -> Generator[Tuple[Optional[str], str], None, None]: ...
def split_sections(strs: _NestedStr) -> Generator[Tuple[str | None, str], None, None]: ...
def safe_name(name: str) -> str: ...
def safe_version(version: str) -> str: ...
def safe_extra(extra: str) -> str: ...
@@ -267,7 +263,7 @@ def to_filename(name_or_version: str) -> str: ...
def get_build_platform() -> str: ...
def get_platform() -> str: ...
def get_supported_platform() -> str: ...
def compatible_platforms(provided: Optional[str], required: Optional[str]) -> bool: ...
def compatible_platforms(provided: str | None, required: str | None) -> bool: ...
def get_default_cache() -> str: ...
def get_importer(path_item: str) -> _Importer: ...
def ensure_directory(path: str) -> None: ...