Skip to content

Commit a0e75d6

Browse files
author
hauntsaninja
committed
[0.930 backport] update curses stubs
To help with #11768 We'll also need to cherry pick #11781
1 parent 5919e92 commit a0e75d6

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

mypy/typeshed/stdlib/_curses.pyi

+23-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
2-
from typing import IO, Any, BinaryIO, NamedTuple, Union, overload
2+
from _typeshed import SupportsRead
3+
from typing import IO, Any, NamedTuple, Union, overload
34

45
_chtype = Union[str, bytes, int]
56

@@ -293,9 +294,14 @@ def erasechar() -> bytes: ...
293294
def filter() -> None: ...
294295
def flash() -> None: ...
295296
def flushinp() -> None: ...
297+
298+
if sys.version_info >= (3, 9):
299+
def get_escdelay() -> int: ...
300+
def get_tabsize() -> int: ...
301+
296302
def getmouse() -> tuple[int, int, int, int, int]: ...
297303
def getsyx() -> tuple[int, int]: ...
298-
def getwin(__file: BinaryIO) -> _CursesWindow: ...
304+
def getwin(__file: SupportsRead[bytes]) -> _CursesWindow: ...
299305
def halfdelay(__tenths: int) -> None: ...
300306
def has_colors() -> bool: ...
301307

@@ -337,14 +343,19 @@ def resetty() -> None: ...
337343
def resize_term(__nlines: int, __ncols: int) -> None: ...
338344
def resizeterm(__nlines: int, __ncols: int) -> None: ...
339345
def savetty() -> None: ...
346+
347+
if sys.version_info >= (3, 9):
348+
def set_escdelay(__ms: int) -> None: ...
349+
def set_tabsize(__size: int) -> None: ...
350+
340351
def setsyx(__y: int, __x: int) -> None: ...
341352
def setupterm(term: str | None = ..., fd: int = ...) -> None: ...
342353
def start_color() -> None: ...
343354
def termattrs() -> int: ...
344355
def termname() -> bytes: ...
345356
def tigetflag(__capname: str) -> int: ...
346357
def tigetnum(__capname: str) -> int: ...
347-
def tigetstr(__capname: str) -> bytes: ...
358+
def tigetstr(__capname: str) -> bytes | None: ...
348359
def tparm(
349360
__str: bytes,
350361
__i1: int = ...,
@@ -362,7 +373,7 @@ def unctrl(__ch: _chtype) -> bytes: ...
362373
def unget_wch(__ch: int | str) -> None: ...
363374
def ungetch(__ch: _chtype) -> None: ...
364375
def ungetmouse(__id: int, __x: int, __y: int, __z: int, __bstate: int) -> None: ...
365-
def update_lines_cols() -> int: ...
376+
def update_lines_cols() -> None: ...
366377
def use_default_colors() -> None: ...
367378
def use_env(__flag: bool) -> None: ...
368379

@@ -444,13 +455,13 @@ class _CursesWindow:
444455
def getmaxyx(self) -> tuple[int, int]: ...
445456
def getparyx(self) -> tuple[int, int]: ...
446457
@overload
447-
def getstr(self) -> _chtype: ...
458+
def getstr(self) -> bytes: ...
448459
@overload
449-
def getstr(self, n: int) -> _chtype: ...
460+
def getstr(self, n: int) -> bytes: ...
450461
@overload
451-
def getstr(self, y: int, x: int) -> _chtype: ...
462+
def getstr(self, y: int, x: int) -> bytes: ...
452463
@overload
453-
def getstr(self, y: int, x: int, n: int) -> _chtype: ...
464+
def getstr(self, y: int, x: int, n: int) -> bytes: ...
454465
def getyx(self) -> tuple[int, int]: ...
455466
@overload
456467
def hline(self, ch: _chtype, n: int) -> None: ...
@@ -460,9 +471,9 @@ class _CursesWindow:
460471
def idlok(self, yes: bool) -> None: ...
461472
def immedok(self, flag: bool) -> None: ...
462473
@overload
463-
def inch(self) -> _chtype: ...
474+
def inch(self) -> int: ...
464475
@overload
465-
def inch(self, y: int, x: int) -> _chtype: ...
476+
def inch(self, y: int, x: int) -> int: ...
466477
@overload
467478
def insch(self, ch: _chtype, attr: int = ...) -> None: ...
468479
@overload
@@ -478,9 +489,9 @@ class _CursesWindow:
478489
@overload
479490
def insstr(self, y: int, x: int, str: str, attr: int = ...) -> None: ...
480491
@overload
481-
def instr(self, n: int = ...) -> _chtype: ...
492+
def instr(self, n: int = ...) -> bytes: ...
482493
@overload
483-
def instr(self, y: int, x: int, n: int = ...) -> _chtype: ...
494+
def instr(self, y: int, x: int, n: int = ...) -> bytes: ...
484495
def is_linetouched(self, __line: int) -> bool: ...
485496
def is_wintouched(self) -> bool: ...
486497
def keypad(self, yes: bool) -> None: ...

0 commit comments

Comments
 (0)