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

@@ -42,7 +42,6 @@ from typing import (
MutableSequence,
MutableSet,
NoReturn,
Optional,
Protocol,
Reversible,
Sequence,
@@ -84,9 +83,9 @@ _TT = TypeVar("_TT", bound="type")
_TBE = TypeVar("_TBE", bound="BaseException")
class object:
__doc__: Optional[str]
__doc__: str | None
__dict__: Dict[str, Any]
__slots__: Union[str, Iterable[str]]
__slots__: str | Iterable[str]
__module__: str
__annotations__: Dict[str, Any]
@property
@@ -106,7 +105,7 @@ class object:
def __getattribute__(self, name: str) -> Any: ...
def __delattr__(self, name: str) -> None: ...
def __sizeof__(self) -> int: ...
def __reduce__(self) -> Union[str, Tuple[Any, ...]]: ...
def __reduce__(self) -> str | Tuple[Any, ...]: ...
if sys.version_info >= (3, 8):
def __reduce_ex__(self, protocol: SupportsIndex) -> str | Tuple[Any, ...]: ...
else:
@@ -119,14 +118,14 @@ class staticmethod(object): # Special, only valid as a decorator.
__isabstractmethod__: bool
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
class classmethod(object): # Special, only valid as a decorator.
__func__: Callable[..., Any]
__isabstractmethod__: bool
def __init__(self, f: Callable[..., Any]) -> None: ...
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
def __get__(self, obj: _T, type: Optional[Type[_T]] = ...) -> Callable[..., Any]: ...
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
class type(object):
__base__: type
@@ -140,7 +139,7 @@ class type(object):
__mro__: Tuple[type, ...]
__name__: str
__qualname__: str
__text_signature__: Optional[str]
__text_signature__: str | None
__weakrefoffset__: int
@overload
def __init__(self, o: object) -> None: ...
@@ -173,9 +172,9 @@ class super(object):
class int:
@overload
def __new__(cls: Type[_T], x: Union[str, bytes, SupportsInt, SupportsIndex, _SupportsTrunc] = ...) -> _T: ...
def __new__(cls: Type[_T], x: str | bytes | SupportsInt | SupportsIndex | _SupportsTrunc = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], x: Union[str, bytes, bytearray], base: SupportsIndex) -> _T: ...
def __new__(cls: Type[_T], x: str | bytes | bytearray, base: SupportsIndex) -> _T: ...
if sys.version_info >= (3, 8):
def as_integer_ratio(self) -> Tuple[int, Literal[1]]: ...
@property
@@ -210,10 +209,10 @@ class int:
def __rmod__(self, x: int) -> int: ...
def __rdivmod__(self, x: int) -> Tuple[int, int]: ...
@overload
def __pow__(self, __x: Literal[2], __modulo: Optional[int] = ...) -> int: ...
def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ...
@overload
def __pow__(self, __x: int, __modulo: Optional[int] = ...) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int, mod: Optional[int] = ...) -> Any: ...
def __pow__(self, __x: int, __modulo: int | None = ...) -> Any: ... # Return type can be int or float, depending on x.
def __rpow__(self, x: int, mod: int | None = ...) -> Any: ...
def __and__(self, n: int) -> int: ...
def __or__(self, n: int) -> int: ...
def __xor__(self, n: int) -> int: ...
@@ -247,7 +246,7 @@ class int:
def __index__(self) -> int: ...
class float:
def __new__(cls: Type[_T], x: Union[SupportsFloat, SupportsIndex, str, bytes, bytearray] = ...) -> _T: ...
def __new__(cls: Type[_T], x: SupportsFloat | SupportsIndex | str | bytes | bytearray = ...) -> _T: ...
def as_integer_ratio(self) -> Tuple[int, int]: ...
def hex(self) -> str: ...
def is_integer(self) -> bool: ...
@@ -304,7 +303,7 @@ class complex:
@overload
def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ...
@overload
def __new__(cls: Type[_T], real: Union[str, SupportsComplex, SupportsIndex, complex]) -> _T: ...
def __new__(cls: Type[_T], real: str | SupportsComplex | SupportsIndex | complex) -> _T: ...
@property
def real(self) -> float: ...
@property
@@ -340,19 +339,19 @@ class str(Sequence[str]):
def capitalize(self) -> str: ...
def casefold(self) -> str: ...
def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
def count(self, x: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ...
def endswith(
self, __suffix: Union[str, Tuple[str, ...]], __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...
self, __suffix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> str: ...
else:
def expandtabs(self, tabsize: int = ...) -> str: ...
def find(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def find(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def format(self, *args: object, **kwargs: object) -> str: ...
def format_map(self, map: _FormatMapMapping) -> str: ...
def index(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def isalnum(self) -> bool: ...
def isalpha(self) -> bool: ...
if sys.version_info >= (3, 7):
@@ -369,41 +368,41 @@ class str(Sequence[str]):
def join(self, __iterable: Iterable[str]) -> str: ...
def ljust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
def lower(self) -> str: ...
def lstrip(self, __chars: Optional[str] = ...) -> str: ...
def lstrip(self, __chars: str | None = ...) -> str: ...
def partition(self, __sep: str) -> Tuple[str, str, str]: ...
def replace(self, __old: str, __new: str, __count: SupportsIndex = ...) -> str: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: str) -> str: ...
def removesuffix(self, __suffix: str) -> str: ...
def rfind(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def rindex(self, __sub: str, __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...) -> int: ...
def rfind(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
def rpartition(self, __sep: str) -> Tuple[str, str, str]: ...
def rsplit(self, sep: Optional[str] = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def rstrip(self, __chars: Optional[str] = ...) -> str: ...
def split(self, sep: Optional[str] = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def rstrip(self, __chars: str | None = ...) -> str: ...
def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
def splitlines(self, keepends: bool = ...) -> List[str]: ...
def startswith(
self, __prefix: Union[str, Tuple[str, ...]], __start: Optional[SupportsIndex] = ..., __end: Optional[SupportsIndex] = ...
self, __prefix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
def strip(self, __chars: Optional[str] = ...) -> str: ...
def strip(self, __chars: str | None = ...) -> str: ...
def swapcase(self) -> str: ...
def title(self) -> str: ...
def translate(self, __table: Union[Mapping[int, Union[int, str, None]], Sequence[Union[int, str, None]]]) -> str: ...
def translate(self, __table: Mapping[int, int | str | None] | Sequence[int | str | None]) -> str: ...
def upper(self) -> str: ...
def zfill(self, __width: SupportsIndex) -> str: ...
@staticmethod
@overload
def maketrans(__x: Union[Dict[int, _T], Dict[str, _T], Dict[Union[str, int], _T]]) -> Dict[int, _T]: ...
def maketrans(__x: Dict[int, _T] | Dict[str, _T] | Dict[str | int, _T]) -> Dict[int, _T]: ...
@staticmethod
@overload
def maketrans(__x: str, __y: str, __z: Optional[str] = ...) -> Dict[int, Union[int, None]]: ...
def maketrans(__x: str, __y: str, __z: str | None = ...) -> Dict[int, int | None]: ...
def __add__(self, s: str) -> str: ...
# Incompatible with Sequence.__contains__
def __contains__(self, o: str) -> bool: ... # type: ignore
def __eq__(self, x: object) -> bool: ...
def __ge__(self, x: str) -> bool: ...
def __getitem__(self, i: Union[int, slice]) -> str: ...
def __getitem__(self, i: int | slice) -> str: ...
def __gt__(self, x: str) -> bool: ...
def __hash__(self) -> int: ...
def __iter__(self) -> Iterator[str]: ...
@@ -436,10 +435,7 @@ class bytes(ByteString):
) -> int: ...
def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
def endswith(
self,
__suffix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __suffix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> bytes: ...
@@ -449,7 +445,7 @@ class bytes(ByteString):
self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
if sys.version_info >= (3, 8):
def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
def index(
@@ -464,10 +460,10 @@ class bytes(ByteString):
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytes: ...
def join(self, __iterable_of_bytes: Iterable[ByteString | memoryview]) -> bytes: ...
def ljust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
def lower(self) -> bytes: ...
def lstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def lstrip(self, __bytes: bytes | None = ...) -> bytes: ...
def partition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def replace(self, __old: bytes, __new: bytes, __count: SupportsIndex = ...) -> bytes: ...
if sys.version_info >= (3, 9):
@@ -481,20 +477,17 @@ class bytes(ByteString):
) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
def rpartition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def rstrip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def split(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def rstrip(self, __bytes: bytes | None = ...) -> bytes: ...
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
def splitlines(self, keepends: bool = ...) -> List[bytes]: ...
def startswith(
self,
__prefix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytes: ...
def strip(self, __bytes: bytes | None = ...) -> bytes: ...
def swapcase(self) -> bytes: ...
def title(self) -> bytes: ...
def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytes: ...
def translate(self, __table: bytes | None, delete: bytes = ...) -> bytes: ...
def upper(self) -> bytes: ...
def zfill(self, __width: SupportsIndex) -> bytes: ...
@classmethod
@@ -542,10 +535,7 @@ class bytearray(MutableSequence[int], ByteString):
def copy(self) -> bytearray: ...
def decode(self, encoding: str = ..., errors: str = ...) -> str: ...
def endswith(
self,
__suffix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __suffix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
if sys.version_info >= (3, 8):
def expandtabs(self, tabsize: SupportsIndex = ...) -> bytearray: ...
@@ -556,7 +546,7 @@ class bytearray(MutableSequence[int], ByteString):
self, __sub: bytes | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> int: ...
if sys.version_info >= (3, 8):
def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
def index(
@@ -572,10 +562,10 @@ class bytearray(MutableSequence[int], ByteString):
def isspace(self) -> bool: ...
def istitle(self) -> bool: ...
def isupper(self) -> bool: ...
def join(self, __iterable_of_bytes: Iterable[Union[ByteString, memoryview]]) -> bytearray: ...
def join(self, __iterable_of_bytes: Iterable[ByteString | memoryview]) -> bytearray: ...
def ljust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ...
def lower(self) -> bytearray: ...
def lstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def lstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
def partition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
if sys.version_info >= (3, 9):
def removeprefix(self, __prefix: bytes) -> bytearray: ...
@@ -589,20 +579,17 @@ class bytearray(MutableSequence[int], ByteString):
) -> int: ...
def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ...
def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
def rsplit(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def split(self, sep: Optional[bytes] = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
def startswith(
self,
__prefix: Union[bytes, Tuple[bytes, ...]],
__start: Optional[SupportsIndex] = ...,
__end: Optional[SupportsIndex] = ...,
self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
) -> bool: ...
def strip(self, __bytes: Optional[bytes] = ...) -> bytearray: ...
def strip(self, __bytes: bytes | None = ...) -> bytearray: ...
def swapcase(self) -> bytearray: ...
def title(self) -> bytearray: ...
def translate(self, __table: Optional[bytes], delete: bytes = ...) -> bytearray: ...
def translate(self, __table: bytes | None, delete: bytes = ...) -> bytearray: ...
def upper(self) -> bytearray: ...
def zfill(self, __width: SupportsIndex) -> bytearray: ...
@classmethod
@@ -641,13 +628,13 @@ class bytearray(MutableSequence[int], ByteString):
class memoryview(Sized, Sequence[int]):
format: str
itemsize: int
shape: Optional[Tuple[int, ...]]
strides: Optional[Tuple[int, ...]]
suboffsets: Optional[Tuple[int, ...]]
shape: Tuple[int, ...] | None
strides: Tuple[int, ...] | None
suboffsets: Tuple[int, ...] | None
readonly: bool
ndim: int
obj: Union[bytes, bytearray]
obj: bytes | bytearray
c_contiguous: bool
f_contiguous: bool
contiguous: bool
@@ -655,9 +642,9 @@ class memoryview(Sized, Sequence[int]):
def __init__(self, obj: ReadableBuffer) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: Optional[Type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def cast(self, format: str, shape: Union[List[int], Tuple[int]] = ...) -> memoryview: ...
def cast(self, format: str, shape: List[int] | Tuple[int] = ...) -> memoryview: ...
@overload
def __getitem__(self, i: SupportsIndex) -> int: ...
@overload
@@ -670,7 +657,7 @@ class memoryview(Sized, Sequence[int]):
@overload
def __setitem__(self, i: SupportsIndex, o: SupportsIndex) -> None: ...
if sys.version_info >= (3, 8):
def tobytes(self, order: Optional[Literal["C", "F", "A"]] = ...) -> bytes: ...
def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ...
else:
def tobytes(self) -> bytes: ...
def tolist(self) -> List[int]: ...
@@ -678,7 +665,7 @@ class memoryview(Sized, Sequence[int]):
def toreadonly(self) -> memoryview: ...
def release(self) -> None: ...
if sys.version_info >= (3, 8):
def hex(self, sep: Union[str, bytes] = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
def hex(self, sep: str | bytes = ..., bytes_per_sep: SupportsIndex = ...) -> str: ...
else:
def hex(self) -> str: ...
@@ -738,7 +725,7 @@ class tuple(Sequence[_T_co], Generic[_T_co]):
@overload
def __add__(self, x: Tuple[_T_co, ...]) -> Tuple[_T_co, ...]: ...
@overload
def __add__(self, x: Tuple[_T, ...]) -> Tuple[Union[_T_co, _T], ...]: ...
def __add__(self, x: Tuple[_T, ...]) -> Tuple[_T_co | _T, ...]: ...
def __mul__(self, n: SupportsIndex) -> Tuple[_T_co, ...]: ...
def __rmul__(self, n: SupportsIndex) -> Tuple[_T_co, ...]: ...
def count(self, __value: Any) -> int: ...
@@ -785,7 +772,7 @@ class list(MutableSequence[_T], Generic[_T]):
def __setitem__(self, i: SupportsIndex, o: _T) -> None: ...
@overload
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __delitem__(self, i: Union[SupportsIndex, slice]) -> None: ...
def __delitem__(self, i: SupportsIndex | slice) -> None: ...
def __add__(self, x: List[_T]) -> List[_T]: ...
def __iadd__(self: _S, x: Iterable[_T]) -> _S: ...
def __mul__(self, n: SupportsIndex) -> List[_T]: ...
@@ -825,7 +812,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def items(self) -> ItemsView[_KT, _VT]: ...
@classmethod
@overload
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Optional[Any]]: ...
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Any | None]: ...
@classmethod
@overload
def fromkeys(cls, __iterable: Iterable[_T], __value: _S) -> dict[_T, _S]: ...
@@ -840,8 +827,8 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
__hash__: None # type: ignore
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
def __or__(self, __value: Mapping[_T1, _T2]) -> Dict[Union[_KT, _T1], Union[_VT, _T2]]: ...
def __ror__(self, __value: Mapping[_T1, _T2]) -> Dict[Union[_KT, _T1], Union[_VT, _T2]]: ...
def __or__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ...
def __ror__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ...
def __ior__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ... # type: ignore
class set(MutableSet[_T], Generic[_T]):
@@ -869,12 +856,12 @@ class set(MutableSet[_T], Generic[_T]):
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[object]) -> Set[_T]: ...
def __iand__(self, s: AbstractSet[object]) -> Set[_T]: ...
def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __sub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
def __isub__(self, s: AbstractSet[Optional[_T]]) -> Set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
def __or__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __ior__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __sub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ...
def __isub__(self, s: AbstractSet[_T | None]) -> Set[_T]: ...
def __xor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __ixor__(self, s: AbstractSet[_S]) -> Set[_T | _S]: ...
def __le__(self, s: AbstractSet[object]) -> bool: ...
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
@@ -898,9 +885,9 @@ class frozenset(AbstractSet[_T_co], Generic[_T_co]):
def __iter__(self) -> Iterator[_T_co]: ...
def __str__(self) -> str: ...
def __and__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
def __or__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
def __sub__(self, s: AbstractSet[_T_co]) -> FrozenSet[_T_co]: ...
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[Union[_T_co, _S]]: ...
def __xor__(self, s: AbstractSet[_S]) -> FrozenSet[_T_co | _S]: ...
def __le__(self, s: AbstractSet[object]) -> bool: ...
def __lt__(self, s: AbstractSet[object]) -> bool: ...
def __ge__(self, s: AbstractSet[object]) -> bool: ...
@@ -936,20 +923,20 @@ class range(Sequence[int]):
def __reversed__(self) -> Iterator[int]: ...
class property(object):
fget: Optional[Callable[[Any], Any]]
fset: Optional[Callable[[Any, Any], None]]
fdel: Optional[Callable[[Any], None]]
fget: Callable[[Any], Any] | None
fset: Callable[[Any, Any], None] | None
fdel: Callable[[Any], None] | None
def __init__(
self,
fget: Optional[Callable[[Any], Any]] = ...,
fset: Optional[Callable[[Any, Any], None]] = ...,
fdel: Optional[Callable[[Any], None]] = ...,
doc: Optional[str] = ...,
fget: Callable[[Any], Any] | None = ...,
fset: Callable[[Any, Any], None] | None = ...,
fdel: Callable[[Any], None] | None = ...,
doc: str | None = ...,
) -> None: ...
def getter(self, fget: Callable[[Any], Any]) -> property: ...
def setter(self, fset: Callable[[Any, Any], None]) -> property: ...
def deleter(self, fdel: Callable[[Any], None]) -> property: ...
def __get__(self, obj: Any, type: Optional[type] = ...) -> Any: ...
def __get__(self, obj: Any, type: type | None = ...) -> Any: ...
def __set__(self, obj: Any, value: Any) -> None: ...
def __delete__(self, obj: Any) -> None: ...
@@ -964,7 +951,7 @@ def abs(__x: SupportsAbs[_T]) -> _T: ...
def all(__iterable: Iterable[object]) -> bool: ...
def any(__iterable: Iterable[object]) -> bool: ...
def ascii(__obj: object) -> str: ...
def bin(__number: Union[int, SupportsIndex]) -> str: ...
def bin(__number: int | SupportsIndex) -> str: ...
if sys.version_info >= (3, 7):
def breakpoint(*args: Any, **kws: Any) -> None: ...
@@ -984,12 +971,12 @@ if sys.version_info >= (3, 10):
@overload
async def anext(__i: AsyncIterator[_T]) -> _T: ...
@overload
async def anext(__i: AsyncIterator[_T], default: _VT) -> Union[_T, _VT]: ...
async def anext(__i: AsyncIterator[_T], default: _VT) -> _T | _VT: ...
if sys.version_info >= (3, 8):
def compile(
source: Union[str, bytes, mod, AST],
filename: Union[str, bytes, _PathLike[Any]],
source: str | bytes | mod | AST,
filename: str | bytes | _PathLike[Any],
mode: str,
flags: int = ...,
dont_inherit: int = ...,
@@ -1000,8 +987,8 @@ if sys.version_info >= (3, 8):
else:
def compile(
source: Union[str, bytes, mod, AST],
filename: Union[str, bytes, _PathLike[Any]],
source: str | bytes | mod | AST,
filename: str | bytes | _PathLike[Any],
mode: str,
flags: int = ...,
dont_inherit: int = ...,
@@ -1017,16 +1004,16 @@ def divmod(__x: SupportsDivMod[_T_contra, _T_co], __y: _T_contra) -> _T_co: ...
@overload
def divmod(__x: _T_contra, __y: SupportsRDivMod[_T_contra, _T_co]) -> _T_co: ...
def eval(
__source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
__source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
) -> Any: ...
def exec(
__source: Union[str, bytes, CodeType], __globals: Optional[Dict[str, Any]] = ..., __locals: Optional[Mapping[str, Any]] = ...
__source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
) -> Any: ...
def exit(code: object = ...) -> NoReturn: ...
class filter(Iterator[_T], Generic[_T]):
@overload
def __init__(self, __function: None, __iterable: Iterable[Optional[_T]]) -> None: ...
def __init__(self, __function: None, __iterable: Iterable[_T | None]) -> None: ...
@overload
def __init__(self, __function: Callable[[_T], Any], __iterable: Iterable[_T]) -> None: ...
def __iter__(self) -> Iterator[_T]: ...
@@ -1039,36 +1026,36 @@ def getattr(__o: object, name: str) -> Any: ...
# While technically covered by the last overload, spelling out the types for None and bool
# help mypy out in some tricky situations involving type context (aka bidirectional inference)
@overload
def getattr(__o: object, name: str, __default: None) -> Optional[Any]: ...
def getattr(__o: object, name: str, __default: None) -> Any | None: ...
@overload
def getattr(__o: object, name: str, __default: bool) -> Union[Any, bool]: ...
def getattr(__o: object, name: str, __default: bool) -> Any | bool: ...
@overload
def getattr(__o: object, name: str, __default: _T) -> Union[Any, _T]: ...
def getattr(__o: object, name: str, __default: _T) -> Any | _T: ...
def globals() -> Dict[str, Any]: ...
def hasattr(__obj: object, __name: str) -> bool: ...
def hash(__obj: object) -> int: ...
def help(*args: Any, **kwds: Any) -> None: ...
def hex(__number: Union[int, SupportsIndex]) -> str: ...
def hex(__number: int | SupportsIndex) -> str: ...
def id(__obj: object) -> int: ...
def input(__prompt: Any = ...) -> str: ...
@overload
def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], Optional[_T]], __sentinel: None) -> Iterator[_T]: ...
def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ...
@overload
def iter(__function: Callable[[], _T], __sentinel: Any) -> Iterator[_T]: ...
if sys.version_info >= (3, 10):
def isinstance(
__obj: object, __class_or_tuple: Union[type, types.UnionType, Tuple[Union[type, types.UnionType, Tuple[Any, ...]], ...]]
__obj: object, __class_or_tuple: type | types.UnionType | Tuple[type | types.UnionType | Tuple[Any, ...], ...]
) -> bool: ...
def issubclass(
__cls: type, __class_or_tuple: Union[type, types.UnionType, Tuple[Union[type, types.UnionType, Tuple[Any, ...]], ...]]
__cls: type, __class_or_tuple: type | types.UnionType | Tuple[type | types.UnionType | Tuple[Any, ...], ...]
) -> bool: ...
else:
def isinstance(__obj: object, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def issubclass(__cls: type, __class_or_tuple: Union[type, Tuple[Union[type, Tuple[Any, ...]], ...]]) -> bool: ...
def isinstance(__obj: object, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ...
def issubclass(__cls: type, __class_or_tuple: type | Tuple[type | Tuple[Any, ...], ...]) -> bool: ...
def len(__obj: Sized) -> int: ...
def license() -> None: ...
@@ -1128,9 +1115,9 @@ def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> Supports
@overload
def max(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan]) -> _T: ...
@overload
def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...
def max(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> SupportsLessThanT | _T: ...
@overload
def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> Union[_T1, _T2]: ...
def max(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> _T1 | _T2: ...
@overload
def min(
__arg1: SupportsLessThanT, __arg2: SupportsLessThanT, *_args: SupportsLessThanT, key: None = ...
@@ -1142,14 +1129,14 @@ def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ...) -> Supports
@overload
def min(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan]) -> _T: ...
@overload
def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> Union[SupportsLessThanT, _T]: ...
def min(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., default: _T) -> SupportsLessThanT | _T: ...
@overload
def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> Union[_T1, _T2]: ...
def min(__iterable: Iterable[_T1], *, key: Callable[[_T1], SupportsLessThan], default: _T2) -> _T1 | _T2: ...
@overload
def next(__i: Iterator[_T]) -> _T: ...
@overload
def next(__i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
def oct(__number: Union[int, SupportsIndex]) -> str: ...
def next(__i: Iterator[_T], default: _VT) -> _T | _VT: ...
def oct(__number: int | SupportsIndex) -> str: ...
_OpenFile = Union[StrOrBytesPath, int]
_Opener = Callable[[str, int], int]
@@ -1160,11 +1147,11 @@ def open(
file: _OpenFile,
mode: OpenTextMode = ...,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> TextIOWrapper: ...
# Unbuffered binary mode: returns a FileIO
@@ -1177,7 +1164,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> FileIO: ...
# Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter
@@ -1190,7 +1177,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BufferedRandom: ...
@overload
def open(
@@ -1201,7 +1188,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BufferedWriter: ...
@overload
def open(
@@ -1212,7 +1199,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BufferedReader: ...
# Buffering cannot be determined: fall back to BinaryIO
@@ -1225,7 +1212,7 @@ def open(
errors: None = ...,
newline: None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> BinaryIO: ...
# Fallback if mode is not specified
@@ -1234,19 +1221,15 @@ def open(
file: _OpenFile,
mode: str,
buffering: int = ...,
encoding: Optional[str] = ...,
errors: Optional[str] = ...,
newline: Optional[str] = ...,
encoding: str | None = ...,
errors: str | None = ...,
newline: str | None = ...,
closefd: bool = ...,
opener: Optional[_Opener] = ...,
opener: _Opener | None = ...,
) -> IO[Any]: ...
def ord(__c: Union[str, bytes]) -> int: ...
def ord(__c: str | bytes) -> int: ...
def print(
*values: object,
sep: Optional[str] = ...,
end: Optional[str] = ...,
file: Optional[SupportsWrite[str]] = ...,
flush: bool = ...,
*values: object, sep: str | None = ..., end: str | None = ..., file: SupportsWrite[str] | None = ..., flush: bool = ...
) -> None: ...
_E = TypeVar("_E", contravariant=True)
@@ -1309,15 +1292,15 @@ def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], r
if sys.version_info >= (3, 8):
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
def sum(__iterable: Iterable[_T]) -> _T | int: ...
@overload
def sum(__iterable: Iterable[_T], start: _S) -> Union[_T, _S]: ...
def sum(__iterable: Iterable[_T], start: _S) -> _T | _S: ...
else:
@overload
def sum(__iterable: Iterable[_T]) -> Union[_T, int]: ...
def sum(__iterable: Iterable[_T]) -> _T | int: ...
@overload
def sum(__iterable: Iterable[_T], __start: _S) -> Union[_T, _S]: ...
def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ...
def vars(__object: Any = ...) -> Dict[str, Any]: ...
@@ -1357,8 +1340,8 @@ class zip(Iterator[_T_co], Generic[_T_co]):
def __import__(
name: str,
globals: Optional[Mapping[str, Any]] = ...,
locals: Optional[Mapping[str, Any]] = ...,
globals: Mapping[str, Any] | None = ...,
locals: Mapping[str, Any] | None = ...,
fromlist: Sequence[str] = ...,
level: int = ...,
) -> Any: ...
@@ -1371,14 +1354,14 @@ Ellipsis: ellipsis
class BaseException(object):
args: Tuple[Any, ...]
__cause__: Optional[BaseException]
__context__: Optional[BaseException]
__cause__: BaseException | None
__context__: BaseException | None
__suppress_context__: bool
__traceback__: Optional[TracebackType]
__traceback__: TracebackType | None
def __init__(self, *args: object) -> None: ...
def __str__(self) -> str: ...
def __repr__(self) -> str: ...
def with_traceback(self: _TBE, tb: Optional[TracebackType]) -> _TBE: ...
def with_traceback(self: _TBE, tb: TracebackType | None) -> _TBE: ...
class GeneratorExit(BaseException): ...
class KeyboardInterrupt(BaseException): ...
@@ -1396,7 +1379,7 @@ _StandardError = Exception
class OSError(Exception):
errno: int
strerror: str
# filename, filename2 are actually Union[str, bytes, None]
# filename, filename2 are actually str | bytes | None
filename: Any
filename2: Any
if sys.platform == "win32":
@@ -1419,9 +1402,9 @@ class BufferError(_StandardError): ...
class EOFError(_StandardError): ...
class ImportError(_StandardError):
def __init__(self, *args: object, name: Optional[str] = ..., path: Optional[str] = ...) -> None: ...
name: Optional[str]
path: Optional[str]
def __init__(self, *args: object, name: str | None = ..., path: str | None = ...) -> None: ...
name: str | None
path: str | None
msg: str # undocumented
class LookupError(_StandardError): ...
@@ -1439,13 +1422,13 @@ class StopAsyncIteration(Exception):
class SyntaxError(_StandardError):
msg: str
lineno: Optional[int]
offset: Optional[int]
text: Optional[str]
filename: Optional[str]
lineno: int | None
offset: int | None
text: str | None
filename: str | None
if sys.version_info >= (3, 10):
end_lineno: Optional[int]
end_offset: Optional[int]
end_lineno: int | None
end_offset: int | None
class SystemError(_StandardError): ...
class TypeError(_StandardError): ...