Use _typeshed.Self in Python 2, too (#6932)

This commit is contained in:
Alex Waygood
2022-01-16 22:44:51 +00:00
committed by GitHub
parent 0949e9e90d
commit 6a88d5e7ae
29 changed files with 156 additions and 160 deletions

View File

@@ -1,5 +1,6 @@
import abc
import sys
from _typeshed import Self as TypeshedSelf # see #6932 for why the alias cannot have a leading underscore
from typing import (
TYPE_CHECKING as TYPE_CHECKING,
Any,
@@ -62,7 +63,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
__required_keys__: frozenset[str]
__optional_keys__: frozenset[str]
__total__: bool
def copy(self: _T) -> _T: ...
def copy(self: TypeshedSelf) -> TypeshedSelf: ...
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
# can go through.
def setdefault(self, k: NoReturn, default: object) -> object: ...