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

@@ -41,10 +41,10 @@ class Font:
self,
# In tkinter, 'root' refers to tkinter.Tk by convention, but the code
# actually works with any tkinter widget so we use tkinter.Misc.
root: tkinter.Misc | None = ...,
font: _FontDescription | None = ...,
name: str | None = ...,
exists: bool = ...,
root: tkinter.Misc | None = None,
font: _FontDescription | None = None,
name: str | None = None,
exists: bool = False,
*,
family: str = ...,
size: int = ...,
@@ -68,19 +68,19 @@ class Font:
def cget(self, option: str) -> Any: ...
__getitem__ = cget
@overload
def actual(self, option: Literal["family"], displayof: tkinter.Misc | None = ...) -> str: ...
def actual(self, option: Literal["family"], displayof: tkinter.Misc | None = None) -> str: ...
@overload
def actual(self, option: Literal["size"], displayof: tkinter.Misc | None = ...) -> int: ...
def actual(self, option: Literal["size"], displayof: tkinter.Misc | None = None) -> int: ...
@overload
def actual(self, option: Literal["weight"], displayof: tkinter.Misc | None = ...) -> Literal["normal", "bold"]: ...
def actual(self, option: Literal["weight"], displayof: tkinter.Misc | None = None) -> Literal["normal", "bold"]: ...
@overload
def actual(self, option: Literal["slant"], displayof: tkinter.Misc | None = ...) -> Literal["roman", "italic"]: ...
def actual(self, option: Literal["slant"], displayof: tkinter.Misc | None = None) -> Literal["roman", "italic"]: ...
@overload
def actual(self, option: Literal["underline", "overstrike"], displayof: tkinter.Misc | None = ...) -> bool: ...
def actual(self, option: Literal["underline", "overstrike"], displayof: tkinter.Misc | None = None) -> bool: ...
@overload
def actual(self, option: None, displayof: tkinter.Misc | None = ...) -> _FontDict: ...
def actual(self, option: None, displayof: tkinter.Misc | None = None) -> _FontDict: ...
@overload
def actual(self, *, displayof: tkinter.Misc | None = ...) -> _FontDict: ...
def actual(self, *, displayof: tkinter.Misc | None = None) -> _FontDict: ...
def config(
self,
*,
@@ -99,14 +99,14 @@ class Font:
def metrics(self, __option: Literal["fixed"], *, displayof: tkinter.Misc | None = ...) -> bool: ...
@overload
def metrics(self, *, displayof: tkinter.Misc | None = ...) -> _MetricsDict: ...
def measure(self, text: str, displayof: tkinter.Misc | None = ...) -> int: ...
def measure(self, text: str, displayof: tkinter.Misc | None = None) -> int: ...
def __eq__(self, other: object) -> bool: ...
def families(root: tkinter.Misc | None = ..., displayof: tkinter.Misc | None = ...) -> tuple[str, ...]: ...
def names(root: tkinter.Misc | None = ...) -> tuple[str, ...]: ...
def families(root: tkinter.Misc | None = None, displayof: tkinter.Misc | None = None) -> tuple[str, ...]: ...
def names(root: tkinter.Misc | None = None) -> tuple[str, ...]: ...
if sys.version_info >= (3, 10):
def nametofont(name: str, root: tkinter.Misc | None = ...) -> Font: ...
def nametofont(name: str, root: tkinter.Misc | None = None) -> Font: ...
else:
def nametofont(name: str) -> Font: ...