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

@@ -1,7 +1,7 @@
import os
import sys
from _typeshed import StrPath, SupportsRead, SupportsWrite
from typing import Any, AnyStr, Callable, Iterable, List, NamedTuple, Optional, Sequence, Set, Tuple, TypeVar, Union, overload
from typing import Any, AnyStr, Callable, Iterable, List, NamedTuple, Sequence, Set, Tuple, TypeVar, Union, overload
_PathT = TypeVar("_PathT", str, os.PathLike[str])
# Return value of some functions that may either return a path-like object that was passed in or
@@ -28,7 +28,7 @@ if sys.version_info >= (3, 8):
src: StrPath,
dst: StrPath,
symlinks: bool = ...,
ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[StrPath, List[str]], Iterable[str]]] = ...,
ignore: None | Callable[[str, List[str]], Iterable[str]] | Callable[[StrPath, List[str]], Iterable[str]] = ...,
copy_function: Callable[[str, str], None] = ...,
ignore_dangling_symlinks: bool = ...,
dirs_exist_ok: bool = ...,
@@ -39,14 +39,12 @@ else:
src: StrPath,
dst: StrPath,
symlinks: bool = ...,
ignore: Union[None, Callable[[str, List[str]], Iterable[str]], Callable[[StrPath, List[str]], Iterable[str]]] = ...,
ignore: None | Callable[[str, List[str]], Iterable[str]] | Callable[[StrPath, List[str]], Iterable[str]] = ...,
copy_function: Callable[[str, str], None] = ...,
ignore_dangling_symlinks: bool = ...,
) -> _PathReturn: ...
def rmtree(
path: Union[bytes, StrPath], ignore_errors: bool = ..., onerror: Optional[Callable[[Any, Any, Any], Any]] = ...
) -> None: ...
def rmtree(path: bytes | StrPath, ignore_errors: bool = ..., onerror: Callable[[Any, Any, Any], Any] | None = ...) -> None: ...
_CopyFn = Union[Callable[[str, str], None], Callable[[StrPath, StrPath], None]]
@@ -63,46 +61,46 @@ class _ntuple_diskusage(NamedTuple):
free: int
def disk_usage(path: StrPath) -> _ntuple_diskusage: ...
def chown(path: StrPath, user: Optional[Union[str, int]] = ..., group: Optional[Union[str, int]] = ...) -> None: ...
def chown(path: StrPath, user: str | int | None = ..., group: str | int | None = ...) -> None: ...
if sys.version_info >= (3, 8):
@overload
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
def which(cmd: StrPath, mode: int = ..., path: StrPath | None = ...) -> str | None: ...
@overload
def which(cmd: bytes, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[bytes]: ...
def which(cmd: bytes, mode: int = ..., path: StrPath | None = ...) -> bytes | None: ...
else:
def which(cmd: StrPath, mode: int = ..., path: Optional[StrPath] = ...) -> Optional[str]: ...
def which(cmd: StrPath, mode: int = ..., path: StrPath | None = ...) -> str | None: ...
def make_archive(
base_name: str,
format: str,
root_dir: Optional[StrPath] = ...,
base_dir: Optional[StrPath] = ...,
root_dir: StrPath | None = ...,
base_dir: StrPath | None = ...,
verbose: bool = ...,
dry_run: bool = ...,
owner: Optional[str] = ...,
group: Optional[str] = ...,
logger: Optional[Any] = ...,
owner: str | None = ...,
group: str | None = ...,
logger: Any | None = ...,
) -> str: ...
def get_archive_formats() -> List[Tuple[str, str]]: ...
def register_archive_format(
name: str,
function: Callable[..., Any],
extra_args: Optional[Sequence[Union[Tuple[str, Any], List[Any]]]] = ...,
extra_args: Sequence[Tuple[str, Any] | List[Any]] | None = ...,
description: str = ...,
) -> None: ...
def unregister_archive_format(name: str) -> None: ...
if sys.version_info >= (3, 7):
def unpack_archive(filename: StrPath, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
def unpack_archive(filename: StrPath, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ...
else:
# See http://bugs.python.org/issue30218
def unpack_archive(filename: str, extract_dir: Optional[StrPath] = ..., format: Optional[str] = ...) -> None: ...
def unpack_archive(filename: str, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ...
def register_unpack_format(
name: str, extensions: List[str], function: Any, extra_args: Optional[Sequence[Tuple[str, Any]]] = ..., description: str = ...
name: str, extensions: List[str], function: Any, extra_args: Sequence[Tuple[str, Any]] | None = ..., description: str = ...
) -> None: ...
def unregister_unpack_format(name: str) -> None: ...
def get_unpack_formats() -> List[Tuple[str, List[str], str]]: ...