From ac2ef6e8c963a45841ad91e068e06748caa1fce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Gr=C3=BCbel?= Date: Fri, 27 Aug 2021 04:46:27 +0900 Subject: [PATCH] Use paramspec in no_type_check_decorator (#5942) --- stdlib/typing.pyi | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 1824abf9c..b028e5e70 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -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