From a54e21992c26485edb374e1287a7e9c073d6a9ae Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 26 Dec 2021 14:27:57 +0000 Subject: [PATCH] Remove `ParamSpec`-related `# type: ignore`s (#6703) --- stdlib/_operator.pyi | 2 +- stdlib/atexit.pyi | 2 +- stdlib/importlib/util.pyi | 6 +++--- stdlib/trace.pyi | 4 ++-- stdlib/types.pyi | 3 ++- stdlib/unittest/signals.pyi | 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/stdlib/_operator.pyi b/stdlib/_operator.pyi index 408ec7ca2..251e53810 100644 --- a/stdlib/_operator.pyi +++ b/stdlib/_operator.pyi @@ -137,6 +137,6 @@ def itruediv(__a: Any, __b: Any) -> Any: ... def ixor(__a: Any, __b: Any) -> Any: ... if sys.version_info >= (3, 11): - def call(__obj: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... # type: ignore + def call(__obj: Callable[_P, _R], *args: _P.args, **kwargs: _P.kwargs) -> _R: ... def _compare_digest(__a: AnyStr, __b: AnyStr) -> bool: ... diff --git a/stdlib/atexit.pyi b/stdlib/atexit.pyi index 9395c6067..ba0c7dfaf 100644 --- a/stdlib/atexit.pyi +++ b/stdlib/atexit.pyi @@ -7,5 +7,5 @@ _P = ParamSpec("_P") def _clear() -> None: ... def _ncallbacks() -> int: ... def _run_exitfuncs() -> None: ... -def register(func: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Callable[_P, _T]: ... # type: ignore +def register(func: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Callable[_P, _T]: ... def unregister(func: Callable[..., Any]) -> None: ... diff --git a/stdlib/importlib/util.pyi b/stdlib/importlib/util.pyi index 96db31468..c759d7def 100644 --- a/stdlib/importlib/util.pyi +++ b/stdlib/importlib/util.pyi @@ -8,9 +8,9 @@ from typing_extensions import ParamSpec _P = ParamSpec("_P") -def module_for_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore[misc] -def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore[misc] -def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore[misc] +def module_for_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... +def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... +def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... def resolve_name(name: str, package: str | None) -> str: ... MAGIC_NUMBER: bytes diff --git a/stdlib/trace.pyi b/stdlib/trace.pyi index bab75c9ad..2fe841aa5 100644 --- a/stdlib/trace.pyi +++ b/stdlib/trace.pyi @@ -43,9 +43,9 @@ class Trace: self, cmd: str | types.CodeType, globals: Mapping[str, Any] | None = ..., locals: Mapping[str, Any] | None = ... ) -> None: ... if sys.version_info >= (3, 9): - def runfunc(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... # type: ignore + def runfunc(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... else: - def runfunc(self, func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... # type: ignore + def runfunc(self, func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... def file_module_function_of(self, frame: types.FrameType) -> _fileModuleFunction: ... def globaltrace_trackcallers(self, frame: types.FrameType, why: str, arg: Any) -> None: ... def globaltrace_countfuncs(self, frame: types.FrameType, why: str, arg: Any) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index b018d56ac..41f584f60 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -407,10 +407,11 @@ _R = TypeVar("_R") _P = ParamSpec("_P") # it's not really an Awaitable, but can be used in an await expression. Real type: Generator & Awaitable +# The type: ignore is due to overlapping overloads, not the use of ParamSpec @overload def coroutine(func: Callable[_P, Generator[_R, Any, Any]]) -> Callable[_P, Awaitable[_R]]: ... # type: ignore[misc] @overload -def coroutine(func: _Fn) -> _Fn: ... # type: ignore[misc] +def coroutine(func: _Fn) -> _Fn: ... if sys.version_info >= (3, 8): CellType = _Cell diff --git a/stdlib/unittest/signals.pyi b/stdlib/unittest/signals.pyi index 453bc9caf..e6f5f95e1 100644 --- a/stdlib/unittest/signals.pyi +++ b/stdlib/unittest/signals.pyi @@ -11,4 +11,4 @@ def removeResult(result: unittest.result.TestResult) -> bool: ... @overload def removeHandler(method: None = ...) -> None: ... @overload -def removeHandler(method: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore[misc] +def removeHandler(method: Callable[_P, _T]) -> Callable[_P, _T]: ...