mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
committed by
Jelle Zijlstra
parent
e2cf7c1bcf
commit
693678b4c3
@@ -5,14 +5,13 @@ from abc import abstractmethod, ABCMeta
|
||||
from types import CodeType, FrameType, TracebackType
|
||||
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
|
||||
|
||||
# Definitions of special type checking related constructs. Their definition
|
||||
# Definitions of special type checking related constructs. Their definitions
|
||||
# are not used, so their value does not matter.
|
||||
|
||||
overload = object()
|
||||
Any = object()
|
||||
TypeVar = object()
|
||||
_promote = object()
|
||||
no_type_check = object()
|
||||
|
||||
class _SpecialForm:
|
||||
def __getitem__(self, typeargs: Any) -> Any: ...
|
||||
@@ -38,6 +37,22 @@ class GenericMeta(type): ...
|
||||
# distinguish the None type from the None value.
|
||||
NoReturn = Union[None]
|
||||
|
||||
# These type variables are used by the container types.
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
_KT = TypeVar('_KT') # Key type.
|
||||
_VT = TypeVar('_VT') # Value type.
|
||||
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
|
||||
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
|
||||
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
|
||||
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
|
||||
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
|
||||
_TC = TypeVar('_TC', bound=Type[object])
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
|
||||
no_type_check = object()
|
||||
def no_type_check_decorator(decorator: _C) -> _C: ...
|
||||
|
||||
# Type aliases and type constructors
|
||||
|
||||
class TypeAlias:
|
||||
@@ -64,19 +79,6 @@ AnyStr = TypeVar('AnyStr', str, bytes)
|
||||
|
||||
# Abstract base classes.
|
||||
|
||||
# These type variables are used by the container types.
|
||||
_T = TypeVar('_T')
|
||||
_S = TypeVar('_S')
|
||||
_KT = TypeVar('_KT') # Key type.
|
||||
_VT = TypeVar('_VT') # Value type.
|
||||
_T_co = TypeVar('_T_co', covariant=True) # Any type covariant containers.
|
||||
_V_co = TypeVar('_V_co', covariant=True) # Any type covariant containers.
|
||||
_KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers.
|
||||
_VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers.
|
||||
_T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant.
|
||||
_TC = TypeVar('_TC', bound=Type[object])
|
||||
_C = TypeVar("_C", bound=Callable[..., Any])
|
||||
|
||||
def runtime_checkable(cls: _TC) -> _TC: ...
|
||||
|
||||
@runtime_checkable
|
||||
|
||||
Reference in New Issue
Block a user