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

This commit is contained in:
Akuli authored and GitHub committed 2021-08-08 11:05:21 +02:00
1 parent b9adb7a874
commit ee487304d7
578 files changed
+8080 -8966

No files matched your search

+9 -14
View File
@@ -1,5 +1,5 @@
import sys
from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Optional, Tuple, Type, TypeVar, Union, overload
from typing import Any, Callable, Dict, Generic, Iterable, List, Mapping, Tuple, Type, TypeVar, overload
if sys.version_info >= (3, 9):
from types import GenericAlias
@@ -33,7 +33,7 @@ class Field(Generic[_T]):
default: _T
default_factory: Callable[[], _T]
repr: bool
hash: Optional[bool]
hash: bool | None
init: bool
compare: bool
metadata: Mapping[str, Any]
@@ -48,9 +48,9 @@ def field(
default: _T,
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
) -> _T: ...
@overload
def field(
@@ -58,18 +58,13 @@ def field(
default_factory: Callable[[], _T],
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
hash: bool | None = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
metadata: Mapping[str, Any] | None = ...,
) -> _T: ...
@overload
def field(
*,
init: bool = ...,
repr: bool = ...,
hash: Optional[bool] = ...,
compare: bool = ...,
metadata: Optional[Mapping[str, Any]] = ...,
*, init: bool = ..., repr: bool = ..., hash: bool | None = ..., compare: bool = ..., metadata: Mapping[str, Any] | None = ...
) -> Any: ...
def fields(class_or_instance: Any) -> Tuple[Field[Any], ...]: ...
def is_dataclass(obj: Any) -> bool: ...
@@ -82,10 +77,10 @@ class InitVar(Generic[_T]):
def make_dataclass(
cls_name: str,
fields: Iterable[Union[str, Tuple[str, type], Tuple[str, type, Field[Any]]]],
fields: Iterable[str | Tuple[str, type] | Tuple[str, type, Field[Any]]],
*,
bases: Tuple[type, ...] = ...,
namespace: Optional[Dict[str, Any]] = ...,
namespace: Dict[str, Any] | None = ...,
init: bool = ...,
repr: bool = ...,
eq: bool = ...,