mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Use typing_extensions.Self in the stdlib (#9694)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import _typeshed
|
||||
import abc
|
||||
import collections
|
||||
import sys
|
||||
@@ -129,7 +128,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
__required_keys__: ClassVar[frozenset[str]]
|
||||
__optional_keys__: ClassVar[frozenset[str]]
|
||||
__total__: ClassVar[bool]
|
||||
def copy(self: _typeshed.Self) -> _typeshed.Self: ...
|
||||
def copy(self) -> Self: ...
|
||||
# Using Never so that only calls using mypy plugin hook that specialize the signature
|
||||
# can go through.
|
||||
def setdefault(self, k: Never, default: object) -> object: ...
|
||||
@@ -141,8 +140,8 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
def values(self) -> dict_values[str, object]: ...
|
||||
def __delitem__(self, k: Never) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __or__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ...
|
||||
def __ior__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ...
|
||||
def __or__(self, __value: Self) -> Self: ...
|
||||
def __ior__(self, __value: Self) -> Self: ...
|
||||
|
||||
# TypedDict is a (non-subscriptable) special form.
|
||||
TypedDict: object
|
||||
@@ -244,13 +243,13 @@ else:
|
||||
@overload
|
||||
def __init__(self, typename: str, fields: None = None, **kwargs: Any) -> None: ...
|
||||
@classmethod
|
||||
def _make(cls: type[_typeshed.Self], iterable: Iterable[Any]) -> _typeshed.Self: ...
|
||||
def _make(cls, iterable: Iterable[Any]) -> Self: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def _asdict(self) -> dict[str, Any]: ...
|
||||
else:
|
||||
def _asdict(self) -> collections.OrderedDict[str, Any]: ...
|
||||
|
||||
def _replace(self: _typeshed.Self, **kwargs: Any) -> _typeshed.Self: ...
|
||||
def _replace(self, **kwargs: Any) -> Self: ...
|
||||
|
||||
# New things in 3.xx
|
||||
# The `default` parameter was added to TypeVar, ParamSpec, and TypeVarTuple (PEP 696)
|
||||
|
||||
Reference in New Issue
Block a user