stdlib: add defaults for modules accessible on MacOS (#9659)

Ran stubdefaulter with standard options on a Mac.
This commit is contained in:
Jelle Zijlstra
2023-02-01 14:46:55 -08:00
committed by GitHub
parent bc463a0677
commit 0fc3a567fc
10 changed files with 67 additions and 67 deletions

View File

@@ -274,7 +274,7 @@ if sys.platform != "win32":
def baudrate() -> int: ...
def beep() -> None: ...
def can_change_color() -> bool: ...
def cbreak(__flag: bool = ...) -> None: ...
def cbreak(__flag: bool = True) -> None: ...
def color_content(__color_number: int) -> tuple[int, int, int]: ...
# Changed in Python 3.8.8 and 3.9.2
if sys.version_info >= (3, 8):
@@ -287,7 +287,7 @@ if sys.platform != "win32":
def def_shell_mode() -> None: ...
def delay_output(__ms: int) -> None: ...
def doupdate() -> None: ...
def echo(__flag: bool = ...) -> None: ...
def echo(__flag: bool = True) -> None: ...
def endwin() -> None: ...
def erasechar() -> bytes: ...
def filter() -> None: ...
@@ -323,7 +323,7 @@ if sys.platform != "win32":
def napms(__ms: int) -> int: ...
def newpad(__nlines: int, __ncols: int) -> _CursesWindow: ...
def newwin(__nlines: int, __ncols: int, __begin_y: int = ..., __begin_x: int = ...) -> _CursesWindow: ...
def nl(__flag: bool = ...) -> None: ...
def nl(__flag: bool = True) -> None: ...
def nocbreak() -> None: ...
def noecho() -> None: ...
def nonl() -> None: ...
@@ -332,8 +332,8 @@ if sys.platform != "win32":
def pair_content(__pair_number: int) -> tuple[int, int]: ...
def pair_number(__attr: int) -> int: ...
def putp(__string: ReadOnlyBuffer) -> None: ...
def qiflush(__flag: bool = ...) -> None: ...
def raw(__flag: bool = ...) -> None: ...
def qiflush(__flag: bool = True) -> None: ...
def raw(__flag: bool = True) -> None: ...
def reset_prog_mode() -> None: ...
def reset_shell_mode() -> None: ...
def resetty() -> None: ...
@@ -354,15 +354,15 @@ if sys.platform != "win32":
def tigetstr(__capname: str) -> bytes | None: ...
def tparm(
__str: ReadOnlyBuffer,
__i1: int = ...,
__i2: int = ...,
__i3: int = ...,
__i4: int = ...,
__i5: int = ...,
__i6: int = ...,
__i7: int = ...,
__i8: int = ...,
__i9: int = ...,
__i1: int = 0,
__i2: int = 0,
__i3: int = 0,
__i4: int = 0,
__i5: int = 0,
__i6: int = 0,
__i7: int = 0,
__i8: int = 0,
__i9: int = 0,
) -> bytes: ...
def typeahead(__fd: int) -> None: ...
def unctrl(__ch: _ChType) -> bytes: ...

View File

@@ -76,7 +76,7 @@ if sys.platform != "win32":
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
def send(self, data: bytes, flags: int = ...) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ...
def getsockopt(self, level: int, optname: int, buflen: None = None) -> int: ...
@overload
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
def read(self, bufsize: int, flags: int = ...) -> bytes: ...

View File

@@ -33,4 +33,4 @@ if sys.platform != "win32":
# Don't exist at runtime
__new__: None # type: ignore[assignment]
__init__: None # type: ignore[assignment]
def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _dbm: ...
def open(__filename: str, __flags: str = "r", __mode: int = 438) -> _dbm: ...

View File

@@ -101,16 +101,16 @@ if sys.platform != "win32":
I_SWROPT: int
I_UNLINK: int
@overload
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: int = ...) -> int: ...
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: int = 0) -> int: ...
@overload
def fcntl(__fd: FileDescriptorLike, __cmd: int, __arg: str | ReadOnlyBuffer) -> bytes: ...
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: int = ..., __mutate_flag: bool = ...) -> int: ...
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: int = 0, __mutate_flag: bool = True) -> int: ...
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[True] = ...) -> int: ...
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[True] = True) -> int: ...
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: WriteableBuffer, __mutate_flag: Literal[False]) -> bytes: ...
@overload
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: ReadOnlyBuffer, __mutate_flag: bool = ...) -> bytes: ...
def ioctl(__fd: FileDescriptorLike, __request: int, __arg: ReadOnlyBuffer, __mutate_flag: bool = True) -> bytes: ...
def flock(__fd: FileDescriptorLike, __operation: int) -> None: ...
def lockf(__fd: FileDescriptorLike, __cmd: int, __len: int = ..., __start: int = ..., __whence: int = ...) -> Any: ...
def lockf(__fd: FileDescriptorLike, __cmd: int, __len: int = 0, __start: int = 0, __whence: int = 0) -> Any: ...

View File

@@ -113,7 +113,7 @@ class BaseContext:
def set_forkserver_preload(self, module_names: list[str]) -> None: ...
if sys.platform != "win32":
@overload
def get_context(self, method: None = ...) -> DefaultContext: ...
def get_context(self, method: None = None) -> DefaultContext: ...
@overload
def get_context(self, method: Literal["spawn"]) -> SpawnContext: ...
@overload

View File

@@ -626,8 +626,8 @@ if sys.platform != "win32":
def pread(__fd: int, __length: int, __offset: int) -> bytes: ...
def pwrite(__fd: int, __buffer: ReadableBuffer, __offset: int) -> int: ...
# In CI, stubtest sometimes reports that these are available on MacOS, sometimes not
def preadv(__fd: int, __buffers: SupportsLenAndGetItem[WriteableBuffer], __offset: int, __flags: int = ...) -> int: ...
def pwritev(__fd: int, __buffers: SupportsLenAndGetItem[ReadableBuffer], __offset: int, __flags: int = ...) -> int: ...
def preadv(__fd: int, __buffers: SupportsLenAndGetItem[WriteableBuffer], __offset: int, __flags: int = 0) -> int: ...
def pwritev(__fd: int, __buffers: SupportsLenAndGetItem[ReadableBuffer], __offset: int, __flags: int = 0) -> int: ...
if sys.platform != "darwin":
if sys.version_info >= (3, 10):
RWF_APPEND: int # docs say available on 3.7+, stubtest says otherwise
@@ -645,7 +645,7 @@ if sys.platform != "win32":
count: int,
headers: Sequence[ReadableBuffer] = ...,
trailers: Sequence[ReadableBuffer] = ...,
flags: int = ...,
flags: int = 0,
) -> int: ... # FreeBSD and Mac OS X only
def readv(__fd: int, __buffers: SupportsLenAndGetItem[WriteableBuffer]) -> int: ...
def writev(__fd: int, __buffers: SupportsLenAndGetItem[ReadableBuffer]) -> int: ...
@@ -774,21 +774,21 @@ def walk(
if sys.platform != "win32":
@overload
def fwalk(
top: StrPath = ...,
topdown: bool = ...,
onerror: _OnError | None = ...,
top: StrPath = ".",
topdown: bool = True,
onerror: _OnError | None = None,
*,
follow_symlinks: bool = ...,
dir_fd: int | None = ...,
follow_symlinks: bool = False,
dir_fd: int | None = None,
) -> Iterator[tuple[str, list[str], list[str], int]]: ...
@overload
def fwalk(
top: BytesPath,
topdown: bool = ...,
onerror: _OnError | None = ...,
topdown: bool = True,
onerror: _OnError | None = None,
*,
follow_symlinks: bool = ...,
dir_fd: int | None = ...,
follow_symlinks: bool = False,
dir_fd: int | None = None,
) -> Iterator[tuple[bytes, list[bytes], list[bytes], int]]: ...
if sys.platform == "linux":
def getxattr(path: FileDescriptorOrPath, attribute: StrOrBytesPath, *, follow_symlinks: bool = ...) -> bytes: ...

View File

@@ -8,13 +8,13 @@ if sys.platform != "win32":
_CompDisp: TypeAlias = Callable[[str, Sequence[str], int], None]
def parse_and_bind(__string: str) -> None: ...
def read_init_file(__filename: StrOrBytesPath | None = ...) -> None: ...
def read_init_file(__filename: StrOrBytesPath | None = None) -> None: ...
def get_line_buffer() -> str: ...
def insert_text(__string: str) -> None: ...
def redisplay() -> None: ...
def read_history_file(__filename: StrOrBytesPath | None = ...) -> None: ...
def write_history_file(__filename: StrOrBytesPath | None = ...) -> None: ...
def append_history_file(__nelements: int, __filename: StrOrBytesPath | None = ...) -> None: ...
def read_history_file(__filename: StrOrBytesPath | None = None) -> None: ...
def write_history_file(__filename: StrOrBytesPath | None = None) -> None: ...
def append_history_file(__nelements: int, __filename: StrOrBytesPath | None = None) -> None: ...
def get_history_length() -> int: ...
def set_history_length(__length: int) -> None: ...
def clear_history() -> None: ...
@@ -24,13 +24,13 @@ if sys.platform != "win32":
def replace_history_item(__pos: int, __line: str) -> None: ...
def add_history(__string: str) -> None: ...
def set_auto_history(__enabled: bool) -> None: ...
def set_startup_hook(__function: Callable[[], object] | None = ...) -> None: ...
def set_pre_input_hook(__function: Callable[[], object] | None = ...) -> None: ...
def set_completer(__function: _Completer | None = ...) -> None: ...
def set_startup_hook(__function: Callable[[], object] | None = None) -> None: ...
def set_pre_input_hook(__function: Callable[[], object] | None = None) -> None: ...
def set_completer(__function: _Completer | None = None) -> None: ...
def get_completer() -> _Completer | None: ...
def get_completion_type() -> int: ...
def get_begidx() -> int: ...
def get_endidx() -> int: ...
def set_completer_delims(__string: str) -> None: ...
def get_completer_delims() -> str: ...
def set_completion_display_matches_hook(__function: _CompDisp | None = ...) -> None: ...
def set_completion_display_matches_hook(__function: _CompDisp | None = None) -> None: ...

View File

@@ -58,7 +58,7 @@ if sys.platform != "linux" and sys.platform != "win32":
def __init__(self) -> None: ...
def close(self) -> None: ...
def control(
self, __changelist: Iterable[kevent] | None, __maxevents: int, __timeout: float | None = ...
self, __changelist: Iterable[kevent] | None, __maxevents: int, __timeout: float | None = None
) -> list[kevent]: ...
def fileno(self) -> int: ...
@classmethod

View File

@@ -134,7 +134,7 @@ else:
else:
def pthread_sigmask(__how: int, __mask: Iterable[int]) -> set[_SIGNUM]: ...
def setitimer(__which: int, __seconds: float, __interval: float = ...) -> tuple[float, float]: ...
def setitimer(__which: int, __seconds: float, __interval: float = 0.0) -> tuple[float, float]: ...
def siginterrupt(__signalnum: int, __flag: bool) -> None: ...
def sigpending() -> Any: ...
if sys.version_info >= (3, 10): # argument changed in 3.10.2

View File

@@ -116,38 +116,38 @@ else:
@overload
def TemporaryFile(
mode: _StrMode,
buffering: int = ...,
encoding: str | None = ...,
newline: str | None = ...,
suffix: AnyStr | None = ...,
prefix: AnyStr | None = ...,
dir: GenericPath[AnyStr] | None = ...,
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = ...,
errors: str | None = None,
) -> IO[str]: ...
@overload
def TemporaryFile(
mode: _BytesMode = ...,
buffering: int = ...,
encoding: str | None = ...,
newline: str | None = ...,
suffix: AnyStr | None = ...,
prefix: AnyStr | None = ...,
dir: GenericPath[AnyStr] | None = ...,
mode: _BytesMode = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = ...,
errors: str | None = None,
) -> IO[bytes]: ...
@overload
def TemporaryFile(
mode: str = ...,
buffering: int = ...,
encoding: str | None = ...,
newline: str | None = ...,
suffix: AnyStr | None = ...,
prefix: AnyStr | None = ...,
dir: GenericPath[AnyStr] | None = ...,
mode: str = "w+b",
buffering: int = -1,
encoding: str | None = None,
newline: str | None = None,
suffix: AnyStr | None = None,
prefix: AnyStr | None = None,
dir: GenericPath[AnyStr] | None = None,
*,
errors: str | None = ...,
errors: str | None = None,
) -> IO[Any]: ...
else:
@overload