Use typing_extensions.Self instead of _typeshed.Self (#9702)

This commit is contained in:
Alex Waygood
2023-02-15 11:32:43 +01:00
committed by GitHub
parent 8cd6d81f15
commit 7180d0223b
140 changed files with 597 additions and 610 deletions

View File

@@ -1,10 +1,10 @@
import abc
import sys
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import IdentityFunction, Self
from _typeshed import IdentityFunction
from collections.abc import Mapping
from typing import Any, ClassVar, Generic, TypeVar, overload, type_check_only
from typing_extensions import Never
from typing_extensions import Never, Self
_T = TypeVar("_T")
_U = TypeVar("_U")
@@ -16,20 +16,20 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
__total__: ClassVar[bool]
# Unlike typing(_extensions).TypedDict,
# subclasses of mypy_extensions.TypedDict do NOT have the __required_keys__ and __optional_keys__ ClassVars
def copy(self: Self) -> 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: ...
# 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: Self, __m: Self) -> None: ...
def update(self, __m: Self) -> 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):
def __or__(self: Self, __other: Self) -> Self: ...
def __ior__(self: Self, __other: Self) -> Self: ...
def __or__(self, __other: Self) -> Self: ...
def __ior__(self, __other: Self) -> Self: ...
def TypedDict(typename: str, fields: dict[str, type[Any]], total: bool = ...) -> type[dict[str, Any]]: ...
@overload