Use paramspec in no_type_check_decorator (#5942)

This commit is contained in:
Anton Grübel
2021-08-27 04:46:27 +09:00
committed by GitHub
parent f1da797c62
commit ac2ef6e8c9

View File

@@ -2,7 +2,7 @@ import collections # Needed by aliases like DefaultDict, see mypy issue 2986
import sys
from abc import ABCMeta, abstractmethod
from types import BuiltinFunctionType, CodeType, FrameType, FunctionType, MethodType, ModuleType, TracebackType
from typing_extensions import Literal as _Literal
from typing_extensions import Literal as _Literal, ParamSpec as _ParamSpec
if sys.version_info >= (3, 7):
from types import MethodDescriptorType, MethodWrapperType, WrapperDescriptorType
@@ -36,6 +36,7 @@ class _SpecialForm:
def __getitem__(self, typeargs: Any) -> object: ...
_F = TypeVar("_F", bound=Callable[..., Any])
_P = _ParamSpec("_P")
def overload(func: _F) -> _F: ...
@@ -99,7 +100,7 @@ _T_contra = TypeVar("_T_contra", contravariant=True) # Ditto contravariant.
_TC = TypeVar("_TC", bound=Type[object])
def no_type_check(arg: _F) -> _F: ...
def no_type_check_decorator(decorator: _F) -> _F: ...
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore
# Type aliases and type constructors