Add more defaults to the stdlib (#9606)

Continuing work towards #8988.

The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:

- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
This commit is contained in:
Alex Waygood
2023-01-29 01:51:23 +00:00
committed by GitHub
parent 25e02db42c
commit 33a62ae42d
150 changed files with 2761 additions and 2704 deletions

View File

@@ -59,14 +59,14 @@ class GNUTranslations(NullTranslations):
@overload # ignores incompatible overloads
def find( # type: ignore[misc]
domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[False] = ...
domain: str, localedir: StrPath | None = None, languages: Iterable[str] | None = None, all: Literal[False] = False
) -> str | None: ...
@overload
def find(
domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: Literal[True] = ...
domain: str, localedir: StrPath | None = None, languages: Iterable[str] | None = None, all: Literal[True] = ...
) -> list[str]: ...
@overload
def find(domain: str, localedir: StrPath | None = ..., languages: Iterable[str] | None = ..., all: bool = ...) -> Any: ...
def find(domain: str, localedir: StrPath | None = None, languages: Iterable[str] | None = None, all: bool = False) -> Any: ...
_NullTranslationsT = TypeVar("_NullTranslationsT", bound=NullTranslations)
@@ -74,19 +74,19 @@ if sys.version_info >= (3, 11):
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: None = ...,
fallback: Literal[False] = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: None = None,
fallback: Literal[False] = False,
) -> GNUTranslations: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
*,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
fallback: Literal[False] = False,
) -> _NullTranslationsT: ...
@overload
def translation(
@@ -94,15 +94,15 @@ if sys.version_info >= (3, 11):
localedir: StrPath | None,
languages: Iterable[str] | None,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
fallback: Literal[False] = False,
) -> _NullTranslationsT: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: Callable[[io.BufferedReader], NullTranslations] | None = ...,
fallback: bool = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: Callable[[io.BufferedReader], NullTranslations] | None = None,
fallback: bool = False,
) -> NullTranslations: ...
def install(domain: str, localedir: StrPath | None = None, *, names: Container[str] | None = None) -> None: ...
@@ -110,21 +110,21 @@ else:
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: None = ...,
fallback: Literal[False] = ...,
codeset: str | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: None = None,
fallback: Literal[False] = False,
codeset: str | None = None,
) -> GNUTranslations: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
*,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
codeset: str | None = ...,
fallback: Literal[False] = False,
codeset: str | None = None,
) -> _NullTranslationsT: ...
@overload
def translation(
@@ -132,20 +132,20 @@ else:
localedir: StrPath | None,
languages: Iterable[str] | None,
class_: Callable[[io.BufferedReader], _NullTranslationsT],
fallback: Literal[False] = ...,
codeset: str | None = ...,
fallback: Literal[False] = False,
codeset: str | None = None,
) -> _NullTranslationsT: ...
@overload
def translation(
domain: str,
localedir: StrPath | None = ...,
languages: Iterable[str] | None = ...,
class_: Callable[[io.BufferedReader], NullTranslations] | None = ...,
fallback: bool = ...,
codeset: str | None = ...,
localedir: StrPath | None = None,
languages: Iterable[str] | None = None,
class_: Callable[[io.BufferedReader], NullTranslations] | None = None,
fallback: bool = False,
codeset: str | None = None,
) -> NullTranslations: ...
def install(
domain: str, localedir: StrPath | None = ..., codeset: str | None = ..., names: Container[str] | None = ...
domain: str, localedir: StrPath | None = None, codeset: str | None = None, names: Container[str] | None = None
) -> None: ...
def textdomain(domain: str | None = None) -> str: ...
@@ -166,6 +166,6 @@ if sys.version_info < (3, 11):
def ldgettext(domain: str, message: str) -> str: ...
def lngettext(msgid1: str, msgid2: str, n: int) -> str: ...
def ldngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str | None = ...) -> str: ...
def bind_textdomain_codeset(domain: str, codeset: str | None = None) -> str: ...
Catalog = translation