From 4e88557666811b88fcabed25f15611d55d687391 Mon Sep 17 00:00:00 2001 From: Sebastian Rittau Date: Fri, 18 Sep 2020 15:20:26 +0200 Subject: [PATCH] Complete msvcrt (#4548) --- stdlib/2and3/msvcrt.pyi | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/stdlib/2and3/msvcrt.pyi b/stdlib/2and3/msvcrt.pyi index 2167a7311..ede80c9fb 100644 --- a/stdlib/2and3/msvcrt.pyi +++ b/stdlib/2and3/msvcrt.pyi @@ -1,14 +1,24 @@ -# Stubs for msvcrt +import sys +from typing import Text -# NOTE: These are incomplete! - -LK_LOCK: int -LK_NBLCK: int -LK_NBRLCK: int -LK_RLCK: int -LK_UNLCK: int - -def locking(__fd: int, __mode: int, __nbytes: int) -> None: ... -def get_osfhandle(__fd: int) -> int: ... -def open_osfhandle(__handle: int, __flags: int) -> int: ... -def getch() -> bytes: ... +# This module is only available on Windows +if sys.platform == "win32": + LK_LOCK: int + LK_NBLCK: int + LK_NBRLCK: int + LK_RLCK: int + LK_UNLCK: int + def locking(__fd: int, __mode: int, __nbytes: int) -> None: ... + def setmode(__fd: int, __mode: int) -> int: ... + def open_osfhandle(__handle: int, __flags: int) -> int: ... + def get_osfhandle(__fd: int) -> int: ... + def kbhit() -> bool: ... + def getch() -> bytes: ... + def getwch() -> Text: ... + def getche() -> bytes: ... + def getwche() -> Text: ... + def putch(__char: bytes) -> None: ... + def putwch(__unicode_char: Text) -> None: ... + def ungetch(__char: bytes) -> None: ... + def ungetwch(__unicode_char: Text) -> None: ... + def heapmin() -> None: ...