Relate _curses.wrapper return type to its function arg (#2353)

`curses.wrapper` returns the return value of the function it is passed,
but its function argument is declared as `Callable[..., Any]` while its
return type is `None`. This changes the definition of `curses.wrapper`
to use a `TypeVar` that relates the return type of its function argument
to its own return type.
This commit is contained in:
Olmo Kramer
2018-08-01 16:57:45 +02:00
committed by Jelle Zijlstra
parent 8b5d4708a0
commit 4ca0a63027

View File

@@ -1,10 +1,12 @@
import _curses
from _curses import * # noqa: F403
from typing import Callable, Any, Sequence, Mapping
from typing import TypeVar, Callable, Any, Sequence, Mapping
_T = TypeVar('_T')
LINES: int
COLS: int
def initscr() -> _curses._CursesWindow: ...
def start_color() -> None: ...
def wrapper(func: Callable[..., Any], *arg: Any, **kwds: Any) -> None: ...
def wrapper(func: Callable[..., _T], *arg: Any, **kwds: Any) -> _T: ...