Add Self type var to _typeshed (#5677)

Cf. #5676
This commit is contained in:
Sebastian Rittau
2021-06-22 22:15:27 +02:00
committed by GitHub
parent 73b4c21cce
commit 816a92b8e8
2 changed files with 8 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ _T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_T_contra = TypeVar("_T_contra", contravariant=True)
# Use for "self" annotations:
# def __enter__(self: Self) -> Self: ...
Self = TypeVar("Self") # noqa Y001
class IdentityFunction(Protocol):
def __call__(self, __x: _T) -> _T: ...

View File

@@ -18,6 +18,10 @@ _T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True)
_T_contra = TypeVar("_T_contra", contravariant=True)
# Use for "self" annotations:
# def __enter__(self: Self) -> Self: ...
Self = TypeVar("Self") # noqa Y001
# stable
class IdentityFunction(Protocol):
def __call__(self, __x: _T) -> _T: ...