mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Use PEP 570 syntax in stdlib (#11250)
This commit is contained in:
@@ -235,22 +235,22 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
def setdefault(self, k: Never, default: object) -> object: ...
|
||||
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
|
||||
def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
def update(self: _T, m: _T, /) -> None: ...
|
||||
def items(self) -> dict_items[str, object]: ...
|
||||
def keys(self) -> dict_keys[str, object]: ...
|
||||
def values(self) -> dict_values[str, object]: ...
|
||||
def __delitem__(self, k: Never) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@overload
|
||||
def __or__(self, __value: Self) -> Self: ...
|
||||
def __or__(self, value: Self, /) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, __value: dict[str, Any]) -> dict[str, object]: ...
|
||||
def __or__(self, value: dict[str, Any], /) -> dict[str, object]: ...
|
||||
@overload
|
||||
def __ror__(self, __value: Self) -> Self: ...
|
||||
def __ror__(self, value: Self, /) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, __value: dict[str, Any]) -> dict[str, object]: ...
|
||||
def __ror__(self, value: dict[str, Any], /) -> dict[str, object]: ...
|
||||
# supposedly incompatible definitions of `__ior__` and `__or__`:
|
||||
def __ior__(self, __value: Self) -> Self: ... # type: ignore[misc]
|
||||
def __ior__(self, value: Self, /) -> Self: ... # type: ignore[misc]
|
||||
|
||||
# TypedDict is a (non-subscriptable) special form.
|
||||
TypedDict: object
|
||||
@@ -335,9 +335,9 @@ if sys.version_info >= (3, 11):
|
||||
else:
|
||||
Self: _SpecialForm
|
||||
Never: _SpecialForm
|
||||
def reveal_type(__obj: _T) -> _T: ...
|
||||
def assert_never(__arg: Never) -> Never: ...
|
||||
def assert_type(__val: _T, __typ: Any) -> _T: ...
|
||||
def reveal_type(obj: _T, /) -> _T: ...
|
||||
def assert_never(arg: Never, /) -> Never: ...
|
||||
def assert_type(val: _T, typ: Any, /) -> _T: ...
|
||||
def clear_overloads() -> None: ...
|
||||
def get_overloads(func: Callable[..., object]) -> Sequence[Callable[..., object]]: ...
|
||||
|
||||
@@ -373,7 +373,7 @@ else:
|
||||
|
||||
class NewType:
|
||||
def __init__(self, name: str, tp: Any) -> None: ...
|
||||
def __call__(self, __obj: _T) -> _T: ...
|
||||
def __call__(self, obj: _T, /) -> _T: ...
|
||||
__supertype__: type
|
||||
if sys.version_info >= (3, 10):
|
||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||
@@ -456,16 +456,16 @@ class deprecated:
|
||||
message: str
|
||||
category: type[Warning] | None
|
||||
stacklevel: int
|
||||
def __init__(self, __message: str, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
|
||||
def __call__(self, __arg: _T) -> _T: ...
|
||||
def __init__(self, message: str, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
|
||||
def __call__(self, arg: _T, /) -> _T: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
from collections.abc import Buffer as Buffer
|
||||
from types import get_original_bases as get_original_bases
|
||||
from typing import TypeAliasType as TypeAliasType, override as override
|
||||
else:
|
||||
def override(__arg: _F) -> _F: ...
|
||||
def get_original_bases(__cls: type) -> tuple[Any, ...]: ...
|
||||
def override(arg: _F, /) -> _F: ...
|
||||
def get_original_bases(cls: type, /) -> tuple[Any, ...]: ...
|
||||
@final
|
||||
class TypeAliasType:
|
||||
def __init__(
|
||||
@@ -491,17 +491,17 @@ else:
|
||||
class Buffer(Protocol):
|
||||
# Not actually a Protocol at runtime; see
|
||||
# https://github.com/python/typeshed/issues/10224 for why we're defining it this way
|
||||
def __buffer__(self, __flags: int) -> memoryview: ...
|
||||
def __buffer__(self, flags: int, /) -> memoryview: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
from typing import get_protocol_members as get_protocol_members, is_protocol as is_protocol
|
||||
else:
|
||||
def is_protocol(__tp: type) -> bool: ...
|
||||
def get_protocol_members(__tp: type) -> frozenset[str]: ...
|
||||
def is_protocol(tp: type, /) -> bool: ...
|
||||
def get_protocol_members(tp: type, /) -> frozenset[str]: ...
|
||||
|
||||
class Doc:
|
||||
documentation: str
|
||||
def __init__(self, __documentation: str) -> None: ...
|
||||
def __init__(self, documentation: str, /) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
|
||||
Reference in New Issue
Block a user