Remove ParamSpec-related # type: ignores (#6703)

This commit is contained in:
Alex Waygood
2021-12-26 14:27:57 +00:00
committed by GitHub
parent d065ee4aef
commit a54e21992c
6 changed files with 10 additions and 9 deletions

View File

@@ -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: ...

View File

@@ -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: ...

View File

@@ -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

View File

@@ -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: ...

View File

@@ -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

View File

@@ -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]: ...