update _CursesWindow to the runtime name "window" (#12744)

Prior to 3.8 the underlying C class was not given a name in
python, so typeshed added _CursesWindow to use it as a type.
Now that it has a name in python, typeshed should use that name.

We can keep _CursesWindow as an alias, for anyone using that
already.
This commit is contained in:
Stephen Morton
2024-10-06 19:04:55 -07:00
committed by GitHub
parent dbc71c9951
commit f318894924
4 changed files with 29 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
from _curses import *
from _curses import _CursesWindow as _CursesWindow
from _curses import window as window
from collections.abc import Callable
from typing import TypeVar
from typing_extensions import Concatenate, ParamSpec
@@ -19,4 +19,9 @@ COLS: int
COLORS: int
COLOR_PAIRS: int
def wrapper(func: Callable[Concatenate[_CursesWindow, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T: ...
def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T: ...
# typeshed used the name _CursesWindow for the underlying C class before
# it was mapped to the name 'window' in 3.8.
# Kept here as a legacy alias in case any third-party code is relying on it.
_CursesWindow = window

View File

@@ -1,4 +1,4 @@
from _curses import _CursesWindow
from _curses import window
version: str
@@ -9,14 +9,14 @@ class _Curses_Panel: # type is <class '_curses_panel.curses panel'> (note the s
def hidden(self) -> bool: ...
def hide(self) -> None: ...
def move(self, y: int, x: int) -> None: ...
def replace(self, win: _CursesWindow) -> None: ...
def replace(self, win: window) -> None: ...
def set_userptr(self, obj: object) -> None: ...
def show(self) -> None: ...
def top(self) -> None: ...
def userptr(self) -> object: ...
def window(self) -> _CursesWindow: ...
def window(self) -> window: ...
def bottom_panel() -> _Curses_Panel: ...
def new_panel(win: _CursesWindow, /) -> _Curses_Panel: ...
def new_panel(win: window, /) -> _Curses_Panel: ...
def top_panel() -> _Curses_Panel: ...
def update_panels() -> _Curses_Panel: ...

View File

@@ -1,11 +1,11 @@
from _curses import _CursesWindow
from _curses import window
from collections.abc import Callable
def rectangle(win: _CursesWindow, uly: int, ulx: int, lry: int, lrx: int) -> None: ...
def rectangle(win: window, uly: int, ulx: int, lry: int, lrx: int) -> None: ...
class Textbox:
stripspaces: bool
def __init__(self, win: _CursesWindow, insert_mode: bool = False) -> None: ...
def __init__(self, win: window, insert_mode: bool = False) -> None: ...
def edit(self, validate: Callable[[int], int] | None = None) -> str: ...
def do_command(self, ch: str | int) -> None: ...
def gather(self) -> str: ...