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

@@ -9,14 +9,12 @@ from typing import (
Iterable,
Mapping,
NamedTuple,
Optional,
Sequence,
Set,
Sized,
Tuple,
Type,
TypeVar,
Union,
overload,
)
@@ -47,12 +45,12 @@ class _lru_cache_wrapper(Generic[_T]):
if sys.version_info >= (3, 8):
@overload
def lru_cache(maxsize: Optional[int] = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
def lru_cache(maxsize: int | None = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
@overload
def lru_cache(maxsize: Callable[..., _T], typed: bool = ...) -> _lru_cache_wrapper[_T]: ...
else:
def lru_cache(maxsize: Optional[int] = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
def lru_cache(maxsize: int | None = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ...
WRAPPER_ASSIGNMENTS: Sequence[str]
WRAPPER_UPDATES: Sequence[str]
@@ -75,7 +73,7 @@ class partial(Generic[_T]):
_Descriptor = Any
class partialmethod(Generic[_T]):
func: Union[Callable[..., _T], _Descriptor]
func: Callable[..., _T] | _Descriptor
args: Tuple[Any, ...]
keywords: Dict[str, Any]
@overload
@@ -121,12 +119,12 @@ if sys.version_info >= (3, 8):
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
class cached_property(Generic[_T]):
func: Callable[[Any], _T]
attrname: Optional[str]
attrname: str | None
def __init__(self, func: Callable[[Any], _T]) -> None: ...
@overload
def __get__(self, instance: None, owner: Optional[Type[Any]] = ...) -> cached_property[_T]: ...
def __get__(self, instance: None, owner: Type[Any] | None = ...) -> cached_property[_T]: ...
@overload
def __get__(self, instance: object, owner: Optional[Type[Any]] = ...) -> _T: ...
def __get__(self, instance: object, owner: Type[Any] | None = ...) -> _T: ...
def __set_name__(self, owner: Type[Any], name: str) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...