From 1e3d762a1231b3d1306d06b4f9bef69aa365ab6c Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sat, 4 Feb 2023 11:58:18 +0000 Subject: [PATCH] stdlib: use `bool` for annotations where the default is `False` (#9672) --- stdlib/_codecs.pyi | 26 +++++++++++++------------- stdlib/builtins.pyi | 16 ++++++++-------- stdlib/quopri.pyi | 8 ++++---- stdlib/tkinter/__init__.pyi | 2 +- stdlib/uu.pyi | 2 +- 5 files changed, 27 insertions(+), 27 deletions(-) diff --git a/stdlib/_codecs.pyi b/stdlib/_codecs.pyi index 44cc0f780..51f17f01c 100644 --- a/stdlib/_codecs.pyi +++ b/stdlib/_codecs.pyi @@ -104,35 +104,35 @@ if sys.version_info < (3, 8): def unicode_internal_decode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[str, int]: ... def unicode_internal_encode(__obj: str | ReadableBuffer, __errors: str | None = None) -> tuple[bytes, int]: ... -def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_16_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_16_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... -def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_16_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_16_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ... def utf_16_ex_decode( - __data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: int = False + __data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: bool = False ) -> tuple[str, int, int]: ... -def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_16_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_16_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... -def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_32_be_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_32_be_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... -def utf_32_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_32_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_32_encode(__str: str, __errors: str | None = None, __byteorder: int = 0) -> tuple[bytes, int]: ... def utf_32_ex_decode( - __data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: int = False + __data: ReadableBuffer, __errors: str | None = None, __byteorder: int = 0, __final: bool = False ) -> tuple[str, int, int]: ... -def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_32_le_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_32_le_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... -def utf_7_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_7_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_7_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... -def utf_8_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... +def utf_8_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def utf_8_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... if sys.platform == "win32": - def mbcs_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... + def mbcs_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def mbcs_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... def code_page_decode( - __codepage: int, __data: ReadableBuffer, __errors: str | None = None, __final: int = False + __codepage: int, __data: ReadableBuffer, __errors: str | None = None, __final: bool = False ) -> tuple[str, int]: ... def code_page_encode(__code_page: int, __str: str, __errors: str | None = None) -> tuple[bytes, int]: ... - def oem_decode(__data: ReadableBuffer, __errors: str | None = None, __final: int = False) -> tuple[str, int]: ... + def oem_decode(__data: ReadableBuffer, __errors: str | None = None, __final: bool = False) -> tuple[str, int]: ... def oem_encode(__str: str, __errors: str | None = None) -> tuple[bytes, int]: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 022b540d1..70c4dff62 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1235,7 +1235,7 @@ if sys.version_info >= (3, 8): filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: Literal[0], - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, *, _feature_version: int = -1, @@ -1246,7 +1246,7 @@ if sys.version_info >= (3, 8): filename: str | ReadableBuffer | _PathLike[Any], mode: str, *, - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, _feature_version: int = -1, ) -> CodeType: ... @@ -1256,7 +1256,7 @@ if sys.version_info >= (3, 8): filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: Literal[1024], - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, *, _feature_version: int = -1, @@ -1267,7 +1267,7 @@ if sys.version_info >= (3, 8): filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: int, - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, *, _feature_version: int = -1, @@ -1280,7 +1280,7 @@ else: filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: Literal[0], - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, ) -> CodeType: ... @overload @@ -1289,7 +1289,7 @@ else: filename: str | ReadableBuffer | _PathLike[Any], mode: str, *, - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, ) -> CodeType: ... @overload @@ -1298,7 +1298,7 @@ else: filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: Literal[1024], - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, ) -> _ast.AST: ... @overload @@ -1307,7 +1307,7 @@ else: filename: str | ReadableBuffer | _PathLike[Any], mode: str, flags: int, - dont_inherit: int = False, + dont_inherit: bool = False, optimize: int = -1, ) -> Any: ... diff --git a/stdlib/quopri.pyi b/stdlib/quopri.pyi index 336f733f6..b652e139b 100644 --- a/stdlib/quopri.pyi +++ b/stdlib/quopri.pyi @@ -5,7 +5,7 @@ __all__ = ["encode", "decode", "encodestring", "decodestring"] class _Input(SupportsRead[bytes], SupportsNoArgReadline[bytes], Protocol): ... -def encode(input: _Input, output: SupportsWrite[bytes], quotetabs: int, header: int = False) -> None: ... -def encodestring(s: ReadableBuffer, quotetabs: int = False, header: int = False) -> bytes: ... -def decode(input: _Input, output: SupportsWrite[bytes], header: int = False) -> None: ... -def decodestring(s: str | ReadableBuffer, header: int = False) -> bytes: ... +def encode(input: _Input, output: SupportsWrite[bytes], quotetabs: int, header: bool = False) -> None: ... +def encodestring(s: ReadableBuffer, quotetabs: bool = False, header: bool = False) -> bytes: ... +def decode(input: _Input, output: SupportsWrite[bytes], header: bool = False) -> None: ... +def decodestring(s: str | ReadableBuffer, header: bool = False) -> bytes: ... diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index fdacf0097..4aab7da1a 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -421,7 +421,7 @@ class Misc: def winfo_viewable(self) -> bool: ... def winfo_visual(self) -> str: ... def winfo_visualid(self) -> str: ... - def winfo_visualsavailable(self, includeids: int = False) -> list[tuple[str, int]]: ... + def winfo_visualsavailable(self, includeids: bool = False) -> list[tuple[str, int]]: ... def winfo_vrootheight(self) -> int: ... def winfo_vrootwidth(self) -> int: ... def winfo_vrootx(self) -> int: ... diff --git a/stdlib/uu.pyi b/stdlib/uu.pyi index 20e79bf3f..324053e04 100644 --- a/stdlib/uu.pyi +++ b/stdlib/uu.pyi @@ -10,4 +10,4 @@ class Error(Exception): ... def encode( in_file: _File, out_file: _File, name: str | None = None, mode: int | None = None, *, backtick: bool = False ) -> None: ... -def decode(in_file: _File, out_file: _File | None = None, mode: int | None = None, quiet: int = False) -> None: ... +def decode(in_file: _File, out_file: _File | None = None, mode: int | None = None, quiet: bool = False) -> None: ...