mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
curses: make names private that don't exist at runtime (#1308)
And add some missing return types
This commit is contained in:
committed by
Matthias Kramm
parent
14f7492fe0
commit
48796411ed
@@ -1,6 +1,6 @@
|
||||
from typing import Any, BinaryIO, IO, Optional, Tuple, Union, overload
|
||||
|
||||
chtype = Union[str, bytes, int]
|
||||
_chtype = Union[str, bytes, int]
|
||||
|
||||
ALL_MOUSE_EVENTS = ... # type: int
|
||||
A_ALTCHARSET = ... # type: int
|
||||
@@ -242,7 +242,7 @@ def has_il() -> bool: ...
|
||||
def has_key(ch: int) -> bool: ...
|
||||
def init_color(color_number: int, r: int, g: int, b: int) -> None: ...
|
||||
def init_pair(pair_number: int, fg: int, bg: int) -> None: ...
|
||||
def initscr(): ...
|
||||
def initscr() -> _CursesWindow: ...
|
||||
def intrflush(ch: bool) -> None: ...
|
||||
def is_term_resized(nlines: int, ncols: int) -> bool: ...
|
||||
def isendwin() -> bool: ...
|
||||
@@ -254,7 +254,7 @@ def mouseinterval(interval: int) -> None: ...
|
||||
def mousemask(mousemask: int) -> Tuple[int, int]: ...
|
||||
def napms(ms: int) -> int: ...
|
||||
def newpad(nlines: int, ncols: int): ...
|
||||
def newwin(nlines: int, ncols: int, begin_y: int = ..., begin_x: int = ...): ...
|
||||
def newwin(nlines: int, ncols: int, begin_y: int = ..., begin_x: int = ...) -> _CursesWindow: ...
|
||||
def nl(flag: bool = ...) -> None: ...
|
||||
def nocbreak() -> None: ...
|
||||
def noecho() -> None: ...
|
||||
@@ -282,9 +282,9 @@ def tigetnum(capname: str) -> int: ...
|
||||
def tigetstr(capname: str) -> bytes: ...
|
||||
def tparm(fmt: str, i1: int = ..., i2: int = ..., i3: int = ..., i4: int = ..., i5: int = ..., i6: int = ..., i7: int = ..., i8: int = ..., i9: int = ...) -> str: ...
|
||||
def typeahead(fd: int) -> None: ...
|
||||
def unctrl(ch: chtype) -> bytes: ...
|
||||
def unget_wch(ch: chtype) -> None: ...
|
||||
def ungetch(ch: chtype) -> None: ...
|
||||
def unctrl(ch: _chtype) -> bytes: ...
|
||||
def unget_wch(ch: _chtype) -> None: ...
|
||||
def ungetch(ch: _chtype) -> None: ...
|
||||
def ungetmouse(id: int, x: int, y: int, z: int, bstate: int) -> None: ...
|
||||
def update_lines_cols() -> int: ...
|
||||
def use_default_colors() -> None: ...
|
||||
@@ -293,14 +293,14 @@ def use_env(flag: bool) -> None: ...
|
||||
class error(Exception): ...
|
||||
|
||||
|
||||
class CursesWindow:
|
||||
class _CursesWindow:
|
||||
encoding = ... # type: str
|
||||
|
||||
@overload
|
||||
def addch(self, ch: chtype, attr: Optional[int]) -> None: ...
|
||||
def addch(self, ch: _chtype, attr: Optional[int]) -> None: ...
|
||||
|
||||
@overload
|
||||
def addch(self, y: int, x: int, ch: chtype, attr: Optional[int]) -> None: ...
|
||||
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: ...
|
||||
@@ -320,9 +320,9 @@ class CursesWindow:
|
||||
|
||||
def attrset(self, attr: int) -> None: ...
|
||||
|
||||
def bkgd(self, ch: chtype, attr: Optional[int]) -> None: ...
|
||||
def bkgd(self, ch: _chtype, attr: Optional[int]) -> None: ...
|
||||
|
||||
def bkgset(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],
|
||||
@@ -362,12 +362,12 @@ class CursesWindow:
|
||||
def deleteln(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def derwin(self, begin_y: int, begin_x: int) -> 'CursesWindow': ...
|
||||
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 derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> '_CursesWindow': ...
|
||||
|
||||
def echochar(self, ch: chtype, attr: Optional[int]) -> None: ...
|
||||
def echochar(self, ch: _chtype, attr: Optional[int]) -> None: ...
|
||||
|
||||
def enclose(self, y: int, x: int) -> bool: ...
|
||||
|
||||
@@ -377,25 +377,25 @@ class CursesWindow:
|
||||
|
||||
def getbkgd(self) -> Tuple[int, int]: ...
|
||||
|
||||
def getch(self, y: Optional[int], x: Optional[int]) -> chtype: ...
|
||||
def getch(self, y: Optional[int], x: Optional[int]) -> _chtype: ...
|
||||
|
||||
def get_wch(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 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]: ...
|
||||
def getyx(self) -> Tuple['_CursesWindow', int, int]: ...
|
||||
|
||||
@overload
|
||||
def hline(self, ch: chtype, n: int) -> None: ...
|
||||
def hline(self, ch: _chtype, n: int) -> None: ...
|
||||
|
||||
@overload
|
||||
def hline(self, y: int, x: int, ch: chtype, n: int) -> None: ...
|
||||
def hline(self, y: int, x: int, ch: _chtype, n: int) -> None: ...
|
||||
|
||||
def idcok(self, flag: bool) -> None: ...
|
||||
|
||||
@@ -403,13 +403,13 @@ class CursesWindow:
|
||||
|
||||
def immedok(self, flag: bool) -> None: ...
|
||||
|
||||
def inch(self, y: Optional[int], x: Optional[int]) -> chtype: ...
|
||||
def inch(self, y: Optional[int], x: Optional[int]) -> _chtype: ...
|
||||
|
||||
@overload
|
||||
def insch(self, ch: chtype, attr: Optional[int]) -> None: ...
|
||||
def insch(self, ch: _chtype, attr: Optional[int]) -> None: ...
|
||||
|
||||
@overload
|
||||
def insch(self, y: int, x: int, ch: chtype, attr: Optional[int]) -> None: ...
|
||||
def insch(self, y: int, x: int, ch: _chtype, attr: Optional[int]) -> None: ...
|
||||
|
||||
def insdelln(self, nlines: int) -> None: ...
|
||||
|
||||
@@ -453,12 +453,12 @@ class CursesWindow:
|
||||
|
||||
def noutrefresh(self) -> None: ...
|
||||
|
||||
def overlay(self, destwin: 'CursesWindow',
|
||||
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',
|
||||
def overwrite(self, destwin: '_CursesWindow',
|
||||
sminrow: Optional[int], smincol: Optional[int],
|
||||
dminrow: Optional[int], dmincol: Optional[int],
|
||||
dmaxrow: Optional[int], dmaxcol: Optional[int]) -> None: ...
|
||||
@@ -486,16 +486,16 @@ class CursesWindow:
|
||||
def standout(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def subpad(self, begin_y: int, begin_x: int) -> 'CursesWindow': ...
|
||||
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': ...
|
||||
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': ...
|
||||
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 subwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> '_CursesWindow': ...
|
||||
|
||||
def syncdown(self) -> None: ...
|
||||
|
||||
@@ -512,7 +512,7 @@ class CursesWindow:
|
||||
def untouchwin(self) -> None: ...
|
||||
|
||||
@overload
|
||||
def vline(self, ch: chtype, n: int) -> None: ...
|
||||
def vline(self, ch: _chtype, n: int) -> None: ...
|
||||
|
||||
@overload
|
||||
def vline(self, y: int, x: int, ch: chtype, n: int) -> None: ...
|
||||
def vline(self, y: int, x: int, ch: _chtype, n: int) -> None: ...
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import _curses
|
||||
from _curses import * # noqa: F403
|
||||
# Stubgen imports a python version of has_key only if it's not present
|
||||
# in _curses (which it is in this stub)
|
||||
# from .has_key import has_key as has_key
|
||||
|
||||
def initscr(): ...
|
||||
def initscr() -> _curses._CursesWindow: ...
|
||||
def start_color(): ...
|
||||
def wrapper(func, *args, **kwds): ...
|
||||
|
||||
Reference in New Issue
Block a user