Skip to content

add no_type_check_decorator stub for #2884 #3460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions stdlib/2/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ overload = object()
Any = object()
TypeVar = object()
_promote = object()
no_type_check = object()

class _SpecialForm(object):
def __getitem__(self, typeargs: Any) -> object: ...
Expand All @@ -36,6 +35,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:
Expand All @@ -58,19 +73,6 @@ AnyStr = TypeVar('AnyStr', str, unicode)

# 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
Expand Down
32 changes: 17 additions & 15 deletions stdlib/3/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand All @@ -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:
Expand All @@ -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
Expand Down