curses: add Concatenate (#8414)

Update the `wrapper` `__func` parameter to use ParamSpec and Concatenate to address a todo.
This commit is contained in:
Kevin Kirsche
2022-07-27 23:02:25 -04:00
committed by GitHub
parent 16e44d560f
commit b7b98a6c9f

View File

@@ -1,12 +1,14 @@
import sys
from collections.abc import Callable
from typing import Any, TypeVar
from typing import TypeVar
from typing_extensions import Concatenate, ParamSpec
if sys.platform != "win32":
from _curses import *
from _curses import _CursesWindow as _CursesWindow
_T = TypeVar("_T")
_P = ParamSpec("_P")
# available after calling `curses.initscr()`
LINES: int
@@ -15,6 +17,5 @@ if sys.platform != "win32":
# available after calling `curses.start_color()`
COLORS: int
COLOR_PAIRS: int
# TODO: wait for `Concatenate` support
# def wrapper(__func: Callable[Concatenate[_CursesWindow, _P], _T], *arg: _P.args, **kwds: _P.kwargs) -> _T: ...
def wrapper(__func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ...
def wrapper(__func: Callable[Concatenate[_CursesWindow, _P], _T], *arg: _P.args, **kwds: _P.kwargs) -> _T: ...