From 4ab29832a2d4a025082d1ab3d006bdceca84c9e4 Mon Sep 17 00:00:00 2001 From: Ryan Jarvis Date: Wed, 17 May 2017 16:07:08 -0700 Subject: [PATCH] Extend typing to CursesWindow object (#1271) * Extend typing to CursesWindow object * Correct delch() signature --- stdlib/3/_curses.pyi | 227 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 226 insertions(+), 1 deletion(-) diff --git a/stdlib/3/_curses.pyi b/stdlib/3/_curses.pyi index 368dda208..6680b90f7 100644 --- a/stdlib/3/_curses.pyi +++ b/stdlib/3/_curses.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any, BinaryIO, Tuple, Union +from typing import Any, BinaryIO, IO, Optional, Tuple, Union, overload chtype = Union[str, bytes, int] @@ -295,3 +295,228 @@ def use_default_colors() -> None: ... def use_env(flag: bool) -> None: ... class error(Exception): ... + + +class CursesWindow: + encoding = ... # type: str + + @overload + def addch(self, ch: chtype, attr: Optional[int]) -> None: ... + + @overload + def addch(self, y: int, x: int, ch: chtype, attr: Optional[int]) -> None: ... + + @overload + def addnstr(self, str: str, n: int, attr: Optional[int]) -> None: ... + + @overload + def addnstr(self, y: int, x: int, str: str, n: int, attr: Optional[int]) -> None: ... + + @overload + def addstr(self, str: str, attr: Optional[int]) -> None: ... + + @overload + def addstr(self, y: int, x: int, str: str, attr: Optional[int]) -> None: ... + + def attroff(self, attr: int) -> None: ... + + def attron(self, attr: int) -> None: ... + + def attrset(self, attr: int) -> None: ... + + def bkgd(self, ch: chtype, attr: Optional[int]) -> None: ... + + def bkgset(self, ch: chtype, attr: Optional[int]) -> None: ... + + def border(self, ls: Optional[int], rs: Optional[int], + ts: Optional[int], bs: Optional[int], + tl: Optional[int], tr: Optional[int], + bl: Optional[int], br: Optional[int]) -> None: ... + + def box(self, vertch: Optional[Tuple[int, int]], horch: Optional[Tuple[int, int]]) -> None: ... + + @overload + def chgat(self, attr: int) -> None: ... + + @overload + def chgat(self, num: int, attr: int) -> None: ... + + @overload + def chgat(self, y: int, x: int, attr: int) -> None: ... + + @overload + def chgat(self, y: int, x: int, num: int, attr: int) -> None: ... + + def clear(self) -> None: ... + + def clearok(self, yes: int): ... + + def clrtobot(self) -> None: ... + + def clrtoeol(self) -> None: ... + + def cursyncup(self) -> None: ... + + @overload + def delch(self) -> None: ... + + @overload + def delch(self, y: int, x: int) -> None: ... + + def deleteln(self) -> None: ... + + @overload + def derwin(self, begin_y: int, begin_x: int) -> 'CursesWindow': ... + + @overload + def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> 'CursesWindow': ... + + def echochar(self, ch: chtype, attr: Optional[int]) -> None: ... + + def enclose(self, y: int, x: int) -> bool: ... + + def erase(self) -> None: ... + + def getbegyx(self) -> Tuple[int, int]: ... + + def getbkgd(self) -> Tuple[int, int]: ... + + def getch(self, y: Optional[int], x: Optional[int]) -> chtype: ... + + def get_wch(self, y: Optional[int], x: Optional[int]) -> chtype: ... + + def getkey(self, y: Optional[int], x: Optional[int]) -> str: ... + + def getmaxyx(self) -> Tuple['CursesWindow', int, int]: ... + + def getparyx(self) -> Tuple[int, int]: ... + + def getstr(self, y: Optional[int], x: Optional[int]) -> None: ... + + def getyx(self) -> Tuple['CursesWindow', int, int]: ... + + @overload + def hline(self, ch: chtype, n: int) -> None: ... + + @overload + def hline(self, y: int, x: int, ch: chtype, n: int) -> None: ... + + def idcok(self, flag: bool) -> None: ... + + def idlok(self, yes: bool) -> None: ... + + def immedok(self, flag: bool) -> None: ... + + def inch(self, y: Optional[int], x: Optional[int]) -> chtype: ... + + @overload + def insch(self, ch: chtype, attr: Optional[int]) -> None: ... + + @overload + def insch(self, y: int, x: int, ch: chtype, attr: Optional[int]) -> None: ... + + def insdelln(self, nlines: int) -> None: ... + + def insertln(self) -> None: ... + + @overload + def insnstr(self, str: str, n: int, attr: Optional[int]) -> None: ... + + @overload + def insnstr(self, y: int, x: int, str: str, n: int, attr: Optional[int]) -> None: ... + + @overload + def insstr(self, str: str, attr: Optional[int]) -> None: ... + + @overload + def insstr(self, y: int, x: int, str: str, attr: Optional[int]) -> None: ... + + @overload + def instr(self, n: Optional[int]) -> str: ... + + @overload + def instr(self, y: int, x: int, n: Optional[int]) -> str: ... + + def is_linetouched(self, line: int) -> bool: ... + + def is_wintouched(self) -> bool: ... + + def keypad(self, yes: bool) -> None: ... + + def leaveok(self, yes: bool) -> None: ... + + def move(self, new_y: int, new_x: int) -> None: ... + + def mvderwin(self, y: int, x: int) -> None: ... + + def mvwin(self, new_y: int, new_x: int) -> None: ... + + def nodelay(self, yes: bool) -> None: ... + + def notimeout(self, yes: bool) -> None: ... + + def noutrefresh(self) -> None: ... + + def overlay(self, destwin: 'CursesWindow', + sminrow: Optional[int], smincol: Optional[int], + dminrow: Optional[int], dmincol: Optional[int], + dmaxrow: Optional[int], dmaxcol: Optional[int]) -> None: ... + + def overwrite(self, destwin: 'CursesWindow', + sminrow: Optional[int], smincol: Optional[int], + dminrow: Optional[int], dmincol: Optional[int], + dmaxrow: Optional[int], dmaxcol: Optional[int]) -> None: ... + + def putwin(self, file: IO[Any]) -> None: ... + + def redrawln(self, beg: int, num: int) -> None: ... + + def redrawwin(self) -> None: ... + + def refresh(self, pminrow: Optional[int], pmincol: Optional[int], + sminrow: Optional[int], smincol: Optional[int], + smaxrow: Optional[int], smaxcol: Optional[int]) -> None: ... + + def resize(self, nlines: int, ncols: int) -> None: ... + + def scroll(self, lines: int) -> None: ... + + def scrollok(self, flag: bool) -> None: ... + + def setscrreg(self, top: int, bottom: int) -> None: ... + + def standend(self) -> None: ... + + def standout(self) -> None: ... + + @overload + def subpad(self, begin_y: int, begin_x: int) -> 'CursesWindow': ... + + @overload + def subpad(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> 'CursesWindow': ... + + @overload + def subwin(self, begin_y: int, begin_x: int) -> 'CursesWindow': ... + + @overload + def subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> 'CursesWindow': ... + + def syncdown(self) -> None: ... + + def syncok(self, flag: bool) -> None: ... + + def syncup(self) -> None: ... + + def timeout(self, delay: int) -> None: ... + + def touchline(self, start: int, count: int, changed: Optional[bool]) -> None: ... + + def touchwin(self) -> None: ... + + def untouchwin(self) -> None: ... + + @overload + def vline(self, ch: chtype, n: int) -> None: ... + + @overload + def vline(self, y: int, x: int, ch: chtype, n: int) -> None: ...