stdlib: add some parameter defaults (#14610)

This commit is contained in:
Jelle Zijlstra
2025-08-21 00:17:33 -07:00
committed by GitHub
parent 310c161af7
commit 02a4b07b54
14 changed files with 30 additions and 22 deletions
@@ -113,6 +113,8 @@ urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
platform.platform # runtime default is 0, we pretend it's a bool
# =======
# <= 3.12
@@ -76,6 +76,8 @@ urllib.request.HTTPPasswordMgrWithPriorAuth.__init__ # Args are passed as is to
xml.etree.ElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
xml.etree.cElementTree.Element.__bool__ # Doesn't really exist; see comments in stub
platform.platform # runtime default is 0, we pretend it's a bool
# =======
# <= 3.12
+1 -1
View File
@@ -193,7 +193,6 @@ sqlite3\.test\..+ # Modules that exist at runtime, but shouldn't be added to ty
tkinter.EventType.__new__ # Derives from (str, Enum)
types.CodeType.replace # stubtest thinks default values are None but None doesn't work at runtime
# =============================================================
# Allowlist entries that cannot or should not be fixed; <= 3.11
# =============================================================
@@ -222,6 +221,7 @@ typing_extensions\.TypeAliasType\.__(parameters|type_params|name|module|value)__
unittest.test # Modules that exist at runtime, but shouldn't be added to typeshed
unittest\.test\..+ # Modules that exist at runtime, but shouldn't be added to typeshed
platform.platform # runtime default is 0, we pretend it's a bool
# =============================================================
# Allowlist entries that cannot or should not be fixed; <= 3.12
+3 -3
View File
@@ -394,8 +394,8 @@ class window: # undocumented
def attroff(self, attr: int, /) -> None: ...
def attron(self, attr: int, /) -> None: ...
def attrset(self, attr: int, /) -> None: ...
def bkgd(self, ch: _ChType, attr: int = ..., /) -> None: ...
def bkgdset(self, ch: _ChType, attr: int = ..., /) -> None: ...
def bkgd(self, ch: _ChType, attr: int = 0, /) -> None: ...
def bkgdset(self, ch: _ChType, attr: int = 0, /) -> None: ...
def border(
self,
ls: _ChType = ...,
@@ -433,7 +433,7 @@ class window: # undocumented
def derwin(self, begin_y: int, begin_x: int) -> window: ...
@overload
def derwin(self, nlines: int, ncols: int, begin_y: int, begin_x: int) -> window: ...
def echochar(self, ch: _ChType, attr: int = ..., /) -> None: ...
def echochar(self, ch: _ChType, attr: int = 0, /) -> None: ...
def enclose(self, y: int, x: int, /) -> bool: ...
def erase(self) -> None: ...
def getbegyx(self) -> tuple[int, int]: ...
+1 -1
View File
@@ -26,7 +26,7 @@ if sys.version_info >= (3, 11):
if sys.version_info >= (3, 12):
def run(
main: Coroutine[Any, Any, _T], *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ...
main: Coroutine[Any, Any, _T], *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None
) -> _T: ...
else:
+2 -2
View File
@@ -1150,8 +1150,8 @@ if sys.platform != "win32":
in_fd: FileDescriptor,
offset: int,
count: int,
headers: Sequence[ReadableBuffer] = ...,
trailers: Sequence[ReadableBuffer] = ...,
headers: Sequence[ReadableBuffer] = (),
trailers: Sequence[ReadableBuffer] = (),
flags: int = 0,
) -> int: ... # FreeBSD and Mac OS X only
+1 -1
View File
@@ -307,7 +307,7 @@ class Path(PurePath):
def link_to(self, target: StrOrBytesPath) -> None: ...
if sys.version_info >= (3, 12):
def walk(
self, top_down: bool = ..., on_error: Callable[[OSError], object] | None = ..., follow_symlinks: bool = ...
self, top_down: bool = True, on_error: Callable[[OSError], object] | None = None, follow_symlinks: bool = False
) -> Iterator[tuple[Self, list[str], list[str]]]: ...
class PosixPath(Path, PurePosixPath): ...
+1 -1
View File
@@ -68,7 +68,7 @@ def python_branch() -> str: ...
def python_revision() -> str: ...
def python_build() -> tuple[str, str]: ...
def python_compiler() -> str: ...
def platform(aliased: bool = ..., terse: bool = ...) -> str: ...
def platform(aliased: bool = False, terse: bool = False) -> str: ...
if sys.version_info >= (3, 10):
def freedesktop_os_release() -> dict[str, str]: ...
+1 -1
View File
@@ -39,7 +39,7 @@ class State:
lookbehindgroups: int | None
@property
def groups(self) -> int: ...
def opengroup(self, name: str | None = ...) -> int: ...
def opengroup(self, name: str | None = None) -> int: ...
def closegroup(self, gid: int, p: SubPattern) -> None: ...
def checkgroup(self, gid: int) -> bool: ...
def checklookbehindgroup(self, gid: int, source: Tokenizer) -> None: ...
+2 -2
View File
@@ -656,7 +656,7 @@ class TarFile:
members: Iterable[TarInfo] | None = None,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
filter: _TarfileFilter | None = None,
) -> None: ...
# Same situation as for `extractall`.
def extract(
@@ -666,7 +666,7 @@ class TarFile:
set_attrs: bool = True,
*,
numeric_owner: bool = False,
filter: _TarfileFilter | None = ...,
filter: _TarfileFilter | None = None,
) -> None: ...
def _extract_member(
self,
+3 -3
View File
@@ -30,7 +30,7 @@ def showinfo(
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["ok"] = ...,
default: Literal["ok"] = "ok",
parent: Misc = ...,
) -> str: ...
def showwarning(
@@ -39,7 +39,7 @@ def showwarning(
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["ok"] = ...,
default: Literal["ok"] = "ok",
parent: Misc = ...,
) -> str: ...
def showerror(
@@ -48,7 +48,7 @@ def showerror(
*,
detail: str = ...,
icon: Literal["error", "info", "question", "warning"] = ...,
default: Literal["ok"] = ...,
default: Literal["ok"] = "ok",
parent: Misc = ...,
) -> str: ...
def askquestion(
+2 -2
View File
@@ -329,7 +329,7 @@ class _patcher:
create: bool = ...,
spec_set: Any | None = ...,
autospec: Any | None = ...,
new_callable: None = ...,
new_callable: None = None,
**kwargs: Any,
) -> _patch_pass_arg[MagicMock | AsyncMock]: ...
@overload
@@ -368,7 +368,7 @@ class _patcher:
create: bool = ...,
spec_set: Any | None = ...,
autospec: Any | None = ...,
new_callable: None = ...,
new_callable: None = None,
**kwargs: Any,
) -> _patch_pass_arg[MagicMock | AsyncMock]: ...
@staticmethod
+4 -4
View File
@@ -161,7 +161,7 @@ class ZipFile:
def __init__(
self,
file: StrPath | _ZipWritable,
mode: Literal["w", "x"] = ...,
mode: Literal["w", "x"],
compression: int = 0,
allowZip64: bool = True,
compresslevel: int | None = None,
@@ -173,7 +173,7 @@ class ZipFile:
def __init__(
self,
file: StrPath | _ZipReadableTellable,
mode: Literal["a"] = ...,
mode: Literal["a"],
compression: int = 0,
allowZip64: bool = True,
compresslevel: int | None = None,
@@ -208,7 +208,7 @@ class ZipFile:
def __init__(
self,
file: StrPath | _ZipWritable,
mode: Literal["w", "x"] = ...,
mode: Literal["w", "x"],
compression: int = 0,
allowZip64: bool = True,
compresslevel: int | None = None,
@@ -219,7 +219,7 @@ class ZipFile:
def __init__(
self,
file: StrPath | _ZipReadableTellable,
mode: Literal["a"] = ...,
mode: Literal["a"],
compression: int = 0,
allowZip64: bool = True,
compresslevel: int | None = None,
+5 -1
View File
@@ -4,7 +4,11 @@ from re import Match
if sys.version_info >= (3, 13):
class Translator:
def __init__(self, seps: str = ...) -> None: ...
if sys.platform == "win32":
def __init__(self, seps: str = "\\/") -> None: ...
else:
def __init__(self, seps: str = "/") -> None: ...
def translate(self, pattern: str) -> str: ...
def extend(self, pattern: str) -> str: ...
def match_dirs(self, pattern: str) -> str: ...