mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-20 08:38:26 +08:00
Use PEP 585 syntax wherever possible (#6717)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Any, Callable, Generic, Iterable, Mapping, Tuple, Type, TypeVar, overload
|
||||
from typing import Any, Callable, Generic, Iterable, Mapping, Type, TypeVar, overload
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
@@ -15,7 +15,7 @@ def asdict(obj: Any) -> dict[str, Any]: ...
|
||||
@overload
|
||||
def asdict(obj: Any, *, dict_factory: Callable[[list[tuple[str, Any]]], _T]) -> _T: ...
|
||||
@overload
|
||||
def astuple(obj: Any) -> Tuple[Any, ...]: ...
|
||||
def astuple(obj: Any) -> tuple[Any, ...]: ...
|
||||
@overload
|
||||
def astuple(obj: Any, *, tuple_factory: Callable[[list[Any]], _T]) -> _T: ...
|
||||
@overload
|
||||
@@ -66,7 +66,7 @@ def field(
|
||||
def field(
|
||||
*, 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 fields(class_or_instance: Any) -> tuple[Field[Any], ...]: ...
|
||||
def is_dataclass(obj: Any) -> bool: ...
|
||||
|
||||
class FrozenInstanceError(AttributeError): ...
|
||||
@@ -79,7 +79,7 @@ def make_dataclass(
|
||||
cls_name: str,
|
||||
fields: Iterable[str | tuple[str, type] | tuple[str, type, Field[Any]]],
|
||||
*,
|
||||
bases: Tuple[type, ...] = ...,
|
||||
bases: tuple[type, ...] = ...,
|
||||
namespace: dict[str, Any] | None = ...,
|
||||
init: bool = ...,
|
||||
repr: bool = ...,
|
||||
|
||||
Reference in New Issue
Block a user