From ad94ef45911214755e26d98c8659ad5dd3e595b9 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 11 Jan 2023 11:30:17 -0800 Subject: [PATCH 01/16] stdlib: add defaults Ran https://github.com/JelleZijlstra/stubdefaulter on the stdlib --- stdlib/_bisect.pyi | 8 +- stdlib/_curses.pyi | 2 +- stdlib/_decimal.pyi | 4 +- stdlib/_imp.pyi | 2 +- stdlib/_osx_support.pyi | 4 +- stdlib/ast.pyi | 10 +- stdlib/asyncio/format_helpers.pyi | 4 +- stdlib/asyncio/futures.pyi | 2 +- stdlib/asyncio/runners.pyi | 4 +- stdlib/asyncio/staggered.pyi | 2 +- stdlib/asyncio/streams.pyi | 34 +++--- stdlib/asyncio/subprocess.pyi | 48 ++++---- stdlib/asyncio/tasks.pyi | 12 +- stdlib/asyncore.pyi | 8 +- stdlib/base64.pyi | 16 +-- stdlib/binascii.pyi | 10 +- stdlib/builtins.pyi | 20 +-- stdlib/bz2.pyi | 2 +- stdlib/cProfile.pyi | 4 +- stdlib/calendar.pyi | 12 +- stdlib/cgi.pyi | 18 +-- stdlib/cgitb.pyi | 8 +- stdlib/code.pyi | 10 +- stdlib/codecs.pyi | 8 +- stdlib/codeop.pyi | 2 +- stdlib/collections/__init__.pyi | 6 +- stdlib/compileall.pyi | 128 ++++++++++---------- stdlib/concurrent/futures/_base.pyi | 4 +- stdlib/concurrent/futures/process.pyi | 10 +- stdlib/copy.pyi | 2 +- stdlib/copyreg.pyi | 2 +- stdlib/crypt.pyi | 4 +- stdlib/ctypes/__init__.pyi | 4 +- stdlib/dataclasses.pyi | 56 ++++----- stdlib/dbm/__init__.pyi | 2 +- stdlib/dbm/dumb.pyi | 2 +- stdlib/difflib.pyi | 30 ++--- stdlib/dis.pyi | 30 ++--- stdlib/distutils/archive_util.pyi | 24 ++-- stdlib/distutils/ccompiler.pyi | 4 +- stdlib/distutils/command/config.pyi | 2 +- stdlib/distutils/core.pyi | 2 +- stdlib/distutils/dep_util.pyi | 2 +- stdlib/distutils/dir_util.pyi | 18 +-- stdlib/distutils/file_util.pyi | 14 +-- stdlib/distutils/filelist.pyi | 2 +- stdlib/distutils/spawn.pyi | 4 +- stdlib/distutils/sysconfig.pyi | 4 +- stdlib/distutils/util.pyi | 16 +-- stdlib/doctest.pyi | 62 +++++----- stdlib/email/base64mime.pyi | 4 +- stdlib/email/charset.pyi | 2 +- stdlib/email/header.pyi | 6 +- stdlib/email/iterators.pyi | 6 +- stdlib/email/quoprimime.pyi | 6 +- stdlib/email/utils.pyi | 14 +-- stdlib/encodings/utf_8.pyi | 2 +- stdlib/encodings/utf_8_sig.pyi | 4 +- stdlib/ensurepip/__init__.pyi | 12 +- stdlib/enum.pyi | 2 +- stdlib/filecmp.pyi | 4 +- stdlib/fileinput.pyi | 4 +- stdlib/ftplib.pyi | 2 +- stdlib/functools.pyi | 2 +- stdlib/gc.pyi | 4 +- stdlib/getpass.pyi | 2 +- stdlib/gettext.pyi | 8 +- stdlib/glob.pyi | 24 ++-- stdlib/gzip.pyi | 4 +- stdlib/hashlib.pyi | 28 ++--- stdlib/heapq.pyi | 6 +- stdlib/hmac.pyi | 2 +- stdlib/html/__init__.pyi | 2 +- stdlib/imp.pyi | 10 +- stdlib/importlib/__init__.pyi | 10 +- stdlib/importlib/resources.pyi | 4 +- stdlib/importlib/util.pyi | 10 +- stdlib/inspect.pyi | 40 +++--- stdlib/ipaddress.pyi | 2 +- stdlib/json/__init__.pyi | 60 ++++----- stdlib/lib2to3/pgen2/driver.pyi | 2 +- stdlib/lib2to3/pgen2/pgen.pyi | 2 +- stdlib/lib2to3/refactor.pyi | 2 +- stdlib/linecache.pyi | 8 +- stdlib/locale.pyi | 14 +-- stdlib/logging/__init__.pyi | 8 +- stdlib/logging/config.pyi | 12 +- stdlib/lzma.pyi | 4 +- stdlib/mailcap.pyi | 2 +- stdlib/mimetypes.pyi | 12 +- stdlib/multiprocessing/connection.pyi | 6 +- stdlib/multiprocessing/dummy/__init__.pyi | 4 +- stdlib/multiprocessing/dummy/connection.pyi | 2 +- stdlib/multiprocessing/forkserver.pyi | 4 +- stdlib/multiprocessing/reduction.pyi | 2 +- stdlib/multiprocessing/resource_sharer.pyi | 2 +- stdlib/multiprocessing/spawn.pyi | 2 +- stdlib/multiprocessing/util.pyi | 2 +- stdlib/opcode.pyi | 2 +- stdlib/os/__init__.pyi | 50 ++++---- stdlib/pdb.pyi | 8 +- stdlib/pickle.pyi | 28 ++--- stdlib/pickletools.pyi | 10 +- stdlib/pkgutil.pyi | 6 +- stdlib/platform.pyi | 14 +-- stdlib/plistlib.pyi | 16 +-- stdlib/pprint.pyi | 64 +++++----- stdlib/profile.pyi | 4 +- stdlib/py_compile.pyi | 18 +-- stdlib/pyclbr.pyi | 4 +- stdlib/pydoc.pyi | 16 +-- stdlib/quopri.pyi | 8 +- stdlib/re.pyi | 2 +- stdlib/reprlib.pyi | 2 +- stdlib/runpy.pyi | 4 +- stdlib/secrets.pyi | 6 +- stdlib/shelve.pyi | 2 +- stdlib/shlex.pyi | 2 +- stdlib/shutil.pyi | 40 +++--- stdlib/site.pyi | 6 +- stdlib/socket.pyi | 26 ++-- stdlib/sre_compile.pyi | 2 +- stdlib/sre_parse.pyi | 4 +- stdlib/ssl.pyi | 44 +++---- stdlib/statistics.pyi | 16 +-- stdlib/string.pyi | 2 +- stdlib/struct.pyi | 2 +- stdlib/subprocess.pyi | 12 +- stdlib/sysconfig.pyi | 8 +- stdlib/tarfile.pyi | 8 +- stdlib/tempfile.pyi | 2 +- stdlib/textwrap.pyi | 6 +- stdlib/timeit.pyi | 14 +-- stdlib/traceback.pyi | 30 ++--- stdlib/tty.pyi | 4 +- stdlib/types.pyi | 6 +- stdlib/typing.pyi | 14 +-- stdlib/typing_extensions.pyi | 12 +- stdlib/unittest/loader.pyi | 6 +- stdlib/unittest/mock.pyi | 14 +-- stdlib/unittest/util.pyi | 2 +- stdlib/urllib/parse.pyi | 42 +++---- stdlib/urllib/request.pyi | 16 +-- stdlib/uu.pyi | 4 +- stdlib/uuid.pyi | 2 +- stdlib/venv/__init__.pyi | 24 ++-- stdlib/warnings.pyi | 14 +-- stdlib/webbrowser.pyi | 6 +- stdlib/wsgiref/util.pyi | 2 +- stdlib/xml/dom/domreg.pyi | 2 +- stdlib/xml/dom/expatbuilder.pyi | 8 +- stdlib/xml/dom/minidom.pyi | 6 +- stdlib/xml/dom/pulldom.pyi | 4 +- stdlib/xml/etree/ElementInclude.pyi | 6 +- stdlib/xml/etree/ElementPath.pyi | 10 +- stdlib/xml/etree/ElementTree.pyi | 16 +-- stdlib/xml/sax/saxutils.pyi | 2 +- stdlib/xmlrpc/client.pyi | 14 +-- stdlib/xmlrpc/server.pyi | 2 +- stdlib/zipapp.pyi | 10 +- stdlib/zlib.pyi | 16 +-- stdlib/zoneinfo/__init__.pyi | 2 +- 162 files changed, 909 insertions(+), 909 deletions(-) diff --git a/stdlib/_bisect.pyi b/stdlib/_bisect.pyi index d902e1eea7d4..21323ab5a7af 100644 --- a/stdlib/_bisect.pyi +++ b/stdlib/_bisect.pyi @@ -61,14 +61,14 @@ if sys.version_info >= (3, 10): else: def bisect_left( - a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None ) -> int: ... def bisect_right( - a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None ) -> int: ... def insort_left( - a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None ) -> None: ... def insort_right( - a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... + a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None ) -> None: ... diff --git a/stdlib/_curses.pyi b/stdlib/_curses.pyi index 7053e85f7b7f..1faebfbe2011 100644 --- a/stdlib/_curses.pyi +++ b/stdlib/_curses.pyi @@ -345,7 +345,7 @@ if sys.platform != "win32": def set_tabsize(__size: int) -> None: ... def setsyx(__y: int, __x: int) -> None: ... - def setupterm(term: str | None = ..., fd: int = ...) -> None: ... + def setupterm(term: str | None = None, fd: int = ...) -> None: ... def start_color() -> None: ... def termattrs() -> int: ... def termname() -> bytes: ... diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index ca97f69e2147..b3f9d93d59f0 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -53,7 +53,7 @@ def getcontext() -> Context: ... if sys.version_info >= (3, 11): def localcontext( - ctx: Context | None = ..., + ctx: Context | None = None, *, prec: int | None = ..., rounding: str | None = ..., @@ -66,7 +66,7 @@ if sys.version_info >= (3, 11): ) -> _ContextManager: ... else: - def localcontext(ctx: Context | None = ...) -> _ContextManager: ... + def localcontext(ctx: Context | None = None) -> _ContextManager: ... class Decimal: def __new__(cls: type[Self], value: _DecimalNew = ..., context: Context | None = ...) -> Self: ... diff --git a/stdlib/_imp.pyi b/stdlib/_imp.pyi index 2b54a0f6fb42..d5d7ce9a9045 100644 --- a/stdlib/_imp.pyi +++ b/stdlib/_imp.pyi @@ -21,7 +21,7 @@ def lock_held() -> bool: ... def release_lock() -> None: ... if sys.version_info >= (3, 11): - def find_frozen(__name: str, *, withdata: bool = ...) -> tuple[memoryview | None, bool, str | None] | None: ... + def find_frozen(__name: str, *, withdata: bool = False) -> tuple[memoryview | None, bool, str | None] | None: ... def get_frozen_object(__name: str, __data: ReadableBuffer | None = ...) -> types.CodeType: ... else: diff --git a/stdlib/_osx_support.pyi b/stdlib/_osx_support.pyi index 7fd0ee922ca6..3eb6f4ddc67c 100644 --- a/stdlib/_osx_support.pyi +++ b/stdlib/_osx_support.pyi @@ -12,10 +12,10 @@ _UNIVERSAL_CONFIG_VARS: tuple[str, ...] # undocumented _COMPILER_CONFIG_VARS: tuple[str, ...] # undocumented _INITPRE: str # undocumented -def _find_executable(executable: str, path: str | None = ...) -> str | None: ... # undocumented +def _find_executable(executable: str, path: str | None = None) -> str | None: ... # undocumented if sys.version_info >= (3, 8): - def _read_output(commandstring: str, capture_stderr: bool = ...) -> str | None: ... # undocumented + def _read_output(commandstring: str, capture_stderr: bool = False) -> str | None: ... # undocumented else: def _read_output(commandstring: str) -> str | None: ... # undocumented diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 9a5bf0a623fb..04fa515f73f3 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -268,21 +268,21 @@ def copy_location(new_node: _T, old_node: AST) -> _T: ... if sys.version_info >= (3, 9): def dump( - node: AST, annotate_fields: bool = ..., include_attributes: bool = ..., *, indent: int | str | None = ... + node: AST, annotate_fields: bool = True, include_attributes: bool = False, *, indent: int | str | None = None ) -> str: ... else: - def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ... + def dump(node: AST, annotate_fields: bool = True, include_attributes: bool = False) -> str: ... def fix_missing_locations(node: _T) -> _T: ... -def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = ...) -> str | None: ... -def increment_lineno(node: _T, n: int = ...) -> _T: ... +def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = True) -> str | None: ... +def increment_lineno(node: _T, n: int = 1) -> _T: ... def iter_child_nodes(node: AST) -> Iterator[AST]: ... def iter_fields(node: AST) -> Iterator[tuple[str, Any]]: ... def literal_eval(node_or_string: str | AST) -> Any: ... if sys.version_info >= (3, 8): - def get_source_segment(source: str, node: AST, *, padded: bool = ...) -> str | None: ... + def get_source_segment(source: str, node: AST, *, padded: bool = False) -> str | None: ... def walk(node: AST) -> Iterator[AST]: ... diff --git a/stdlib/asyncio/format_helpers.pyi b/stdlib/asyncio/format_helpers.pyi index 4e2ef8d3f274..053f0500558e 100644 --- a/stdlib/asyncio/format_helpers.pyi +++ b/stdlib/asyncio/format_helpers.pyi @@ -16,5 +16,5 @@ def _get_function_source(func: _FuncType) -> tuple[str, int]: ... def _get_function_source(func: object) -> tuple[str, int] | None: ... def _format_callback_source(func: object, args: Iterable[Any]) -> str: ... def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ... -def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = ...) -> str: ... -def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> traceback.StackSummary: ... +def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = '') -> str: ... +def extract_stack(f: FrameType | None = None, limit: int | None = None) -> traceback.StackSummary: ... diff --git a/stdlib/asyncio/futures.pyi b/stdlib/asyncio/futures.pyi index f917bd5dee98..3040280e9c45 100644 --- a/stdlib/asyncio/futures.pyi +++ b/stdlib/asyncio/futures.pyi @@ -64,4 +64,4 @@ class Future(Awaitable[_T], Iterable[_T]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... +def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = None) -> Future[_T]: ... diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 74ed83ed8dc4..8a6989449188 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -29,7 +29,7 @@ if sys.version_info >= (3, 12): ) -> _T: ... elif sys.version_info >= (3, 8): - def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = ...) -> _T: ... + def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = None) -> _T: ... else: - def run(main: Coroutine[Any, Any, _T], *, debug: bool = ...) -> _T: ... + def run(main: Coroutine[Any, Any, _T], *, debug: bool = None) -> _T: ... diff --git a/stdlib/asyncio/staggered.pyi b/stdlib/asyncio/staggered.pyi index 610d6f70b614..3324777f4168 100644 --- a/stdlib/asyncio/staggered.pyi +++ b/stdlib/asyncio/staggered.pyi @@ -6,5 +6,5 @@ from . import events __all__ = ("staggered_race",) async def staggered_race( - coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = ... + coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = None ) -> tuple[Any, int | None, list[Exception | None]]: ... diff --git a/stdlib/asyncio/streams.pyi b/stdlib/asyncio/streams.pyi index 00d95d93f2ff..c5a5ca070377 100644 --- a/stdlib/asyncio/streams.pyi +++ b/stdlib/asyncio/streams.pyi @@ -59,40 +59,40 @@ if sys.version_info < (3, 8): if sys.version_info >= (3, 10): async def open_connection( - host: str | None = ..., - port: int | str | None = ..., + host: str | None = None, + port: int | str | None = None, *, - limit: int = ..., + limit: int = 65536, ssl_handshake_timeout: float | None = ..., **kwds: Any, ) -> tuple[StreamReader, StreamWriter]: ... async def start_server( client_connected_cb: _ClientConnectedCallback, - host: str | Sequence[str] | None = ..., - port: int | str | None = ..., + host: str | Sequence[str] | None = None, + port: int | str | None = None, *, - limit: int = ..., + limit: int = 65536, ssl_handshake_timeout: float | None = ..., **kwds: Any, ) -> Server: ... else: async def open_connection( - host: str | None = ..., - port: int | str | None = ..., + host: str | None = None, + port: int | str | None = None, *, loop: events.AbstractEventLoop | None = ..., - limit: int = ..., + limit: int = 65536, ssl_handshake_timeout: float | None = ..., **kwds: Any, ) -> tuple[StreamReader, StreamWriter]: ... async def start_server( client_connected_cb: _ClientConnectedCallback, - host: str | None = ..., - port: int | str | None = ..., + host: str | None = None, + port: int | str | None = None, *, loop: events.AbstractEventLoop | None = ..., - limit: int = ..., + limit: int = 65536, ssl_handshake_timeout: float | None = ..., **kwds: Any, ) -> Server: ... @@ -100,21 +100,21 @@ else: if sys.platform != "win32": if sys.version_info >= (3, 10): async def open_unix_connection( - path: StrPath | None = ..., *, limit: int = ..., **kwds: Any + path: StrPath | None = None, *, limit: int = 65536, **kwds: Any ) -> tuple[StreamReader, StreamWriter]: ... async def start_unix_server( - client_connected_cb: _ClientConnectedCallback, path: StrPath | None = ..., *, limit: int = ..., **kwds: Any + client_connected_cb: _ClientConnectedCallback, path: StrPath | None = None, *, limit: int = 65536, **kwds: Any ) -> Server: ... else: async def open_unix_connection( - path: StrPath | None = ..., *, loop: events.AbstractEventLoop | None = ..., limit: int = ..., **kwds: Any + path: StrPath | None = None, *, loop: events.AbstractEventLoop | None = ..., limit: int = 65536, **kwds: Any ) -> tuple[StreamReader, StreamWriter]: ... async def start_unix_server( client_connected_cb: _ClientConnectedCallback, - path: StrPath | None = ..., + path: StrPath | None = None, *, loop: events.AbstractEventLoop | None = ..., - limit: int = ..., + limit: int = 65536, **kwds: Any, ) -> Server: ... diff --git a/stdlib/asyncio/subprocess.pyi b/stdlib/asyncio/subprocess.pyi index d483f57551b0..f70ea46b3660 100644 --- a/stdlib/asyncio/subprocess.pyi +++ b/stdlib/asyncio/subprocess.pyi @@ -43,10 +43,10 @@ class Process: if sys.version_info >= (3, 11): async def create_subprocess_shell( cmd: str | bytes, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., - limit: int = ..., + stdin: int | IO[Any] | None = None, + stdout: int | IO[Any] | None = None, + stderr: int | IO[Any] | None = None, + limit: int = 65536, *, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., @@ -76,10 +76,10 @@ if sys.version_info >= (3, 11): async def create_subprocess_exec( program: _ExecArg, *args: _ExecArg, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., - limit: int = ..., + stdin: int | IO[Any] | None = None, + stdout: int | IO[Any] | None = None, + stderr: int | IO[Any] | None = None, + limit: int = 65536, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., shell: Literal[True] = ..., @@ -109,10 +109,10 @@ if sys.version_info >= (3, 11): elif sys.version_info >= (3, 10): async def create_subprocess_shell( cmd: str | bytes, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., - limit: int = ..., + stdin: int | IO[Any] | None = None, + stdout: int | IO[Any] | None = None, + stderr: int | IO[Any] | None = None, + limit: int = 65536, *, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., @@ -141,10 +141,10 @@ elif sys.version_info >= (3, 10): async def create_subprocess_exec( program: _ExecArg, *args: _ExecArg, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., - limit: int = ..., + stdin: int | IO[Any] | None = None, + stdout: int | IO[Any] | None = None, + stderr: int | IO[Any] | None = None, + limit: int = 65536, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., shell: Literal[True] = ..., @@ -173,11 +173,11 @@ elif sys.version_info >= (3, 10): else: # >= 3.9 async def create_subprocess_shell( cmd: str | bytes, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., + stdin: int | IO[Any] | None = None, + stdout: int | IO[Any] | None = None, + stderr: int | IO[Any] | None = None, loop: events.AbstractEventLoop | None = ..., - limit: int = ..., + limit: int = 65536, *, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., @@ -205,11 +205,11 @@ else: # >= 3.9 async def create_subprocess_exec( program: _ExecArg, *args: _ExecArg, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., + stdin: int | IO[Any] | None = None, + stdout: int | IO[Any] | None = None, + stderr: int | IO[Any] | None = None, loop: events.AbstractEventLoop | None = ..., - limit: int = ..., + limit: int = 65536, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., shell: Literal[True] = ..., diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index 43dd020fa99d..25c764eb2389 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -51,11 +51,11 @@ FIRST_EXCEPTION = concurrent.futures.FIRST_EXCEPTION ALL_COMPLETED = concurrent.futures.ALL_COMPLETED if sys.version_info >= (3, 10): - def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = ...) -> Iterator[Future[_T]]: ... + def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = None) -> Iterator[Future[_T]]: ... else: def as_completed( - fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ... + fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = None ) -> Iterator[Future[_T]]: ... @overload @@ -301,20 +301,20 @@ class Task(Future[_T_co], Generic[_T_co]): # type: ignore[type-var] # pyright: if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -def all_tasks(loop: AbstractEventLoop | None = ...) -> set[Task[Any]]: ... +def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ... if sys.version_info >= (3, 11): def create_task( - coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ..., context: Context | None = ... + coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = None, context: Context | None = None ) -> Task[_T]: ... elif sys.version_info >= (3, 8): - def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ...) -> Task[_T]: ... + def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = None) -> Task[_T]: ... else: def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T]) -> Task[_T]: ... -def current_task(loop: AbstractEventLoop | None = ...) -> Task[Any] | None: ... +def current_task(loop: AbstractEventLoop | None = None) -> Task[Any] | None: ... def _enter_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ... def _leave_task(loop: AbstractEventLoop, task: Task[Any]) -> None: ... def _register_task(task: Task[Any]) -> None: ... diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index 565deb4d1cad..22f6ea4ac887 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -15,12 +15,12 @@ class ExitNow(Exception): ... def read(obj: Any) -> None: ... def write(obj: Any) -> None: ... def readwrite(obj: Any, flags: int) -> None: ... -def poll(timeout: float = ..., map: _MapType | None = ...) -> None: ... -def poll2(timeout: float = ..., map: _MapType | None = ...) -> None: ... +def poll(timeout: float = ..., map: _MapType | None = None) -> None: ... +def poll2(timeout: float = ..., map: _MapType | None = None) -> None: ... poll3 = poll2 -def loop(timeout: float = ..., use_poll: bool = ..., map: _MapType | None = ..., count: int | None = ...) -> None: ... +def loop(timeout: float = ..., use_poll: bool = False, map: _MapType | None = None, count: int | None = None) -> None: ... # Not really subclass of socket.socket; it's only delegation. # It is not covariant to it. @@ -68,7 +68,7 @@ class dispatcher_with_send(dispatcher): # def send(self, data: bytes) -> int | None: ... def compact_traceback() -> tuple[tuple[str, str, str], type, type, str]: ... -def close_all(map: _MapType | None = ..., ignore_all: bool = ...) -> None: ... +def close_all(map: _MapType | None = None, ignore_all: bool = False) -> None: ... if sys.platform != "win32": class file_wrapper: diff --git a/stdlib/base64.pyi b/stdlib/base64.pyi index 816622eeb071..e60ac754ef51 100644 --- a/stdlib/base64.pyi +++ b/stdlib/base64.pyi @@ -26,26 +26,26 @@ __all__ = [ if sys.version_info >= (3, 10): __all__ += ["b32hexencode", "b32hexdecode"] -def b64encode(s: ReadableBuffer, altchars: ReadableBuffer | None = ...) -> bytes: ... -def b64decode(s: str | ReadableBuffer, altchars: ReadableBuffer | None = ..., validate: bool = ...) -> bytes: ... +def b64encode(s: ReadableBuffer, altchars: ReadableBuffer | None = None) -> bytes: ... +def b64decode(s: str | ReadableBuffer, altchars: ReadableBuffer | None = None, validate: bool = False) -> bytes: ... def standard_b64encode(s: ReadableBuffer) -> bytes: ... def standard_b64decode(s: str | ReadableBuffer) -> bytes: ... def urlsafe_b64encode(s: ReadableBuffer) -> bytes: ... def urlsafe_b64decode(s: str | ReadableBuffer) -> bytes: ... def b32encode(s: ReadableBuffer) -> bytes: ... -def b32decode(s: str | ReadableBuffer, casefold: bool = ..., map01: bytes | None = ...) -> bytes: ... +def b32decode(s: str | ReadableBuffer, casefold: bool = False, map01: bytes | None = None) -> bytes: ... def b16encode(s: ReadableBuffer) -> bytes: ... -def b16decode(s: str | ReadableBuffer, casefold: bool = ...) -> bytes: ... +def b16decode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: ... if sys.version_info >= (3, 10): def b32hexencode(s: ReadableBuffer) -> bytes: ... - def b32hexdecode(s: str | ReadableBuffer, casefold: bool = ...) -> bytes: ... + def b32hexdecode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: ... -def a85encode(b: ReadableBuffer, *, foldspaces: bool = ..., wrapcol: int = ..., pad: bool = ..., adobe: bool = ...) -> bytes: ... +def a85encode(b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False) -> bytes: ... def a85decode( - b: str | ReadableBuffer, *, foldspaces: bool = ..., adobe: bool = ..., ignorechars: bytearray | bytes = ... + b: str | ReadableBuffer, *, foldspaces: bool = False, adobe: bool = False, ignorechars: bytearray | bytes = ... ) -> bytes: ... -def b85encode(b: ReadableBuffer, pad: bool = ...) -> bytes: ... +def b85encode(b: ReadableBuffer, pad: bool = False) -> bytes: ... def b85decode(b: str | ReadableBuffer) -> bytes: ... def decode(input: IO[bytes], output: IO[bytes]) -> None: ... def encode(input: IO[bytes], output: IO[bytes]) -> None: ... diff --git a/stdlib/binascii.pyi b/stdlib/binascii.pyi index 6f834f7868c3..aad7b42c76ac 100644 --- a/stdlib/binascii.pyi +++ b/stdlib/binascii.pyi @@ -7,17 +7,17 @@ from typing_extensions import TypeAlias _AsciiBuffer: TypeAlias = str | ReadableBuffer def a2b_uu(__data: _AsciiBuffer) -> bytes: ... -def b2a_uu(__data: ReadableBuffer, *, backtick: bool = ...) -> bytes: ... +def b2a_uu(__data: ReadableBuffer, *, backtick: bool = False) -> bytes: ... if sys.version_info >= (3, 11): - def a2b_base64(__data: _AsciiBuffer, *, strict_mode: bool = ...) -> bytes: ... + def a2b_base64(__data: _AsciiBuffer, *, strict_mode: bool = False) -> bytes: ... else: def a2b_base64(__data: _AsciiBuffer) -> bytes: ... -def b2a_base64(__data: ReadableBuffer, *, newline: bool = ...) -> bytes: ... -def a2b_qp(data: _AsciiBuffer, header: bool = ...) -> bytes: ... -def b2a_qp(data: ReadableBuffer, quotetabs: bool = ..., istext: bool = ..., header: bool = ...) -> bytes: ... +def b2a_base64(__data: ReadableBuffer, *, newline: bool = True) -> bytes: ... +def a2b_qp(data: _AsciiBuffer, header: bool = False) -> bytes: ... +def b2a_qp(data: ReadableBuffer, quotetabs: bool = False, istext: bool = True, header: bool = False) -> bytes: ... if sys.version_info < (3, 11): def a2b_hqx(__data: _AsciiBuffer) -> bytes: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 40865cc78e3d..b86e807695a8 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1226,8 +1226,8 @@ if sys.version_info >= (3, 8): source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive, filename: str | ReadableBuffer | _PathLike[Any], mode: str, - flags: int = ..., - dont_inherit: int = ..., + flags: int = 0, + dont_inherit: int = False, optimize: int = ..., *, _feature_version: int = ..., @@ -1238,8 +1238,8 @@ else: source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive, filename: str | ReadableBuffer | _PathLike[Any], mode: str, - flags: int = ..., - dont_inherit: int = ..., + flags: int = 0, + dont_inherit: int = False, optimize: int = ..., ) -> Any: ... @@ -1265,7 +1265,7 @@ if sys.version_info >= (3, 11): __globals: dict[str, Any] | None = ..., __locals: Mapping[str, object] | None = ..., *, - closure: tuple[_Cell, ...] | None = ..., + closure: tuple[_Cell, ...] | None = None, ) -> None: ... else: @@ -1275,7 +1275,7 @@ else: __locals: Mapping[str, object] | None = ..., ) -> None: ... -def exit(code: sys._ExitCode = ...) -> NoReturn: ... +def exit(code: sys._ExitCode = None) -> NoReturn: ... class filter(Iterator[_T], Generic[_T]): @overload @@ -1606,7 +1606,7 @@ else: @overload def pow(__base: _SupportsSomeKindOfPow, __exp: complex, __mod: None = ...) -> complex: ... -def quit(code: sys._ExitCode = ...) -> NoReturn: ... +def quit(code: sys._ExitCode = None) -> NoReturn: ... class reversed(Iterator[_T], Generic[_T]): @overload @@ -1764,10 +1764,10 @@ class zip(Iterator[_T_co], Generic[_T_co]): # Return type of `__import__` should be kept the same as return type of `importlib.import_module` def __import__( name: str, - globals: Mapping[str, object] | None = ..., - locals: Mapping[str, object] | None = ..., + globals: Mapping[str, object] | None = None, + locals: Mapping[str, object] | None = None, fromlist: Sequence[str] = ..., - level: int = ..., + level: int = 0, ) -> types.ModuleType: ... def __build_class__(__func: Callable[[], _Cell | Any], __name: str, *bases: Any, metaclass: Any = ..., **kwds: Any) -> Any: ... diff --git a/stdlib/bz2.pyi b/stdlib/bz2.pyi index 295271d4a80b..7fbca226aedc 100644 --- a/stdlib/bz2.pyi +++ b/stdlib/bz2.pyi @@ -19,7 +19,7 @@ class _WritableFileobj(Protocol): # def fileno(self) -> int: ... # def close(self) -> object: ... -def compress(data: ReadableBuffer, compresslevel: int = ...) -> bytes: ... +def compress(data: ReadableBuffer, compresslevel: int = 9) -> bytes: ... def decompress(data: ReadableBuffer) -> bytes: ... _ReadBinaryMode: TypeAlias = Literal["", "r", "rb"] diff --git a/stdlib/cProfile.pyi b/stdlib/cProfile.pyi index 6e21fc92ade5..3ba3205d3e13 100644 --- a/stdlib/cProfile.pyi +++ b/stdlib/cProfile.pyi @@ -7,9 +7,9 @@ from typing_extensions import ParamSpec, TypeAlias __all__ = ["run", "runctx", "Profile"] -def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... +def run(statement: str, filename: str | None = None, sort: str | int = ...) -> None: ... def runctx( - statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = None, sort: str | int = ... ) -> None: ... _T = TypeVar("_T") diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 74b8d39caf79..cde7a3bc52e3 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -83,10 +83,10 @@ def monthcalendar(year: int, month: int) -> list[list[int]]: ... def prweek(theweek: int, width: int) -> None: ... def week(theweek: int, width: int) -> str: ... def weekheader(width: int) -> str: ... -def prmonth(theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ... -def month(theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ... -def calendar(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ... -def prcal(theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ... +def prmonth(theyear: int, themonth: int, w: int = 0, l: int = 0) -> None: ... +def month(theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: ... +def calendar(theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ... +def prcal(theyear: int, w: int = 0, l: int = 0, c: int = 6, m: int = 3) -> None: ... class HTMLCalendar(Calendar): cssclasses: ClassVar[list[str]] @@ -121,8 +121,8 @@ class LocaleHTMLCalendar(HTMLCalendar): c: TextCalendar def setfirstweekday(firstweekday: int) -> None: ... -def format(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... -def formatstring(cols: int, colwidth: int = ..., spacing: int = ...) -> str: ... +def format(cols: int, colwidth: int = 20, spacing: int = 6) -> str: ... +def formatstring(cols: int, colwidth: int = 20, spacing: int = 6) -> str: ... def timegm(tuple: tuple[int, ...] | struct_time) -> int: ... # Data attributes diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index ce9a15415aab..dd2e2c87353b 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -25,11 +25,11 @@ if sys.version_info < (3, 8): __all__ += ["parse_qs", "parse_qsl", "escape"] def parse( - fp: IO[Any] | None = ..., + fp: IO[Any] | None = None, environ: SupportsItemAccess[str, str] = ..., - keep_blank_values: bool = ..., - strict_parsing: bool = ..., - separator: str = ..., + keep_blank_values: bool = 0, + strict_parsing: bool = 0, + separator: str = '&', ) -> dict[str, list[str]]: ... if sys.version_info < (3, 8): @@ -37,7 +37,7 @@ if sys.version_info < (3, 8): def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ... def parse_multipart( - fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = ..., errors: str = ..., separator: str = ... + fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = 'utf-8', errors: str = 'replace', separator: str = '&' ) -> dict[str, list[Any]]: ... class _Environ(Protocol): @@ -120,9 +120,9 @@ class FieldStorage: def make_file(self) -> IO[Any]: ... def print_exception( - type: type[BaseException] | None = ..., - value: BaseException | None = ..., - tb: TracebackType | None = ..., - limit: int | None = ..., + type: type[BaseException] | None = None, + value: BaseException | None = None, + tb: TracebackType | None = None, + limit: int | None = None, ) -> None: ... def print_arguments() -> None: ... diff --git a/stdlib/cgitb.pyi b/stdlib/cgitb.pyi index ea5a8341bc5e..d421cf5da654 100644 --- a/stdlib/cgitb.pyi +++ b/stdlib/cgitb.pyi @@ -13,8 +13,8 @@ def lookup(name: str, frame: FrameType, locals: dict[str, Any]) -> tuple[str | N def scanvars( reader: Callable[[], bytes], frame: FrameType, locals: dict[str, Any] ) -> list[tuple[str, str | None, Any]]: ... # undocumented -def html(einfo: OptExcInfo, context: int = ...) -> str: ... -def text(einfo: OptExcInfo, context: int = ...) -> str: ... +def html(einfo: OptExcInfo, context: int = 5) -> str: ... +def text(einfo: OptExcInfo, context: int = 5) -> str: ... class Hook: # undocumented def __init__( @@ -28,5 +28,5 @@ class Hook: # undocumented def __call__(self, etype: type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... def handle(self, info: OptExcInfo | None = ...) -> None: ... -def handler(info: OptExcInfo | None = ...) -> None: ... -def enable(display: int = ..., logdir: StrOrBytesPath | None = ..., context: int = ..., format: str = ...) -> None: ... +def handler(info: OptExcInfo | None = None) -> None: ... +def enable(display: int = 1, logdir: StrOrBytesPath | None = None, context: int = 5, format: str = 'html') -> None: ... diff --git a/stdlib/code.pyi b/stdlib/code.pyi index 59318aa353e2..9dee9857e408 100644 --- a/stdlib/code.pyi +++ b/stdlib/code.pyi @@ -25,9 +25,9 @@ class InteractiveConsole(InteractiveInterpreter): def raw_input(self, prompt: str = ...) -> str: ... def interact( - banner: str | None = ..., - readfunc: Callable[[str], str] | None = ..., - local: Mapping[str, Any] | None = ..., - exitmsg: str | None = ..., + banner: str | None = None, + readfunc: Callable[[str], str] | None = None, + local: Mapping[str, Any] | None = None, + exitmsg: str | None = None, ) -> None: ... -def compile_command(source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... +def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index cd6ac0006c53..ee4914dee8fa 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -128,11 +128,11 @@ def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ... def getreader(encoding: str) -> _StreamReader: ... def getwriter(encoding: str) -> _StreamWriter: ... def open( - filename: str, mode: str = ..., encoding: str | None = ..., errors: str = ..., buffering: int = ... + filename: str, mode: str = 'r', encoding: str | None = None, errors: str = 'strict', buffering: int = ... ) -> StreamReaderWriter: ... -def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = ..., errors: str = ...) -> StreamRecoder: ... -def iterencode(iterator: Iterable[str], encoding: str, errors: str = ...) -> Generator[bytes, None, None]: ... -def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = ...) -> Generator[str, None, None]: ... +def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = 'strict') -> StreamRecoder: ... +def iterencode(iterator: Iterable[str], encoding: str, errors: str = 'strict') -> Generator[bytes, None, None]: ... +def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = 'strict') -> Generator[str, None, None]: ... BOM: Literal[b"\xff\xfe", b"\xfe\xff"] # depends on `sys.byteorder` BOM_BE: Literal[b"\xfe\xff"] diff --git a/stdlib/codeop.pyi b/stdlib/codeop.pyi index 36af1d297548..cf04beb98ddb 100644 --- a/stdlib/codeop.pyi +++ b/stdlib/codeop.pyi @@ -2,7 +2,7 @@ from types import CodeType __all__ = ["compile_command", "Compile", "CommandCompiler"] -def compile_command(source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... +def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... class Compile: flags: int diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 2955aa3b3cd0..79eb17a4c31e 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -40,9 +40,9 @@ def namedtuple( typename: str, field_names: str | Iterable[str], *, - rename: bool = ..., - module: str | None = ..., - defaults: Iterable[Any] | None = ..., + rename: bool = False, + module: str | None = None, + defaults: Iterable[Any] | None = None, ) -> type[tuple[Any, ...]]: ... class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): diff --git a/stdlib/compileall.pyi b/stdlib/compileall.pyi index 4621500eda96..5ad2dd2dc2a7 100644 --- a/stdlib/compileall.pyi +++ b/stdlib/compileall.pyi @@ -11,101 +11,101 @@ class _SupportsSearch(Protocol): if sys.version_info >= (3, 10): def compile_dir( dir: StrPath, - maxlevels: int | None = ..., - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., + maxlevels: int | None = None, + ddir: StrPath | None = None, + force: bool = False, + rx: _SupportsSearch | None = None, + quiet: int = 0, + legacy: bool = False, optimize: int = ..., - workers: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + workers: int = 1, + invalidation_mode: PycInvalidationMode | None = None, *, - stripdir: StrPath | None = ..., - prependdir: StrPath | None = ..., - limit_sl_dest: StrPath | None = ..., - hardlink_dupes: bool = ..., + stripdir: StrPath | None = None, + prependdir: StrPath | None = None, + limit_sl_dest: StrPath | None = None, + hardlink_dupes: bool = False, ) -> int: ... def compile_file( fullname: StrPath, - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., + ddir: StrPath | None = None, + force: bool = False, + rx: _SupportsSearch | None = None, + quiet: int = 0, + legacy: bool = False, optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + invalidation_mode: PycInvalidationMode | None = None, *, - stripdir: StrPath | None = ..., - prependdir: StrPath | None = ..., - limit_sl_dest: StrPath | None = ..., - hardlink_dupes: bool = ..., + stripdir: StrPath | None = None, + prependdir: StrPath | None = None, + limit_sl_dest: StrPath | None = None, + hardlink_dupes: bool = False, ) -> int: ... elif sys.version_info >= (3, 9): def compile_dir( dir: StrPath, - maxlevels: int | None = ..., - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., + maxlevels: int | None = None, + ddir: StrPath | None = None, + force: bool = False, + rx: _SupportsSearch | None = None, + quiet: int = 0, + legacy: bool = False, optimize: int = ..., - workers: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + workers: int = 1, + invalidation_mode: PycInvalidationMode | None = None, *, - stripdir: str | None = ..., # https://bugs.python.org/issue40447 - prependdir: StrPath | None = ..., - limit_sl_dest: StrPath | None = ..., - hardlink_dupes: bool = ..., + stripdir: str | None = None, # https://bugs.python.org/issue40447 + prependdir: StrPath | None = None, + limit_sl_dest: StrPath | None = None, + hardlink_dupes: bool = False, ) -> int: ... def compile_file( fullname: StrPath, - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., + ddir: StrPath | None = None, + force: bool = False, + rx: _SupportsSearch | None = None, + quiet: int = 0, + legacy: bool = False, optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + invalidation_mode: PycInvalidationMode | None = None, *, - stripdir: str | None = ..., # https://bugs.python.org/issue40447 - prependdir: StrPath | None = ..., - limit_sl_dest: StrPath | None = ..., - hardlink_dupes: bool = ..., + stripdir: str | None = None, # https://bugs.python.org/issue40447 + prependdir: StrPath | None = None, + limit_sl_dest: StrPath | None = None, + hardlink_dupes: bool = False, ) -> int: ... else: def compile_dir( dir: StrPath, - maxlevels: int = ..., - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., + maxlevels: int = None, + ddir: StrPath | None = None, + force: bool = False, + rx: _SupportsSearch | None = None, + quiet: int = 0, + legacy: bool = False, optimize: int = ..., - workers: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + workers: int = 1, + invalidation_mode: PycInvalidationMode | None = None, ) -> int: ... def compile_file( fullname: StrPath, - ddir: StrPath | None = ..., - force: bool = ..., - rx: _SupportsSearch | None = ..., - quiet: int = ..., - legacy: bool = ..., + ddir: StrPath | None = None, + force: bool = False, + rx: _SupportsSearch | None = None, + quiet: int = 0, + legacy: bool = False, optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + invalidation_mode: PycInvalidationMode | None = None, ) -> int: ... def compile_path( - skip_curdir: bool = ..., - maxlevels: int = ..., - force: bool = ..., - quiet: int = ..., - legacy: bool = ..., + skip_curdir: bool = 1, + maxlevels: int = 0, + force: bool = False, + quiet: int = 0, + legacy: bool = False, optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + invalidation_mode: PycInvalidationMode | None = None, ) -> int: ... diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index 3db968878498..8acbbda3aaeb 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -67,7 +67,7 @@ class Executor: self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> bool | None: ... -def as_completed(fs: Iterable[Future[_T]], timeout: float | None = ...) -> Iterator[Future[_T]]: ... +def as_completed(fs: Iterable[Future[_T]], timeout: float | None = None) -> Iterator[Future[_T]]: ... # Ideally this would be a namedtuple, but mypy doesn't support generic tuple types. See #1976 class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]): @@ -84,7 +84,7 @@ class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]): @overload def __getitem__(self, __s: slice) -> DoneAndNotDoneFutures[_T]: ... -def wait(fs: Iterable[Future[_T]], timeout: float | None = ..., return_when: str = ...) -> DoneAndNotDoneFutures[_T]: ... +def wait(fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = 'ALL_COMPLETED') -> DoneAndNotDoneFutures[_T]: ... class _Waiter: event: threading.Event diff --git a/stdlib/concurrent/futures/process.pyi b/stdlib/concurrent/futures/process.pyi index a98702d095a2..4889ef43f23b 100644 --- a/stdlib/concurrent/futures/process.pyi +++ b/stdlib/concurrent/futures/process.pyi @@ -95,14 +95,14 @@ if sys.version_info >= (3, 11): def _sendback_result( result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, - result: Any | None = ..., - exception: Exception | None = ..., - exit_pid: int | None = ..., + result: Any | None = None, + exception: Exception | None = None, + exit_pid: int | None = None, ) -> None: ... else: def _sendback_result( - result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = ..., exception: Exception | None = ... + result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = None, exception: Exception | None = None ) -> None: ... if sys.version_info >= (3, 11): @@ -111,7 +111,7 @@ if sys.version_info >= (3, 11): result_queue: SimpleQueue[_ResultItem], initializer: Callable[..., object] | None, initargs: tuple[Any, ...], - max_tasks: int | None = ..., + max_tasks: int | None = None, ) -> None: ... else: diff --git a/stdlib/copy.pyi b/stdlib/copy.pyi index b53f418b3930..f68965d3dc91 100644 --- a/stdlib/copy.pyi +++ b/stdlib/copy.pyi @@ -8,7 +8,7 @@ _T = TypeVar("_T") PyStringMap: Any # Note: memo and _nil are internal kwargs. -def deepcopy(x: _T, memo: dict[int, Any] | None = ..., _nil: Any = ...) -> _T: ... +def deepcopy(x: _T, memo: dict[int, Any] | None = None, _nil: Any = ...) -> _T: ... def copy(x: _T) -> _T: ... class Error(Exception): ... diff --git a/stdlib/copyreg.pyi b/stdlib/copyreg.pyi index 4403550b587e..07338b422385 100644 --- a/stdlib/copyreg.pyi +++ b/stdlib/copyreg.pyi @@ -10,7 +10,7 @@ __all__ = ["pickle", "constructor", "add_extension", "remove_extension", "clear_ def pickle( ob_type: type[_T], pickle_function: Callable[[_T], str | _Reduce[_T]], - constructor_ob: Callable[[_Reduce[_T]], _T] | None = ..., + constructor_ob: Callable[[_Reduce[_T]], _T] | None = None, ) -> None: ... def constructor(object: Callable[[_Reduce[_T]], _T]) -> None: ... def add_extension(module: Hashable, name: Hashable, code: SupportsInt) -> None: ... diff --git a/stdlib/crypt.pyi b/stdlib/crypt.pyi index 83ad45d5c155..1ad0a384eae7 100644 --- a/stdlib/crypt.pyi +++ b/stdlib/crypt.pyi @@ -8,5 +8,5 @@ if sys.platform != "win32": METHOD_SHA512: _Method METHOD_BLOWFISH: _Method methods: list[_Method] - def mksalt(method: _Method | None = ..., *, rounds: int | None = ...) -> str: ... - def crypt(word: str, salt: str | _Method | None = ...) -> str: ... + def mksalt(method: _Method | None = None, *, rounds: int | None = None) -> str: ... + def crypt(word: str, salt: str | _Method | None = None) -> str: ... diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index 21d92dc59c6a..b95f1d74e3c2 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -136,11 +136,11 @@ def byref(obj: _CData, offset: int = ...) -> _CArgObject: ... _CastT = TypeVar("_CastT", bound=_CanCastTo) def cast(obj: _CData | _CArgObject | int, typ: type[_CastT]) -> _CastT: ... -def create_string_buffer(init: int | bytes, size: int | None = ...) -> Array[c_char]: ... +def create_string_buffer(init: int | bytes, size: int | None = None) -> Array[c_char]: ... c_buffer = create_string_buffer -def create_unicode_buffer(init: int | str, size: int | None = ...) -> Array[c_wchar]: ... +def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ... if sys.platform == "win32": def DllCanUnloadNow() -> int: ... diff --git a/stdlib/dataclasses.pyi b/stdlib/dataclasses.pyi index 560147f9e96b..b26682926416 100644 --- a/stdlib/dataclasses.pyi +++ b/stdlib/dataclasses.pyi @@ -239,17 +239,17 @@ if sys.version_info >= (3, 11): fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], *, bases: tuple[type, ...] = ..., - namespace: dict[str, Any] | None = ..., - init: bool = ..., - repr: bool = ..., - eq: bool = ..., - order: bool = ..., - unsafe_hash: bool = ..., - frozen: bool = ..., - match_args: bool = ..., - kw_only: bool = ..., - slots: bool = ..., - weakref_slot: bool = ..., + namespace: dict[str, Any] | None = None, + init: bool = True, + repr: bool = True, + eq: bool = True, + order: bool = False, + unsafe_hash: bool = False, + frozen: bool = False, + match_args: bool = True, + kw_only: bool = False, + slots: bool = False, + weakref_slot: bool = False, ) -> type: ... elif sys.version_info >= (3, 10): @@ -258,16 +258,16 @@ elif sys.version_info >= (3, 10): fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], *, bases: tuple[type, ...] = ..., - namespace: dict[str, Any] | None = ..., - init: bool = ..., - repr: bool = ..., - eq: bool = ..., - order: bool = ..., - unsafe_hash: bool = ..., - frozen: bool = ..., - match_args: bool = ..., - kw_only: bool = ..., - slots: bool = ..., + namespace: dict[str, Any] | None = None, + init: bool = True, + repr: bool = True, + eq: bool = True, + order: bool = False, + unsafe_hash: bool = False, + frozen: bool = False, + match_args: bool = True, + kw_only: bool = False, + slots: bool = False, ) -> type: ... else: @@ -276,13 +276,13 @@ else: fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], *, bases: tuple[type, ...] = ..., - namespace: dict[str, Any] | None = ..., - init: bool = ..., - repr: bool = ..., - eq: bool = ..., - order: bool = ..., - unsafe_hash: bool = ..., - frozen: bool = ..., + namespace: dict[str, Any] | None = None, + init: bool = True, + repr: bool = True, + eq: bool = True, + order: bool = False, + unsafe_hash: bool = False, + frozen: bool = False, ) -> type: ... def replace(__obj: _T, **changes: Any) -> _T: ... diff --git a/stdlib/dbm/__init__.pyi b/stdlib/dbm/__init__.pyi index 33b8aab96610..88778cf95873 100644 --- a/stdlib/dbm/__init__.pyi +++ b/stdlib/dbm/__init__.pyi @@ -92,4 +92,4 @@ class _error(Exception): ... error: tuple[type[_error], type[OSError]] def whichdb(filename: str) -> str: ... -def open(file: str, flag: _TFlags = ..., mode: int = ...) -> _Database: ... +def open(file: str, flag: _TFlags = 'r', mode: int = 438) -> _Database: ... diff --git a/stdlib/dbm/dumb.pyi b/stdlib/dbm/dumb.pyi index 738e68968ca8..098678e84ec3 100644 --- a/stdlib/dbm/dumb.pyi +++ b/stdlib/dbm/dumb.pyi @@ -29,4 +29,4 @@ class _Database(MutableMapping[_KeyType, bytes]): self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... -def open(file: str, flag: str = ..., mode: int = ...) -> _Database: ... +def open(file: str, flag: str = 'c', mode: int = 438) -> _Database: ... diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index df2f8be0168a..3c261c20229d 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -70,29 +70,29 @@ class Differ: def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ... def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ... # pat is undocumented -def IS_CHARACTER_JUNK(ch: str, ws: str = ...) -> bool: ... # ws is undocumented +def IS_CHARACTER_JUNK(ch: str, ws: str = ' \t') -> bool: ... # ws is undocumented def unified_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = ..., - tofile: str = ..., - fromfiledate: str = ..., - tofiledate: str = ..., - n: int = ..., - lineterm: str = ..., + fromfile: str = '', + tofile: str = '', + fromfiledate: str = '', + tofiledate: str = '', + n: int = 3, + lineterm: str = '\n', ) -> Iterator[str]: ... def context_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = ..., - tofile: str = ..., - fromfiledate: str = ..., - tofiledate: str = ..., - n: int = ..., - lineterm: str = ..., + fromfile: str = '', + tofile: str = '', + fromfiledate: str = '', + tofiledate: str = '', + n: int = 3, + lineterm: str = '\n', ) -> Iterator[str]: ... def ndiff( - a: Sequence[str], b: Sequence[str], linejunk: Callable[[str], bool] | None = ..., charjunk: Callable[[str], bool] | None = ... + a: Sequence[str], b: Sequence[str], linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = ... ) -> Iterator[str]: ... class HtmlDiff: @@ -133,6 +133,6 @@ def diff_bytes( tofile: bytes | bytearray = ..., fromfiledate: bytes | bytearray = ..., tofiledate: bytes | bytearray = ..., - n: int = ..., + n: int = 3, lineterm: bytes | bytearray = ..., ) -> Iterator[bytes]: ... diff --git a/stdlib/dis.pyi b/stdlib/dis.pyi index 73adba5c19f5..c16fc5a9f9f4 100644 --- a/stdlib/dis.pyi +++ b/stdlib/dis.pyi @@ -103,37 +103,37 @@ def code_info(x: _HaveCodeType | str) -> str: ... if sys.version_info >= (3, 11): def dis( - x: _HaveCodeType | str | bytes | bytearray | None = ..., + x: _HaveCodeType | str | bytes | bytearray | None = None, *, - file: IO[str] | None = ..., - depth: int | None = ..., - show_caches: bool = ..., - adaptive: bool = ..., + file: IO[str] | None = None, + depth: int | None = None, + show_caches: bool = False, + adaptive: bool = False, ) -> None: ... else: def dis( - x: _HaveCodeType | str | bytes | bytearray | None = ..., *, file: IO[str] | None = ..., depth: int | None = ... + x: _HaveCodeType | str | bytes | bytearray | None = None, *, file: IO[str] | None = None, depth: int | None = None ) -> None: ... if sys.version_info >= (3, 11): def disassemble( - co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ..., show_caches: bool = ..., adaptive: bool = ... + co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False ) -> None: ... def disco( - co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ..., show_caches: bool = ..., adaptive: bool = ... + co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False ) -> None: ... def distb( - tb: types.TracebackType | None = ..., *, file: IO[str] | None = ..., show_caches: bool = ..., adaptive: bool = ... + tb: types.TracebackType | None = None, *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False ) -> None: ... def get_instructions( - x: _HaveCodeType, *, first_line: int | None = ..., show_caches: bool = ..., adaptive: bool = ... + x: _HaveCodeType, *, first_line: int | None = None, show_caches: bool = False, adaptive: bool = False ) -> Iterator[Instruction]: ... else: - def disassemble(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... - def disco(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... - def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ... - def get_instructions(x: _HaveCodeType, *, first_line: int | None = ...) -> Iterator[Instruction]: ... + def disassemble(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None) -> None: ... + def disco(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None) -> None: ... + def distb(tb: types.TracebackType | None = None, *, file: IO[str] | None = None) -> None: ... + def get_instructions(x: _HaveCodeType, *, first_line: int | None = None) -> Iterator[Instruction]: ... -def show_code(co: _HaveCodeType, *, file: IO[str] | None = ...) -> None: ... +def show_code(co: _HaveCodeType, *, file: IO[str] | None = None) -> None: ... diff --git a/stdlib/distutils/archive_util.pyi b/stdlib/distutils/archive_util.pyi index 38458fc0e003..d2723d60ca1b 100644 --- a/stdlib/distutils/archive_util.pyi +++ b/stdlib/distutils/archive_util.pyi @@ -1,20 +1,20 @@ def make_archive( base_name: str, format: str, - root_dir: str | None = ..., - base_dir: str | None = ..., - verbose: int = ..., - dry_run: int = ..., - owner: str | None = ..., - group: str | None = ..., + root_dir: str | None = None, + base_dir: str | None = None, + verbose: int = 0, + dry_run: int = 0, + owner: str | None = None, + group: str | None = None, ) -> str: ... def make_tarball( base_name: str, base_dir: str, - compress: str | None = ..., - verbose: int = ..., - dry_run: int = ..., - owner: str | None = ..., - group: str | None = ..., + compress: str | None = 'gzip', + verbose: int = 0, + dry_run: int = 0, + owner: str | None = None, + group: str | None = None, ) -> str: ... -def make_zipfile(base_name: str, base_dir: str, verbose: int = ..., dry_run: int = ...) -> str: ... +def make_zipfile(base_name: str, base_dir: str, verbose: int = 0, dry_run: int = 0) -> str: ... diff --git a/stdlib/distutils/ccompiler.pyi b/stdlib/distutils/ccompiler.pyi index 5b92c5f5c42e..fa6e80d2dca4 100644 --- a/stdlib/distutils/ccompiler.pyi +++ b/stdlib/distutils/ccompiler.pyi @@ -8,9 +8,9 @@ def gen_lib_options( compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str] ) -> list[str]: ... def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ... -def get_default_compiler(osname: str | None = ..., platform: str | None = ...) -> str: ... +def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ... def new_compiler( - plat: str | None = ..., compiler: str | None = ..., verbose: int = ..., dry_run: int = ..., force: int = ... + plat: str | None = None, compiler: str | None = None, verbose: int = 0, dry_run: int = 0, force: int = 0 ) -> CCompiler: ... def show_compilers() -> None: ... diff --git a/stdlib/distutils/command/config.pyi b/stdlib/distutils/command/config.pyi index 03466ca72985..1a772f976864 100644 --- a/stdlib/distutils/command/config.pyi +++ b/stdlib/distutils/command/config.pyi @@ -80,4 +80,4 @@ class config(Command): self, header: str, include_dirs: Sequence[str] | None = ..., library_dirs: Sequence[str] | None = ..., lang: str = ... ) -> bool: ... -def dump_file(filename: str, head: Any | None = ...) -> None: ... +def dump_file(filename: str, head: Any | None = None) -> None: ... diff --git a/stdlib/distutils/core.pyi b/stdlib/distutils/core.pyi index 199a4d70a953..98639068f635 100644 --- a/stdlib/distutils/core.pyi +++ b/stdlib/distutils/core.pyi @@ -46,4 +46,4 @@ def setup( fullname: str = ..., **attrs: Any, ) -> None: ... -def run_setup(script_name: str, script_args: list[str] | None = ..., stop_after: str = ...) -> Distribution: ... +def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = 'run') -> Distribution: ... diff --git a/stdlib/distutils/dep_util.pyi b/stdlib/distutils/dep_util.pyi index 929d6ffd0c81..4fb898c6581b 100644 --- a/stdlib/distutils/dep_util.pyi +++ b/stdlib/distutils/dep_util.pyi @@ -1,3 +1,3 @@ def newer(source: str, target: str) -> bool: ... def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ... -def newer_group(sources: list[str], target: str, missing: str = ...) -> bool: ... +def newer_group(sources: list[str], target: str, missing: str = 'error') -> bool: ... diff --git a/stdlib/distutils/dir_util.pyi b/stdlib/distutils/dir_util.pyi index ffe5ff1cfbd4..b024b248fd4b 100644 --- a/stdlib/distutils/dir_util.pyi +++ b/stdlib/distutils/dir_util.pyi @@ -1,13 +1,13 @@ -def mkpath(name: str, mode: int = ..., verbose: int = ..., dry_run: int = ...) -> list[str]: ... -def create_tree(base_dir: str, files: list[str], mode: int = ..., verbose: int = ..., dry_run: int = ...) -> None: ... +def mkpath(name: str, mode: int = 511, verbose: int = 1, dry_run: int = 0) -> list[str]: ... +def create_tree(base_dir: str, files: list[str], mode: int = 511, verbose: int = 1, dry_run: int = 0) -> None: ... def copy_tree( src: str, dst: str, - preserve_mode: int = ..., - preserve_times: int = ..., - preserve_symlinks: int = ..., - update: int = ..., - verbose: int = ..., - dry_run: int = ..., + preserve_mode: int = 1, + preserve_times: int = 1, + preserve_symlinks: int = 0, + update: int = 0, + verbose: int = 1, + dry_run: int = 0, ) -> list[str]: ... -def remove_tree(directory: str, verbose: int = ..., dry_run: int = ...) -> None: ... +def remove_tree(directory: str, verbose: int = 1, dry_run: int = 0) -> None: ... diff --git a/stdlib/distutils/file_util.pyi b/stdlib/distutils/file_util.pyi index b3127841bce8..6738be023a10 100644 --- a/stdlib/distutils/file_util.pyi +++ b/stdlib/distutils/file_util.pyi @@ -3,12 +3,12 @@ from collections.abc import Sequence def copy_file( src: str, dst: str, - preserve_mode: bool = ..., - preserve_times: bool = ..., - update: bool = ..., - link: str | None = ..., - verbose: bool = ..., - dry_run: bool = ..., + preserve_mode: bool = 1, + preserve_times: bool = 1, + update: bool = 0, + link: str | None = None, + verbose: bool = 1, + dry_run: bool = 0, ) -> tuple[str, str]: ... -def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ... +def move_file(src: str, dst: str, verbose: bool = 1, dry_run: bool = 0) -> str: ... def write_file(filename: str, contents: Sequence[str]) -> None: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index 1cfdcf08dca9..e38f9dcdccdd 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -37,7 +37,7 @@ class FileList: self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... ) -> bool: ... -def findall(dir: str = ...) -> list[str]: ... +def findall(dir: str = '.') -> list[str]: ... def glob_to_re(pattern: str) -> str: ... @overload def translate_pattern( diff --git a/stdlib/distutils/spawn.pyi b/stdlib/distutils/spawn.pyi index dda05ad7e85a..e18fcbb4f4c9 100644 --- a/stdlib/distutils/spawn.pyi +++ b/stdlib/distutils/spawn.pyi @@ -1,2 +1,2 @@ -def spawn(cmd: list[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... -def find_executable(executable: str, path: str | None = ...) -> str | None: ... +def spawn(cmd: list[str], search_path: bool = 1, verbose: bool = 0, dry_run: bool = 0) -> None: ... +def find_executable(executable: str, path: str | None = None) -> str | None: ... diff --git a/stdlib/distutils/sysconfig.pyi b/stdlib/distutils/sysconfig.pyi index bf7db9c8f06b..7351b42fef7e 100644 --- a/stdlib/distutils/sysconfig.pyi +++ b/stdlib/distutils/sysconfig.pyi @@ -8,6 +8,6 @@ def get_config_var(name: str) -> int | str | None: ... def get_config_vars(*args: str) -> Mapping[str, int | str]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... -def get_python_inc(plat_specific: bool = ..., prefix: str | None = ...) -> str: ... -def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: str | None = ...) -> str: ... +def get_python_inc(plat_specific: bool = 0, prefix: str | None = None) -> str: ... +def get_python_lib(plat_specific: bool = 0, standard_lib: bool = 0, prefix: str | None = None) -> str: ... def customize_compiler(compiler: CCompiler) -> None: ... diff --git a/stdlib/distutils/util.pyi b/stdlib/distutils/util.pyi index da8d66063536..81af04390993 100644 --- a/stdlib/distutils/util.pyi +++ b/stdlib/distutils/util.pyi @@ -10,18 +10,18 @@ def check_environ() -> None: ... def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ... def split_quoted(s: str) -> list[str]: ... def execute( - func: Callable[..., object], args: tuple[Any, ...], msg: str | None = ..., verbose: bool = ..., dry_run: bool = ... + func: Callable[..., object], args: tuple[Any, ...], msg: str | None = None, verbose: bool = 0, dry_run: bool = 0 ) -> None: ... def strtobool(val: str) -> Literal[0, 1]: ... def byte_compile( py_files: list[str], - optimize: int = ..., - force: bool = ..., - prefix: str | None = ..., - base_dir: str | None = ..., - verbose: bool = ..., - dry_run: bool = ..., - direct: bool | None = ..., + optimize: int = 0, + force: bool = 0, + prefix: str | None = None, + base_dir: str | None = None, + verbose: bool = 1, + dry_run: bool = 0, + direct: bool | None = None, ) -> None: ... def rfc822_escape(header: str) -> str: ... def run_2to3( diff --git a/stdlib/doctest.pyi b/stdlib/doctest.pyi index 719551eb77de..0c82d689206c 100644 --- a/stdlib/doctest.pyi +++ b/stdlib/doctest.pyi @@ -165,32 +165,32 @@ class DebugRunner(DocTestRunner): ... master: DocTestRunner | None def testmod( - m: types.ModuleType | None = ..., - name: str | None = ..., - globs: dict[str, Any] | None = ..., - verbose: bool | None = ..., - report: bool = ..., - optionflags: int = ..., - extraglobs: dict[str, Any] | None = ..., - raise_on_error: bool = ..., - exclude_empty: bool = ..., + m: types.ModuleType | None = None, + name: str | None = None, + globs: dict[str, Any] | None = None, + verbose: bool | None = None, + report: bool = True, + optionflags: int = 0, + extraglobs: dict[str, Any] | None = None, + raise_on_error: bool = False, + exclude_empty: bool = False, ) -> TestResults: ... def testfile( filename: str, - module_relative: bool = ..., - name: str | None = ..., - package: None | str | types.ModuleType = ..., - globs: dict[str, Any] | None = ..., - verbose: bool | None = ..., - report: bool = ..., - optionflags: int = ..., - extraglobs: dict[str, Any] | None = ..., - raise_on_error: bool = ..., + module_relative: bool = True, + name: str | None = None, + package: None | str | types.ModuleType = None, + globs: dict[str, Any] | None = None, + verbose: bool | None = None, + report: bool = True, + optionflags: int = 0, + extraglobs: dict[str, Any] | None = None, + raise_on_error: bool = False, parser: DocTestParser = ..., - encoding: str | None = ..., + encoding: str | None = None, ) -> TestResults: ... def run_docstring_examples( - f: object, globs: dict[str, Any], verbose: bool = ..., name: str = ..., compileflags: int | None = ..., optionflags: int = ... + f: object, globs: dict[str, Any], verbose: bool = False, name: str = 'NoName', compileflags: int | None = None, optionflags: int = 0 ) -> None: ... def set_unittest_reportflags(flags: int) -> int: ... @@ -214,10 +214,10 @@ class SkipDocTestCase(DocTestCase): class _DocTestSuite(unittest.TestSuite): ... def DocTestSuite( - module: None | str | types.ModuleType = ..., - globs: dict[str, Any] | None = ..., - extraglobs: dict[str, Any] | None = ..., - test_finder: DocTestFinder | None = ..., + module: None | str | types.ModuleType = None, + globs: dict[str, Any] | None = None, + extraglobs: dict[str, Any] | None = None, + test_finder: DocTestFinder | None = None, **options: Any, ) -> _DocTestSuite: ... @@ -225,16 +225,16 @@ class DocFileCase(DocTestCase): ... def DocFileTest( path: str, - module_relative: bool = ..., - package: None | str | types.ModuleType = ..., - globs: dict[str, Any] | None = ..., + module_relative: bool = True, + package: None | str | types.ModuleType = None, + globs: dict[str, Any] | None = None, parser: DocTestParser = ..., - encoding: str | None = ..., + encoding: str | None = None, **options: Any, ) -> DocFileCase: ... def DocFileSuite(*paths: str, **kw: Any) -> _DocTestSuite: ... def script_from_examples(s: str) -> str: ... def testsource(module: None | str | types.ModuleType, name: str) -> str: ... -def debug_src(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ... -def debug_script(src: str, pm: bool = ..., globs: dict[str, Any] | None = ...) -> None: ... -def debug(module: None | str | types.ModuleType, name: str, pm: bool = ...) -> None: ... +def debug_src(src: str, pm: bool = False, globs: dict[str, Any] | None = None) -> None: ... +def debug_script(src: str, pm: bool = False, globs: dict[str, Any] | None = None) -> None: ... +def debug(module: None | str | types.ModuleType, name: str, pm: bool = False) -> None: ... diff --git a/stdlib/email/base64mime.pyi b/stdlib/email/base64mime.pyi index 16118a879ad7..2c49ba7192ad 100644 --- a/stdlib/email/base64mime.pyi +++ b/stdlib/email/base64mime.pyi @@ -3,10 +3,10 @@ __all__ = ["body_decode", "body_encode", "decode", "decodestring", "header_encod from _typeshed import ReadableBuffer def header_length(bytearray: str | bytes | bytearray) -> int: ... -def header_encode(header_bytes: str | ReadableBuffer, charset: str = ...) -> str: ... +def header_encode(header_bytes: str | ReadableBuffer, charset: str = 'iso-8859-1') -> str: ... # First argument should be a buffer that supports slicing and len(). -def body_encode(s: bytes | bytearray, maxlinelen: int = ..., eol: str = ...) -> str: ... +def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = '\n') -> str: ... def decode(string: str | ReadableBuffer) -> bytes: ... body_decode = decode diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index 236908537f83..f5409e817010 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -23,7 +23,7 @@ class Charset: def __ne__(self, __other: object) -> bool: ... def add_charset( - charset: str, header_enc: int | None = ..., body_enc: int | None = ..., output_charset: str | None = ... + charset: str, header_enc: int | None = None, body_enc: int | None = None, output_charset: str | None = None ) -> None: ... def add_alias(alias: str, canonical: str) -> None: ... def add_codec(charset: str, codecname: str) -> None: ... diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index 58740bd1bdae..ce74483dcaf2 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -25,7 +25,7 @@ class Header: def decode_header(header: Header | str) -> list[tuple[Any, Any | None]]: ... def make_header( decoded_seq: Iterable[tuple[bytes | bytearray | str, str | None]], - maxlinelen: int | None = ..., - header_name: str | None = ..., - continuation_ws: str = ..., + maxlinelen: int | None = None, + header_name: str | None = None, + continuation_ws: str = ' ', ) -> Header: ... diff --git a/stdlib/email/iterators.pyi b/stdlib/email/iterators.pyi index 29068819ac15..67e782c3d436 100644 --- a/stdlib/email/iterators.pyi +++ b/stdlib/email/iterators.pyi @@ -4,9 +4,9 @@ from email.message import Message __all__ = ["body_line_iterator", "typed_subpart_iterator", "walk"] -def body_line_iterator(msg: Message, decode: bool = ...) -> Iterator[str]: ... -def typed_subpart_iterator(msg: Message, maintype: str = ..., subtype: str | None = ...) -> Iterator[str]: ... +def body_line_iterator(msg: Message, decode: bool = False) -> Iterator[str]: ... +def typed_subpart_iterator(msg: Message, maintype: str = 'text', subtype: str | None = None) -> Iterator[str]: ... def walk(self: Message) -> Iterator[Message]: ... # We include the seemingly private function because it is documented in the stdlib documentation. -def _structure(msg: Message, fp: SupportsWrite[str] | None = ..., level: int = ..., include_default: bool = ...) -> None: ... +def _structure(msg: Message, fp: SupportsWrite[str] | None = None, level: int = 0, include_default: bool = False) -> None: ... diff --git a/stdlib/email/quoprimime.pyi b/stdlib/email/quoprimime.pyi index ec0c799583bf..2e38d8313a87 100644 --- a/stdlib/email/quoprimime.pyi +++ b/stdlib/email/quoprimime.pyi @@ -19,9 +19,9 @@ def header_length(bytearray: Iterable[int]) -> int: ... def body_length(bytearray: Iterable[int]) -> int: ... def unquote(s: str | bytes | bytearray) -> str: ... def quote(c: str | bytes | bytearray) -> str: ... -def header_encode(header_bytes: bytes | bytearray, charset: str = ...) -> str: ... -def body_encode(body: str, maxlinelen: int = ..., eol: str = ...) -> str: ... -def decode(encoded: str, eol: str = ...) -> str: ... +def header_encode(header_bytes: bytes | bytearray, charset: str = 'iso-8859-1') -> str: ... +def body_encode(body: str, maxlinelen: int = 76, eol: str = '\n') -> str: ... +def decode(encoded: str, eol: str = '\n') -> str: ... def header_decode(s: str) -> str: ... body_decode = decode diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 480c5f79549d..bfa7bc1d9161 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -28,7 +28,7 @@ _PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None def quote(str: str) -> str: ... def unquote(str: str) -> str: ... def parseaddr(addr: str | None) -> tuple[str, str]: ... -def formataddr(pair: tuple[str | None, str], charset: str | Charset = ...) -> str: ... +def formataddr(pair: tuple[str | None, str], charset: str | Charset = 'utf-8') -> str: ... def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... @overload def parsedate(data: None) -> None: ... @@ -49,11 +49,11 @@ else: def parsedate_to_datetime(data: str) -> datetime.datetime: ... def mktime_tz(data: _PDTZ) -> int: ... -def formatdate(timeval: float | None = ..., localtime: bool = ..., usegmt: bool = ...) -> str: ... -def format_datetime(dt: datetime.datetime, usegmt: bool = ...) -> str: ... -def localtime(dt: datetime.datetime | None = ..., isdst: int = ...) -> datetime.datetime: ... -def make_msgid(idstring: str | None = ..., domain: str | None = ...) -> str: ... +def formatdate(timeval: float | None = None, localtime: bool = False, usegmt: bool = False) -> str: ... +def format_datetime(dt: datetime.datetime, usegmt: bool = False) -> str: ... +def localtime(dt: datetime.datetime | None = None, isdst: int = ...) -> datetime.datetime: ... +def make_msgid(idstring: str | None = None, domain: str | None = None) -> str: ... def decode_rfc2231(s: str) -> tuple[str | None, str | None, str]: ... -def encode_rfc2231(s: str, charset: str | None = ..., language: str | None = ...) -> str: ... -def collapse_rfc2231_value(value: _ParamType, errors: str = ..., fallback_charset: str = ...) -> str: ... +def encode_rfc2231(s: str, charset: str | None = None, language: str | None = None) -> str: ... +def collapse_rfc2231_value(value: _ParamType, errors: str = 'replace', fallback_charset: str = 'us-ascii') -> str: ... def decode_params(params: list[tuple[str, str]]) -> list[tuple[str, _ParamType]]: ... diff --git a/stdlib/encodings/utf_8.pyi b/stdlib/encodings/utf_8.pyi index 8e73756199c1..4332129de63d 100644 --- a/stdlib/encodings/utf_8.pyi +++ b/stdlib/encodings/utf_8.pyi @@ -18,4 +18,4 @@ class StreamReader(codecs.StreamReader): def getregentry() -> codecs.CodecInfo: ... def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... +def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... diff --git a/stdlib/encodings/utf_8_sig.pyi b/stdlib/encodings/utf_8_sig.pyi index 27171063f53f..04d6eec1d6df 100644 --- a/stdlib/encodings/utf_8_sig.pyi +++ b/stdlib/encodings/utf_8_sig.pyi @@ -18,5 +18,5 @@ class StreamReader(codecs.StreamReader): def decode(self, input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... def getregentry() -> codecs.CodecInfo: ... -def encode(input: str, errors: str | None = ...) -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... +def encode(input: str, errors: str | None = 'strict') -> tuple[bytes, int]: ... +def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... diff --git a/stdlib/ensurepip/__init__.pyi b/stdlib/ensurepip/__init__.pyi index e2686b8d5437..332fb1845917 100644 --- a/stdlib/ensurepip/__init__.pyi +++ b/stdlib/ensurepip/__init__.pyi @@ -3,10 +3,10 @@ __all__ = ["version", "bootstrap"] def version() -> str: ... def bootstrap( *, - root: str | None = ..., - upgrade: bool = ..., - user: bool = ..., - altinstall: bool = ..., - default_pip: bool = ..., - verbosity: int = ..., + root: str | None = None, + upgrade: bool = False, + user: bool = False, + altinstall: bool = False, + default_pip: bool = False, + verbosity: int = 0, ) -> None: ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index a14744f1ba8d..27e607f27bce 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -275,6 +275,6 @@ if sys.version_info >= (3, 11): KEEP = FlagBoundary.KEEP def global_str(self: Enum) -> str: ... - def global_enum(cls: _EnumerationT, update_str: bool = ...) -> _EnumerationT: ... + def global_enum(cls: _EnumerationT, update_str: bool = False) -> _EnumerationT: ... def global_enum_repr(self: Enum) -> str: ... def global_flag_repr(self: Flag) -> str: ... diff --git a/stdlib/filecmp.pyi b/stdlib/filecmp.pyi index dd4a0628b026..1555b2b8921a 100644 --- a/stdlib/filecmp.pyi +++ b/stdlib/filecmp.pyi @@ -12,9 +12,9 @@ __all__ = ["clear_cache", "cmp", "dircmp", "cmpfiles", "DEFAULT_IGNORES"] DEFAULT_IGNORES: list[str] BUFSIZE: Literal[8192] -def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: bool | Literal[0, 1] = ...) -> bool: ... +def cmp(f1: StrOrBytesPath, f2: StrOrBytesPath, shallow: bool | Literal[0, 1] = True) -> bool: ... def cmpfiles( - a: GenericPath[AnyStr], b: GenericPath[AnyStr], common: Iterable[GenericPath[AnyStr]], shallow: bool | Literal[0, 1] = ... + a: GenericPath[AnyStr], b: GenericPath[AnyStr], common: Iterable[GenericPath[AnyStr]], shallow: bool | Literal[0, 1] = True ) -> tuple[list[AnyStr], list[AnyStr], list[AnyStr]]: ... class dircmp(Generic[AnyStr]): diff --git a/stdlib/fileinput.pyi b/stdlib/fileinput.pyi index e0babbcd40cc..dc51b0a2a238 100644 --- a/stdlib/fileinput.pyi +++ b/stdlib/fileinput.pyi @@ -311,10 +311,10 @@ class FileInput(Iterator[AnyStr], Generic[AnyStr]): if sys.version_info >= (3, 10): def hook_compressed( - filename: StrOrBytesPath, mode: str, *, encoding: str | None = ..., errors: str | None = ... + filename: StrOrBytesPath, mode: str, *, encoding: str | None = None, errors: str | None = None ) -> IO[Any]: ... else: def hook_compressed(filename: StrOrBytesPath, mode: str) -> IO[Any]: ... -def hook_encoded(encoding: str, errors: str | None = ...) -> Callable[[StrOrBytesPath, str], IO[Any]]: ... +def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ... diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 3d284c597019..82380eb687ce 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -161,5 +161,5 @@ def parse227(resp: str) -> tuple[str, int]: ... # undocumented def parse229(resp: str, peer: Any) -> tuple[str, int]: ... # undocumented def parse257(resp: str) -> str: ... # undocumented def ftpcp( - source: FTP, sourcename: str, target: FTP, targetname: str = ..., type: Literal["A", "I"] = ... + source: FTP, sourcename: str, target: FTP, targetname: str = '', type: Literal["A", "I"] = 'I' ) -> None: ... # undocumented diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 5c3f662c3dd5..d317fa208b1c 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -60,7 +60,7 @@ if sys.version_info >= (3, 8): def lru_cache(maxsize: Callable[..., _T], typed: bool = ...) -> _lru_cache_wrapper[_T]: ... else: - def lru_cache(maxsize: int | None = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ... + def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ... WRAPPER_ASSIGNMENTS: tuple[ Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"], diff --git a/stdlib/gc.pyi b/stdlib/gc.pyi index d24b7c1f4c7c..27cee726ba09 100644 --- a/stdlib/gc.pyi +++ b/stdlib/gc.pyi @@ -14,14 +14,14 @@ _CallbackType: TypeAlias = Callable[[Literal["start", "stop"], dict[str, int]], callbacks: list[_CallbackType] garbage: list[Any] -def collect(generation: int = ...) -> int: ... +def collect(generation: int = 2) -> int: ... def disable() -> None: ... def enable() -> None: ... def get_count() -> tuple[int, int, int]: ... def get_debug() -> int: ... if sys.version_info >= (3, 8): - def get_objects(generation: int | None = ...) -> list[Any]: ... + def get_objects(generation: int | None = None) -> list[Any]: ... else: def get_objects() -> list[Any]: ... diff --git a/stdlib/getpass.pyi b/stdlib/getpass.pyi index 153db2f4cb9e..bfa48bdcab18 100644 --- a/stdlib/getpass.pyi +++ b/stdlib/getpass.pyi @@ -2,7 +2,7 @@ from typing import TextIO __all__ = ["getpass", "getuser", "GetPassWarning"] -def getpass(prompt: str = ..., stream: TextIO | None = ...) -> str: ... +def getpass(prompt: str = 'Password: ', stream: TextIO | None = None) -> str: ... def getuser() -> str: ... class GetPassWarning(UserWarning): ... diff --git a/stdlib/gettext.pyi b/stdlib/gettext.pyi index 3c07abeb2d8a..21f8e7747604 100644 --- a/stdlib/gettext.pyi +++ b/stdlib/gettext.pyi @@ -104,7 +104,7 @@ if sys.version_info >= (3, 11): class_: Callable[[io.BufferedReader], NullTranslations] | None = ..., fallback: bool = ..., ) -> NullTranslations: ... - def install(domain: str, localedir: StrPath | None = ..., *, names: Container[str] | None = ...) -> None: ... + def install(domain: str, localedir: StrPath | None = None, *, names: Container[str] | None = None) -> None: ... else: @overload @@ -145,11 +145,11 @@ else: codeset: str | 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 = ..., names: Container[str] | None = None ) -> None: ... -def textdomain(domain: str | None = ...) -> str: ... -def bindtextdomain(domain: str, localedir: StrPath | None = ...) -> str: ... +def textdomain(domain: str | None = None) -> str: ... +def bindtextdomain(domain: str, localedir: StrPath | None = None) -> str: ... def dgettext(domain: str, message: str) -> str: ... def dngettext(domain: str, msgid1: str, msgid2: str, n: int) -> str: ... def gettext(message: str) -> str: ... diff --git a/stdlib/glob.pyi b/stdlib/glob.pyi index c63563d19f58..914ccc12ef1e 100644 --- a/stdlib/glob.pyi +++ b/stdlib/glob.pyi @@ -12,31 +12,31 @@ if sys.version_info >= (3, 11): def glob( pathname: AnyStr, *, - root_dir: StrOrBytesPath | None = ..., - dir_fd: int | None = ..., - recursive: bool = ..., - include_hidden: bool = ..., + root_dir: StrOrBytesPath | None = None, + dir_fd: int | None = None, + recursive: bool = False, + include_hidden: bool = False, ) -> list[AnyStr]: ... def iglob( pathname: AnyStr, *, - root_dir: StrOrBytesPath | None = ..., - dir_fd: int | None = ..., - recursive: bool = ..., - include_hidden: bool = ..., + root_dir: StrOrBytesPath | None = None, + dir_fd: int | None = None, + recursive: bool = False, + include_hidden: bool = False, ) -> Iterator[AnyStr]: ... elif sys.version_info >= (3, 10): def glob( - pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ... + pathname: AnyStr, *, root_dir: StrOrBytesPath | None = None, dir_fd: int | None = None, recursive: bool = False ) -> list[AnyStr]: ... def iglob( - pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ... + pathname: AnyStr, *, root_dir: StrOrBytesPath | None = None, dir_fd: int | None = None, recursive: bool = False ) -> Iterator[AnyStr]: ... else: - def glob(pathname: AnyStr, *, recursive: bool = ...) -> list[AnyStr]: ... - def iglob(pathname: AnyStr, *, recursive: bool = ...) -> Iterator[AnyStr]: ... + def glob(pathname: AnyStr, *, recursive: bool = False) -> list[AnyStr]: ... + def iglob(pathname: AnyStr, *, recursive: bool = False) -> Iterator[AnyStr]: ... def escape(pathname: AnyStr) -> AnyStr: ... def has_magic(s: str | bytes) -> bool: ... # undocumented diff --git a/stdlib/gzip.pyi b/stdlib/gzip.pyi index 580e605b6b38..3553f0a77239 100644 --- a/stdlib/gzip.pyi +++ b/stdlib/gzip.pyi @@ -159,9 +159,9 @@ class _GzipReader(_compression.DecompressReader): def __init__(self, fp: _ReadableFileobj) -> None: ... if sys.version_info >= (3, 8): - def compress(data: _BufferWithLen, compresslevel: int = ..., *, mtime: float | None = ...) -> bytes: ... + def compress(data: _BufferWithLen, compresslevel: int = 9, *, mtime: float | None = None) -> bytes: ... else: - def compress(data: _BufferWithLen, compresslevel: int = ...) -> bytes: ... + def compress(data: _BufferWithLen, compresslevel: int = 9) -> bytes: ... def decompress(data: ReadableBuffer) -> bytes: ... diff --git a/stdlib/hashlib.pyi b/stdlib/hashlib.pyi index 2a417364b171..13d3e2fdeb1f 100644 --- a/stdlib/hashlib.pyi +++ b/stdlib/hashlib.pyi @@ -63,12 +63,12 @@ class _Hash: if sys.version_info >= (3, 9): def new(name: str, data: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ... - def md5(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ... - def sha1(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ... - def sha224(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ... - def sha256(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ... - def sha384(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ... - def sha512(string: ReadableBuffer = ..., *, usedforsecurity: bool = ...) -> _Hash: ... + def md5(string: ReadableBuffer = ..., *, usedforsecurity: bool = True) -> _Hash: ... + def sha1(string: ReadableBuffer = ..., *, usedforsecurity: bool = True) -> _Hash: ... + def sha224(string: ReadableBuffer = ..., *, usedforsecurity: bool = True) -> _Hash: ... + def sha256(string: ReadableBuffer = ..., *, usedforsecurity: bool = True) -> _Hash: ... + def sha384(string: ReadableBuffer = ..., *, usedforsecurity: bool = True) -> _Hash: ... + def sha512(string: ReadableBuffer = ..., *, usedforsecurity: bool = True) -> _Hash: ... elif sys.version_info >= (3, 8): def new(name: str, data: ReadableBuffer = ...) -> _Hash: ... @@ -92,7 +92,7 @@ algorithms_guaranteed: AbstractSet[str] algorithms_available: AbstractSet[str] def pbkdf2_hmac( - hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = ... + hash_name: str, password: ReadableBuffer, salt: ReadableBuffer, iterations: int, dklen: int | None = None ) -> bytes: ... class _VarLenHash: @@ -115,12 +115,12 @@ shake_256 = _VarLenHash def scrypt( password: ReadableBuffer, *, - salt: ReadableBuffer | None = ..., - n: int | None = ..., - r: int | None = ..., - p: int | None = ..., - maxmem: int = ..., - dklen: int = ..., + salt: ReadableBuffer | None = None, + n: int | None = None, + r: int | None = None, + p: int | None = None, + maxmem: int = 0, + dklen: int = 64, ) -> bytes: ... @final class _BlakeHash(_Hash): @@ -177,5 +177,5 @@ if sys.version_info >= (3, 11): def readable(self) -> bool: ... def file_digest( - __fileobj: _BytesIOLike | _FileDigestFileObj, __digest: str | Callable[[], _Hash], *, _bufsize: int = ... + __fileobj: _BytesIOLike | _FileDigestFileObj, __digest: str | Callable[[], _Hash], *, _bufsize: int = 262144 ) -> _Hash: ... diff --git a/stdlib/heapq.pyi b/stdlib/heapq.pyi index b280322685db..9d7815507ea5 100644 --- a/stdlib/heapq.pyi +++ b/stdlib/heapq.pyi @@ -10,8 +10,8 @@ _S = TypeVar("_S") __about__: str def merge( - *iterables: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ..., reverse: bool = ... + *iterables: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = None, reverse: bool = False ) -> Iterable[_S]: ... -def nlargest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ...) -> list[_S]: ... -def nsmallest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = ...) -> list[_S]: ... +def nlargest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = None) -> list[_S]: ... +def nsmallest(n: int, iterable: Iterable[_S], key: Callable[[_S], SupportsRichComparison] | None = None) -> list[_S]: ... def _heapify_max(__x: list[Any]) -> None: ... # undocumented diff --git a/stdlib/hmac.pyi b/stdlib/hmac.pyi index dc29836b6b87..35e84c96dff4 100644 --- a/stdlib/hmac.pyi +++ b/stdlib/hmac.pyi @@ -23,7 +23,7 @@ if sys.version_info >= (3, 8): def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ... else: - def new(key: bytes | bytearray, msg: ReadableBuffer | None = ..., digestmod: _DigestMod | None = ...) -> HMAC: ... + def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = '') -> HMAC: ... class HMAC: digest_size: int diff --git a/stdlib/html/__init__.pyi b/stdlib/html/__init__.pyi index 109c5f4b50fb..afba90832535 100644 --- a/stdlib/html/__init__.pyi +++ b/stdlib/html/__init__.pyi @@ -2,5 +2,5 @@ from typing import AnyStr __all__ = ["escape", "unescape"] -def escape(s: AnyStr, quote: bool = ...) -> AnyStr: ... +def escape(s: AnyStr, quote: bool = True) -> AnyStr: ... def unescape(s: AnyStr) -> AnyStr: ... diff --git a/stdlib/imp.pyi b/stdlib/imp.pyi index 889f0cac4f9f..3f2920de9c2b 100644 --- a/stdlib/imp.pyi +++ b/stdlib/imp.pyi @@ -29,7 +29,7 @@ IMP_HOOK: int def new_module(name: str) -> types.ModuleType: ... def get_magic() -> bytes: ... def get_tag() -> str: ... -def cache_from_source(path: StrPath, debug_override: bool | None = ...) -> str: ... +def cache_from_source(path: StrPath, debug_override: bool | None = None) -> str: ... def source_from_cache(path: StrPath) -> str: ... def get_suffixes() -> list[tuple[str, str, int]]: ... @@ -48,15 +48,15 @@ class _FileLike(Protocol): def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> Any: ... # PathLike doesn't work for the pathname argument here -def load_source(name: str, pathname: str, file: _FileLike | None = ...) -> types.ModuleType: ... -def load_compiled(name: str, pathname: str, file: _FileLike | None = ...) -> types.ModuleType: ... +def load_source(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ... +def load_compiled(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ... def load_package(name: str, path: StrPath) -> types.ModuleType: ... def load_module(name: str, file: _FileLike | None, filename: str, details: tuple[str, str, int]) -> types.ModuleType: ... # IO[Any] is a TextIOWrapper if name is a .py file, and a FileIO otherwise. def find_module( - name: str, path: None | list[str] | list[PathLike[str]] | list[StrPath] = ... + name: str, path: None | list[str] | list[PathLike[str]] | list[StrPath] = None ) -> tuple[IO[Any], str, tuple[str, str, int]]: ... def reload(module: types.ModuleType) -> types.ModuleType: ... def init_builtin(name: str) -> types.ModuleType | None: ... -def load_dynamic(name: str, path: str, file: Any = ...) -> types.ModuleType: ... # file argument is ignored +def load_dynamic(name: str, path: str, file: Any = None) -> types.ModuleType: ... # file argument is ignored diff --git a/stdlib/importlib/__init__.pyi b/stdlib/importlib/__init__.pyi index 42401a00bdeb..1747b274136e 100644 --- a/stdlib/importlib/__init__.pyi +++ b/stdlib/importlib/__init__.pyi @@ -7,14 +7,14 @@ __all__ = ["__import__", "import_module", "invalidate_caches", "reload"] # Signature of `builtins.__import__` should be kept identical to `importlib.__import__` def __import__( name: str, - globals: Mapping[str, object] | None = ..., - locals: Mapping[str, object] | None = ..., + globals: Mapping[str, object] | None = None, + locals: Mapping[str, object] | None = None, fromlist: Sequence[str] = ..., - level: int = ..., + level: int = 0, ) -> ModuleType: ... # `importlib.import_module` return type should be kept the same as `builtins.__import__` -def import_module(name: str, package: str | None = ...) -> ModuleType: ... -def find_loader(name: str, path: str | None = ...) -> Loader | None: ... +def import_module(name: str, package: str | None = None) -> ModuleType: ... +def find_loader(name: str, path: str | None = None) -> Loader | None: ... def invalidate_caches() -> None: ... def reload(module: ModuleType) -> ModuleType: ... diff --git a/stdlib/importlib/resources.pyi b/stdlib/importlib/resources.pyi index 28ca107f4195..999bd65cd7bf 100644 --- a/stdlib/importlib/resources.pyi +++ b/stdlib/importlib/resources.pyi @@ -23,9 +23,9 @@ else: Resource: TypeAlias = str | os.PathLike[Any] def open_binary(package: Package, resource: Resource) -> BinaryIO: ... -def open_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> TextIO: ... +def open_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> TextIO: ... def read_binary(package: Package, resource: Resource) -> bytes: ... -def read_text(package: Package, resource: Resource, encoding: str = ..., errors: str = ...) -> str: ... +def read_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... def path(package: Package, resource: Resource) -> AbstractContextManager[Path]: ... def is_resource(package: Package, name: str) -> bool: ... def contents(package: Package) -> Iterator[str]: ... diff --git a/stdlib/importlib/util.pyi b/stdlib/importlib/util.pyi index e9c08aeccf87..f988eb270a26 100644 --- a/stdlib/importlib/util.pyi +++ b/stdlib/importlib/util.pyi @@ -15,18 +15,18 @@ def resolve_name(name: str, package: str | None) -> str: ... MAGIC_NUMBER: bytes -def cache_from_source(path: str, debug_override: bool | None = ..., *, optimization: Any | None = ...) -> str: ... +def cache_from_source(path: str, debug_override: bool | None = None, *, optimization: Any | None = None) -> str: ... def source_from_cache(path: str) -> str: ... def decode_source(source_bytes: ReadableBuffer) -> str: ... -def find_spec(name: str, package: str | None = ...) -> importlib.machinery.ModuleSpec | None: ... +def find_spec(name: str, package: str | None = None) -> importlib.machinery.ModuleSpec | None: ... def spec_from_loader( - name: str, loader: importlib.abc.Loader | None, *, origin: str | None = ..., is_package: bool | None = ... + name: str, loader: importlib.abc.Loader | None, *, origin: str | None = None, is_package: bool | None = None ) -> importlib.machinery.ModuleSpec | None: ... def spec_from_file_location( name: str, - location: StrOrBytesPath | None = ..., + location: StrOrBytesPath | None = None, *, - loader: importlib.abc.Loader | None = ..., + loader: importlib.abc.Loader | None = None, submodule_search_locations: list[str] | None = ..., ) -> importlib.machinery.ModuleSpec | None: ... def module_from_spec(spec: importlib.machinery.ModuleSpec) -> types.ModuleType: ... diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index ad68aa93c894..588480026c42 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -165,10 +165,10 @@ modulesbyfile: dict[str, Any] _GetMembersPredicate: TypeAlias = Callable[[Any], bool] _GetMembersReturn: TypeAlias = list[tuple[str, Any]] -def getmembers(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ... +def getmembers(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn: ... if sys.version_info >= (3, 11): - def getmembers_static(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ... + def getmembers_static(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn: ... def getmodulename(path: str) -> str | None: ... def ismodule(object: object) -> TypeGuard[ModuleType]: ... @@ -269,12 +269,12 @@ _SourceObjectType: TypeAlias = Union[ ] def findsource(object: _SourceObjectType) -> tuple[list[str], int]: ... -def getabsfile(object: _SourceObjectType, _filename: str | None = ...) -> str: ... +def getabsfile(object: _SourceObjectType, _filename: str | None = None) -> str: ... def getblock(lines: Sequence[str]) -> Sequence[str]: ... def getdoc(object: object) -> str | None: ... def getcomments(object: object) -> str | None: ... def getfile(object: _SourceObjectType) -> str: ... -def getmodule(object: object, _filename: str | None = ...) -> ModuleType | None: ... +def getmodule(object: object, _filename: str | None = None) -> ModuleType | None: ... def getsourcefile(object: _SourceObjectType) -> str | None: ... def getsourcelines(object: _SourceObjectType) -> tuple[list[str], int]: ... def getsource(object: _SourceObjectType) -> str: ... @@ -290,14 +290,14 @@ if sys.version_info >= (3, 10): def signature( obj: _IntrospectableCallable, *, - follow_wrapped: bool = ..., - globals: Mapping[str, Any] | None = ..., - locals: Mapping[str, Any] | None = ..., - eval_str: bool = ..., + follow_wrapped: bool = True, + globals: Mapping[str, Any] | None = None, + locals: Mapping[str, Any] | None = None, + eval_str: bool = False, ) -> Signature: ... else: - def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = ...) -> Signature: ... + def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Signature: ... class _void: ... class _empty: ... @@ -337,9 +337,9 @@ if sys.version_info >= (3, 10): def get_annotations( obj: Callable[..., object] | type[Any] | ModuleType, *, - globals: Mapping[str, Any] | None = ..., - locals: Mapping[str, Any] | None = ..., - eval_str: bool = ..., + globals: Mapping[str, Any] | None = None, + locals: Mapping[str, Any] | None = None, + eval_str: bool = False, ) -> dict[str, Any]: ... # The name is the same as the enum's name in CPython @@ -400,7 +400,7 @@ class BoundArguments: # TODO: The actual return type should be list[_ClassTreeItem] but mypy doesn't # seem to be supporting this at the moment: # _ClassTreeItem = list[_ClassTreeItem] | Tuple[type, Tuple[type, ...]] -def getclasstree(classes: list[type], unique: bool = ...) -> list[Any]: ... +def getclasstree(classes: list[type], unique: bool = False) -> list[Any]: ... def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> list[Any]: ... class Arguments(NamedTuple): @@ -436,7 +436,7 @@ class ArgInfo(NamedTuple): locals: dict[str, Any] def getargvalues(frame: FrameType) -> ArgInfo: ... -def formatannotation(annotation: object, base_module: str | None = ...) -> str: ... +def formatannotation(annotation: object, base_module: str | None = None) -> str: ... def formatannotationrelativeto(object: object) -> Callable[[object], str]: ... if sys.version_info < (3, 11): @@ -476,7 +476,7 @@ class ClosureVars(NamedTuple): unbound: AbstractSet[str] def getclosurevars(func: _IntrospectableCallable) -> ClosureVars: ... -def unwrap(func: Callable[..., Any], *, stop: Callable[[Callable[..., Any]], Any] | None = ...) -> Any: ... +def unwrap(func: Callable[..., Any], *, stop: Callable[[Callable[..., Any]], Any] | None = None) -> Any: ... # # The interpreter stack @@ -541,13 +541,13 @@ else: code_context: list[str] | None index: int | None # type: ignore[assignment] -def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ... -def getouterframes(frame: Any, context: int = ...) -> list[FrameInfo]: ... -def getinnerframes(tb: TracebackType, context: int = ...) -> list[FrameInfo]: ... +def getframeinfo(frame: FrameType | TracebackType, context: int = 1) -> Traceback: ... +def getouterframes(frame: Any, context: int = 1) -> list[FrameInfo]: ... +def getinnerframes(tb: TracebackType, context: int = 1) -> list[FrameInfo]: ... def getlineno(frame: FrameType) -> int: ... def currentframe() -> FrameType | None: ... -def stack(context: int = ...) -> list[FrameInfo]: ... -def trace(context: int = ...) -> list[FrameInfo]: ... +def stack(context: int = 1) -> list[FrameInfo]: ... +def trace(context: int = 1) -> list[FrameInfo]: ... # # Fetching attributes statically diff --git a/stdlib/ipaddress.pyi b/stdlib/ipaddress.pyi index 6580ba4f1ac4..e7142db36b70 100644 --- a/stdlib/ipaddress.pyi +++ b/stdlib/ipaddress.pyi @@ -16,7 +16,7 @@ _RawNetworkPart: TypeAlias = IPv4Network | IPv6Network | IPv4Interface | IPv6Int def ip_address(address: _RawIPAddress) -> IPv4Address | IPv6Address: ... def ip_network( - address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int], strict: bool = ... + address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int], strict: bool = True ) -> IPv4Network | IPv6Network: ... def ip_interface( address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int] diff --git a/stdlib/json/__init__.pyi b/stdlib/json/__init__.pyi index 73bb5e8b4c1a..63e9718ee151 100644 --- a/stdlib/json/__init__.pyi +++ b/stdlib/json/__init__.pyi @@ -10,52 +10,52 @@ __all__ = ["dump", "dumps", "load", "loads", "JSONDecoder", "JSONDecodeError", " def dumps( obj: Any, *, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: type[JSONEncoder] | None = ..., - indent: None | int | str = ..., - separators: tuple[str, str] | None = ..., - default: Callable[[Any], Any] | None = ..., - sort_keys: bool = ..., + skipkeys: bool = False, + ensure_ascii: bool = True, + check_circular: bool = True, + allow_nan: bool = True, + cls: type[JSONEncoder] | None = None, + indent: None | int | str = None, + separators: tuple[str, str] | None = None, + default: Callable[[Any], Any] | None = None, + sort_keys: bool = False, **kwds: Any, ) -> str: ... def dump( obj: Any, fp: SupportsWrite[str], *, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - cls: type[JSONEncoder] | None = ..., - indent: None | int | str = ..., - separators: tuple[str, str] | None = ..., - default: Callable[[Any], Any] | None = ..., - sort_keys: bool = ..., + skipkeys: bool = False, + ensure_ascii: bool = True, + check_circular: bool = True, + allow_nan: bool = True, + cls: type[JSONEncoder] | None = None, + indent: None | int | str = None, + separators: tuple[str, str] | None = None, + default: Callable[[Any], Any] | None = None, + sort_keys: bool = False, **kwds: Any, ) -> None: ... def loads( s: str | bytes | bytearray, *, - cls: type[JSONDecoder] | None = ..., - object_hook: Callable[[dict[Any, Any]], Any] | None = ..., - parse_float: Callable[[str], Any] | None = ..., - parse_int: Callable[[str], Any] | None = ..., - parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ..., + cls: type[JSONDecoder] | None = None, + object_hook: Callable[[dict[Any, Any]], Any] | None = None, + parse_float: Callable[[str], Any] | None = None, + parse_int: Callable[[str], Any] | None = None, + parse_constant: Callable[[str], Any] | None = None, + object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None, **kwds: Any, ) -> Any: ... def load( fp: SupportsRead[str | bytes], *, - cls: type[JSONDecoder] | None = ..., - object_hook: Callable[[dict[Any, Any]], Any] | None = ..., - parse_float: Callable[[str], Any] | None = ..., - parse_int: Callable[[str], Any] | None = ..., - parse_constant: Callable[[str], Any] | None = ..., - object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = ..., + cls: type[JSONDecoder] | None = None, + object_hook: Callable[[dict[Any, Any]], Any] | None = None, + parse_float: Callable[[str], Any] | None = None, + parse_int: Callable[[str], Any] | None = None, + parse_constant: Callable[[str], Any] | None = None, + object_pairs_hook: Callable[[list[tuple[Any, Any]]], Any] | None = None, **kwds: Any, ) -> Any: ... def detect_encoding(b: bytes | bytearray) -> str: ... # undocumented diff --git a/stdlib/lib2to3/pgen2/driver.pyi b/stdlib/lib2to3/pgen2/driver.pyi index 45c9aeaa5691..7f0d5c4bdefa 100644 --- a/stdlib/lib2to3/pgen2/driver.pyi +++ b/stdlib/lib2to3/pgen2/driver.pyi @@ -20,5 +20,5 @@ class Driver: def parse_string(self, text: str, debug: bool = ...) -> _NL: ... def load_grammar( - gt: str = ..., gp: str | None = ..., save: bool = ..., force: bool = ..., logger: Logger | None = ... + gt: str = 'Grammar.txt', gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None ) -> Grammar: ... diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 84ee7ae98bd0..9873447fd851 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -43,4 +43,4 @@ class DFAState: def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override] -def generate_grammar(filename: StrPath = ...) -> PgenGrammar: ... +def generate_grammar(filename: StrPath = 'Grammar.txt') -> PgenGrammar: ... diff --git a/stdlib/lib2to3/refactor.pyi b/stdlib/lib2to3/refactor.pyi index 3aaea0e519d9..ef4c7387037e 100644 --- a/stdlib/lib2to3/refactor.pyi +++ b/stdlib/lib2to3/refactor.pyi @@ -8,7 +8,7 @@ from .pgen2.grammar import Grammar _Driver: TypeAlias = Any # really lib2to3.driver.Driver _BottomMatcher: TypeAlias = Any # really lib2to3.btm_matcher.BottomMatcher -def get_all_fix_names(fixer_pkg: str, remove_prefix: bool = ...) -> list[str]: ... +def get_all_fix_names(fixer_pkg: str, remove_prefix: bool = True) -> list[str]: ... def get_fixers_from_package(pkg_name: str) -> list[str]: ... class FixerError(Exception): ... diff --git a/stdlib/linecache.pyi b/stdlib/linecache.pyi index df54fd80aea7..8e317dd38990 100644 --- a/stdlib/linecache.pyi +++ b/stdlib/linecache.pyi @@ -15,9 +15,9 @@ class _SourceLoader(Protocol): cache: dict[str, _SourceLoader | _ModuleMetadata] # undocumented -def getline(filename: str, lineno: int, module_globals: _ModuleGlobals | None = ...) -> str: ... +def getline(filename: str, lineno: int, module_globals: _ModuleGlobals | None = None) -> str: ... def clearcache() -> None: ... -def getlines(filename: str, module_globals: _ModuleGlobals | None = ...) -> list[str]: ... -def checkcache(filename: str | None = ...) -> None: ... -def updatecache(filename: str, module_globals: _ModuleGlobals | None = ...) -> list[str]: ... +def getlines(filename: str, module_globals: _ModuleGlobals | None = None) -> list[str]: ... +def checkcache(filename: str | None = None) -> None: ... +def updatecache(filename: str, module_globals: _ModuleGlobals | None = None) -> list[str]: ... def lazycache(filename: str, module_globals: _ModuleGlobals) -> bool: ... diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index 9a3ea65d1b8b..99b78b50adff 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -111,19 +111,19 @@ CHAR_MAX: int class Error(Exception): ... -def setlocale(category: int, locale: _str | Iterable[_str | None] | None = ...) -> _str: ... +def setlocale(category: int, locale: _str | Iterable[_str | None] | None = None) -> _str: ... def localeconv() -> Mapping[_str, int | _str | list[int]]: ... def nl_langinfo(__key: int) -> _str: ... def getdefaultlocale(envvars: tuple[_str, ...] = ...) -> tuple[_str | None, _str | None]: ... -def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: ... -def getpreferredencoding(do_setlocale: bool = ...) -> _str: ... +def getlocale(category: int = 2) -> tuple[_str | None, _str | None]: ... +def getpreferredencoding(do_setlocale: bool = True) -> _str: ... def normalize(localename: _str) -> _str: ... -def resetlocale(category: int = ...) -> None: ... +def resetlocale(category: int = 0) -> None: ... def strcoll(__os1: _str, __os2: _str) -> int: ... def strxfrm(__string: _str) -> _str: ... -def format(percent: _str, value: float | Decimal, grouping: bool = ..., monetary: bool = ..., *additional: Any) -> _str: ... -def format_string(f: _str, val: Any, grouping: bool = ..., monetary: bool = ...) -> _str: ... -def currency(val: float | Decimal, symbol: bool = ..., grouping: bool = ..., international: bool = ...) -> _str: ... +def format(percent: _str, value: float | Decimal, grouping: bool = False, monetary: bool = False, *additional: Any) -> _str: ... +def format_string(f: _str, val: Any, grouping: bool = False, monetary: bool = False) -> _str: ... +def currency(val: float | Decimal, symbol: bool = True, grouping: bool = False, international: bool = False) -> _str: ... def delocalize(string: _str) -> _str: ... def atof(string: _str, func: Callable[[_str], float] = ...) -> float: ... def atoi(string: _str) -> int: ... diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index 575fd8f9ee4b..0422481067a2 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -602,7 +602,7 @@ class LoggerAdapter(Generic[_L]): if sys.version_info >= (3, 11): def __class_getitem__(cls, item: Any) -> GenericAlias: ... -def getLogger(name: str | None = ...) -> Logger: ... +def getLogger(name: str | None = None) -> Logger: ... def getLoggerClass() -> type[Logger]: ... def getLogRecordFactory() -> Callable[..., LogRecord]: ... @@ -658,7 +658,7 @@ if sys.version_info >= (3, 8): def exception( msg: object, *args: object, - exc_info: _ExcInfoType = ..., + exc_info: _ExcInfoType = True, stack_info: bool = ..., stacklevel: int = ..., extra: Mapping[str, object] | None = ..., @@ -693,7 +693,7 @@ else: msg: object, *args: object, exc_info: _ExcInfoType = ..., stack_info: bool = ..., extra: Mapping[str, object] | None = ... ) -> None: ... def exception( - msg: object, *args: object, exc_info: _ExcInfoType = ..., stack_info: bool = ..., extra: Mapping[str, object] | None = ... + msg: object, *args: object, exc_info: _ExcInfoType = True, stack_info: bool = ..., extra: Mapping[str, object] | None = ... ) -> None: ... def log( level: int, @@ -706,7 +706,7 @@ else: fatal = critical -def disable(level: int = ...) -> None: ... +def disable(level: int = 50) -> None: ... def addLevelName(level: int, levelName: str) -> None: ... def getLevelName(level: _Level) -> Any: ... diff --git a/stdlib/logging/config.pyi b/stdlib/logging/config.pyi index 12e222680d2e..f76f655a6196 100644 --- a/stdlib/logging/config.pyi +++ b/stdlib/logging/config.pyi @@ -49,18 +49,18 @@ def dictConfig(config: _DictConfigArgs | dict[str, Any]) -> None: ... if sys.version_info >= (3, 10): def fileConfig( fname: StrOrBytesPath | IO[str] | RawConfigParser, - defaults: dict[str, str] | None = ..., - disable_existing_loggers: bool = ..., - encoding: str | None = ..., + defaults: dict[str, str] | None = None, + disable_existing_loggers: bool = True, + encoding: str | None = None, ) -> None: ... else: def fileConfig( fname: StrOrBytesPath | IO[str] | RawConfigParser, - defaults: dict[str, str] | None = ..., - disable_existing_loggers: bool = ..., + defaults: dict[str, str] | None = None, + disable_existing_loggers: bool = True, ) -> None: ... def valid_ident(s: str) -> Literal[True]: ... # undocumented -def listen(port: int = ..., verify: Callable[[bytes], bytes | None] | None = ...) -> Thread: ... +def listen(port: int = 9030, verify: Callable[[bytes], bytes | None] | None = None) -> Thread: ... def stopListening() -> None: ... diff --git a/stdlib/lzma.pyi b/stdlib/lzma.pyi index 9d75c627f76d..f6459689f191 100644 --- a/stdlib/lzma.pyi +++ b/stdlib/lzma.pyi @@ -189,9 +189,9 @@ def open( newline: str | None = ..., ) -> LZMAFile | TextIO: ... def compress( - data: ReadableBuffer, format: int = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... + data: ReadableBuffer, format: int = 1, check: int = ..., preset: int | None = None, filters: _FilterChain | None = None ) -> bytes: ... def decompress( - data: ReadableBuffer, format: int = ..., memlimit: int | None = ..., filters: _FilterChain | None = ... + data: ReadableBuffer, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None ) -> bytes: ... def is_check_supported(__check_id: int) -> bool: ... diff --git a/stdlib/mailcap.pyi b/stdlib/mailcap.pyi index e1637ad6e7be..0acf924e674b 100644 --- a/stdlib/mailcap.pyi +++ b/stdlib/mailcap.pyi @@ -6,6 +6,6 @@ _Cap: TypeAlias = dict[str, str | int] __all__ = ["getcaps", "findmatch"] def findmatch( - caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = ..., filename: str = ..., plist: Sequence[str] = ... + caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = 'view', filename: str = '/dev/null', plist: Sequence[str] = ... ) -> tuple[str | None, _Cap | None]: ... def getcaps() -> dict[str, list[_Cap]]: ... diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index c2b6ff20281a..3b778b23ba2c 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -20,16 +20,16 @@ __all__ = [ ] if sys.version_info >= (3, 8): - def guess_type(url: StrPath, strict: bool = ...) -> tuple[str | None, str | None]: ... + def guess_type(url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ... else: - def guess_type(url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... + def guess_type(url: str, strict: bool = True) -> tuple[str | None, str | None]: ... -def guess_all_extensions(type: str, strict: bool = ...) -> list[str]: ... -def guess_extension(type: str, strict: bool = ...) -> str | None: ... -def init(files: Sequence[str] | None = ...) -> None: ... +def guess_all_extensions(type: str, strict: bool = True) -> list[str]: ... +def guess_extension(type: str, strict: bool = True) -> str | None: ... +def init(files: Sequence[str] | None = None) -> None: ... def read_mime_types(file: str) -> dict[str, str] | None: ... -def add_type(type: str, ext: str, strict: bool = ...) -> None: ... +def add_type(type: str, ext: str, strict: bool = True) -> None: ... inited: bool knownfiles: list[str] diff --git a/stdlib/multiprocessing/connection.pyi b/stdlib/multiprocessing/connection.pyi index 5036f0ef222b..b6bff2e6698b 100644 --- a/stdlib/multiprocessing/connection.pyi +++ b/stdlib/multiprocessing/connection.pyi @@ -55,15 +55,15 @@ class Listener: def deliver_challenge(connection: Connection, authkey: bytes) -> None: ... def answer_challenge(connection: Connection, authkey: bytes) -> None: ... def wait( - object_list: Iterable[Connection | socket.socket | int], timeout: float | None = ... + object_list: Iterable[Connection | socket.socket | int], timeout: float | None = None ) -> list[Connection | socket.socket | int]: ... -def Client(address: _Address, family: str | None = ..., authkey: bytes | None = ...) -> Connection: ... +def Client(address: _Address, family: str | None = None, authkey: bytes | None = None) -> Connection: ... # N.B. Keep this in sync with multiprocessing.context.BaseContext.Pipe. # _ConnectionBase is the common base class of Connection and PipeConnection # and can be used in cross-platform code. if sys.platform != "win32": - def Pipe(duplex: bool = ...) -> tuple[Connection, Connection]: ... + def Pipe(duplex: bool = True) -> tuple[Connection, Connection]: ... else: def Pipe(duplex: bool = ...) -> tuple[PipeConnection, PipeConnection]: ... diff --git a/stdlib/multiprocessing/dummy/__init__.pyi b/stdlib/multiprocessing/dummy/__init__.pyi index 5d289c058e03..a4a8943d8993 100644 --- a/stdlib/multiprocessing/dummy/__init__.pyi +++ b/stdlib/multiprocessing/dummy/__init__.pyi @@ -67,9 +67,9 @@ class Value: value: Any def __init__(self, typecode: Any, value: Any, lock: Any = ...) -> None: ... -def Array(typecode: Any, sequence: Sequence[Any], lock: Any = ...) -> array.array[Any]: ... +def Array(typecode: Any, sequence: Sequence[Any], lock: Any = True) -> array.array[Any]: ... def Manager() -> Any: ... -def Pool(processes: int | None = ..., initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ...) -> Any: ... +def Pool(processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ...) -> Any: ... def active_children() -> list[Any]: ... current_process = threading.current_thread diff --git a/stdlib/multiprocessing/dummy/connection.pyi b/stdlib/multiprocessing/dummy/connection.pyi index fd909d0d32e1..258ae695b915 100644 --- a/stdlib/multiprocessing/dummy/connection.pyi +++ b/stdlib/multiprocessing/dummy/connection.pyi @@ -38,4 +38,4 @@ class Listener: def close(self) -> None: ... def Client(address: _Address) -> Connection: ... -def Pipe(duplex: bool = ...) -> tuple[Connection, Connection]: ... +def Pipe(duplex: bool = True) -> tuple[Connection, Connection]: ... diff --git a/stdlib/multiprocessing/forkserver.pyi b/stdlib/multiprocessing/forkserver.pyi index 10269dfbba29..c8b5285bafc8 100644 --- a/stdlib/multiprocessing/forkserver.pyi +++ b/stdlib/multiprocessing/forkserver.pyi @@ -18,8 +18,8 @@ def main( listener_fd: int | None, alive_r: FileDescriptorLike, preload: Sequence[str], - main_path: str | None = ..., - sys_path: object | None = ..., + main_path: str | None = None, + sys_path: object | None = None, ) -> None: ... def read_signed(fd: int) -> Any: ... def write_signed(fd: int, n: int) -> None: ... diff --git a/stdlib/multiprocessing/reduction.pyi b/stdlib/multiprocessing/reduction.pyi index d6b70aefa48d..12b5f07ed31e 100644 --- a/stdlib/multiprocessing/reduction.pyi +++ b/stdlib/multiprocessing/reduction.pyi @@ -29,7 +29,7 @@ class ForkingPickler(pickle.Pickler): register = ForkingPickler.register -def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = ...) -> None: ... +def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None) -> None: ... if sys.platform == "win32": if sys.version_info >= (3, 8): diff --git a/stdlib/multiprocessing/resource_sharer.pyi b/stdlib/multiprocessing/resource_sharer.pyi index 7708df9b6f3c..5fee7cf31e17 100644 --- a/stdlib/multiprocessing/resource_sharer.pyi +++ b/stdlib/multiprocessing/resource_sharer.pyi @@ -17,4 +17,4 @@ else: def __init__(self, fd: int) -> None: ... def detach(self) -> int: ... -def stop(timeout: float | None = ...) -> None: ... +def stop(timeout: float | None = None) -> None: ... diff --git a/stdlib/multiprocessing/spawn.pyi b/stdlib/multiprocessing/spawn.pyi index 50570ff3717b..26ff165756bf 100644 --- a/stdlib/multiprocessing/spawn.pyi +++ b/stdlib/multiprocessing/spawn.pyi @@ -20,7 +20,7 @@ def get_executable() -> str: ... def is_forking(argv: Sequence[str]) -> bool: ... def freeze_support() -> None: ... def get_command_line(**kwds: Any) -> list[str]: ... -def spawn_main(pipe_handle: int, parent_pid: int | None = ..., tracker_fd: int | None = ...) -> None: ... +def spawn_main(pipe_handle: int, parent_pid: int | None = None, tracker_fd: int | None = None) -> None: ... # undocumented def _main(fd: int) -> Any: ... diff --git a/stdlib/multiprocessing/util.pyi b/stdlib/multiprocessing/util.pyi index 263781da9432..23089cb816ed 100644 --- a/stdlib/multiprocessing/util.pyi +++ b/stdlib/multiprocessing/util.pyi @@ -37,7 +37,7 @@ def debug(msg: object, *args: object) -> None: ... def info(msg: object, *args: object) -> None: ... def sub_warning(msg: object, *args: object) -> None: ... def get_logger() -> Logger: ... -def log_to_stderr(level: _LoggingLevel | None = ...) -> Logger: ... +def log_to_stderr(level: _LoggingLevel | None = None) -> Logger: ... def is_abstract_socket_namespace(address: str | bytes | None) -> bool: ... abstract_sockets_supported: bool diff --git a/stdlib/opcode.pyi b/stdlib/opcode.pyi index 402dbb74cf58..08871eb68902 100644 --- a/stdlib/opcode.pyi +++ b/stdlib/opcode.pyi @@ -49,7 +49,7 @@ HAVE_ARGUMENT: Literal[90] EXTENDED_ARG: Literal[144] if sys.version_info >= (3, 8): - def stack_effect(__opcode: int, __oparg: int | None = ..., *, jump: bool | None = ...) -> int: ... + def stack_effect(__opcode: int, __oparg: int | None = ..., *, jump: bool | None = None) -> int: ... else: def stack_effect(__opcode: int, __oparg: int | None = ...) -> int: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 590d20576665..ece20ba32a26 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -438,7 +438,7 @@ def fspath(path: str) -> str: ... def fspath(path: bytes) -> bytes: ... @overload def fspath(path: PathLike[AnyStr]) -> AnyStr: ... -def get_exec_path(env: Mapping[str, str] | None = ...) -> list[str]: ... +def get_exec_path(env: Mapping[str, str] | None = None) -> list[str]: ... def getlogin() -> str: ... def getpid() -> int: ... def getppid() -> int: ... @@ -595,7 +595,7 @@ def close(fd: int) -> None: ... def closerange(__fd_low: int, __fd_high: int) -> None: ... def device_encoding(fd: int) -> str | None: ... def dup(__fd: int) -> int: ... -def dup2(fd: int, fd2: int, inheritable: bool = ...) -> int: ... +def dup2(fd: int, fd2: int, inheritable: bool = True) -> int: ... def fstat(fd: int) -> stat_result: ... def ftruncate(__fd: int, __length: int) -> None: ... def fsync(fd: FileDescriptorLike) -> None: ... @@ -605,7 +605,7 @@ if sys.platform != "win32" and sys.version_info >= (3, 11): def login_tty(__fd: int) -> None: ... def lseek(__fd: int, __position: int, __how: int) -> int: ... -def open(path: StrOrBytesPath, flags: int, mode: int = ..., *, dir_fd: int | None = ...) -> int: ... +def open(path: StrOrBytesPath, flags: int, mode: int = 511, *, dir_fd: int | None = None) -> int: ... def pipe() -> tuple[int, int]: ... def read(__fd: int, __length: int) -> bytes: ... @@ -676,7 +676,7 @@ if sys.platform != "win32": def write(__fd: int, __data: ReadableBuffer) -> int: ... def access( - path: _FdOrAnyPath, mode: int, *, dir_fd: int | None = ..., effective_ids: bool = ..., follow_symlinks: bool = ... + path: _FdOrAnyPath, mode: int, *, dir_fd: int | None = None, effective_ids: bool = False, follow_symlinks: bool = True ) -> bool: ... def chdir(path: _FdOrAnyPath) -> None: ... @@ -685,48 +685,48 @@ if sys.platform != "win32": def getcwd() -> str: ... def getcwdb() -> bytes: ... -def chmod(path: _FdOrAnyPath, mode: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> None: ... +def chmod(path: _FdOrAnyPath, mode: int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... if sys.platform != "win32" and sys.platform != "linux": - def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = ...) -> None: ... # some flavors of Unix + def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = True) -> None: ... # some flavors of Unix def lchflags(path: StrOrBytesPath, flags: int) -> None: ... def lchmod(path: StrOrBytesPath, mode: int) -> None: ... if sys.platform != "win32": def chroot(path: StrOrBytesPath) -> None: ... - def chown(path: _FdOrAnyPath, uid: int, gid: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> None: ... + def chown(path: _FdOrAnyPath, uid: int, gid: int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... def lchown(path: StrOrBytesPath, uid: int, gid: int) -> None: ... def link( src: StrOrBytesPath, dst: StrOrBytesPath, *, - src_dir_fd: int | None = ..., - dst_dir_fd: int | None = ..., - follow_symlinks: bool = ..., + src_dir_fd: int | None = None, + dst_dir_fd: int | None = None, + follow_symlinks: bool = True, ) -> None: ... -def lstat(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> stat_result: ... -def mkdir(path: StrOrBytesPath, mode: int = ..., *, dir_fd: int | None = ...) -> None: ... +def lstat(path: StrOrBytesPath, *, dir_fd: int | None = None) -> stat_result: ... +def mkdir(path: StrOrBytesPath, mode: int = 511, *, dir_fd: int | None = None) -> None: ... if sys.platform != "win32": - def mkfifo(path: StrOrBytesPath, mode: int = ..., *, dir_fd: int | None = ...) -> None: ... # Unix only + def mkfifo(path: StrOrBytesPath, mode: int = 438, *, dir_fd: int | None = None) -> None: ... # Unix only -def makedirs(name: StrOrBytesPath, mode: int = ..., exist_ok: bool = ...) -> None: ... +def makedirs(name: StrOrBytesPath, mode: int = 511, exist_ok: bool = False) -> None: ... if sys.platform != "win32": - def mknod(path: StrOrBytesPath, mode: int = ..., device: int = ..., *, dir_fd: int | None = ...) -> None: ... + def mknod(path: StrOrBytesPath, mode: int = 384, device: int = 0, *, dir_fd: int | None = None) -> None: ... def major(__device: int) -> int: ... def minor(__device: int) -> int: ... def makedev(__major: int, __minor: int) -> int: ... def pathconf(path: _FdOrAnyPath, name: str | int) -> int: ... # Unix only -def readlink(path: GenericPath[AnyStr], *, dir_fd: int | None = ...) -> AnyStr: ... -def remove(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... +def readlink(path: GenericPath[AnyStr], *, dir_fd: int | None = None) -> AnyStr: ... +def remove(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... def removedirs(name: StrOrBytesPath) -> None: ... -def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = ..., dst_dir_fd: int | None = ...) -> None: ... +def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: ... -def replace(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = ..., dst_dir_fd: int | None = ...) -> None: ... -def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... +def replace(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... +def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr]]): def __next__(self) -> DirEntry[AnyStr]: ... @@ -739,18 +739,18 @@ def scandir(path: None = ...) -> _ScandirIterator[str]: ... def scandir(path: int) -> _ScandirIterator[str]: ... @overload def scandir(path: GenericPath[AnyStr]) -> _ScandirIterator[AnyStr]: ... -def stat(path: _FdOrAnyPath, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> stat_result: ... +def stat(path: _FdOrAnyPath, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> stat_result: ... if sys.platform != "win32": def statvfs(path: _FdOrAnyPath) -> statvfs_result: ... # Unix only -def symlink(src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = ..., *, dir_fd: int | None = ...) -> None: ... +def symlink(src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None) -> None: ... if sys.platform != "win32": def sync() -> None: ... # Unix only def truncate(path: _FdOrAnyPath, length: int) -> None: ... # Unix only up to version 3.4 -def unlink(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... +def unlink(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... def utime( path: _FdOrAnyPath, times: tuple[int, int] | tuple[float, float] | None = ..., @@ -763,7 +763,7 @@ def utime( _OnError: TypeAlias = Callable[[OSError], object] def walk( - top: GenericPath[AnyStr], topdown: bool = ..., onerror: _OnError | None = ..., followlinks: bool = ... + top: GenericPath[AnyStr], topdown: bool = True, onerror: _OnError | None = None, followlinks: bool = False ) -> Iterator[tuple[AnyStr, list[AnyStr], list[AnyStr]]]: ... if sys.platform != "win32": @@ -844,7 +844,7 @@ class _wrap_close(_TextIOWrapper): def __init__(self, stream: _TextIOWrapper, proc: Popen[str]) -> None: ... def close(self) -> int | None: ... # type: ignore[override] -def popen(cmd: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ... +def popen(cmd: str, mode: str = 'r', buffering: int = ...) -> _wrap_close: ... def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig diff --git a/stdlib/pdb.pyi b/stdlib/pdb.pyi index 6e95dcff6ee2..bcdd66539074 100644 --- a/stdlib/pdb.pyi +++ b/stdlib/pdb.pyi @@ -18,12 +18,12 @@ line_prefix: str # undocumented class Restart(Exception): ... -def run(statement: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... -def runeval(expression: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> Any: ... +def run(statement: str, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None) -> None: ... +def runeval(expression: str, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None) -> Any: ... def runctx(statement: str, globals: dict[str, Any], locals: Mapping[str, Any]) -> None: ... def runcall(func: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> _T | None: ... -def set_trace(*, header: str | None = ...) -> None: ... -def post_mortem(t: TracebackType | None = ...) -> None: ... +def set_trace(*, header: str | None = None) -> None: ... +def post_mortem(t: TracebackType | None = None) -> None: ... def pm() -> None: ... class Pdb(Bdb, Cmd): diff --git a/stdlib/pickle.pyi b/stdlib/pickle.pyi index f393452069a3..b61f7959ea77 100644 --- a/stdlib/pickle.pyi +++ b/stdlib/pickle.pyi @@ -107,36 +107,36 @@ if sys.version_info >= (3, 8): def dump( obj: Any, file: SupportsWrite[bytes], - protocol: int | None = ..., + protocol: int | None = None, *, - fix_imports: bool = ..., - buffer_callback: _BufferCallback = ..., + fix_imports: bool = True, + buffer_callback: _BufferCallback = None, ) -> None: ... def dumps( - obj: Any, protocol: int | None = ..., *, fix_imports: bool = ..., buffer_callback: _BufferCallback = ... + obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None ) -> bytes: ... def load( file: _ReadableFileobj, *, - fix_imports: bool = ..., - encoding: str = ..., - errors: str = ..., + fix_imports: bool = True, + encoding: str = 'ASCII', + errors: str = 'strict', buffers: Iterable[Any] | None = ..., ) -> Any: ... def loads( __data: ReadableBuffer, *, - fix_imports: bool = ..., - encoding: str = ..., - errors: str = ..., + fix_imports: bool = True, + encoding: str = 'ASCII', + errors: str = 'strict', buffers: Iterable[Any] | None = ..., ) -> Any: ... else: - def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ... - def dumps(obj: Any, protocol: int | None = ..., *, fix_imports: bool = ...) -> bytes: ... - def load(file: _ReadableFileobj, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... - def loads(data: ReadableBuffer, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... + def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None, *, fix_imports: bool = True) -> None: ... + def dumps(obj: Any, protocol: int | None = None, *, fix_imports: bool = True) -> bytes: ... + def load(file: _ReadableFileobj, *, fix_imports: bool = True, encoding: str = 'ASCII', errors: str = 'strict') -> Any: ... + def loads(data: ReadableBuffer, *, fix_imports: bool = True, encoding: str = 'ASCII', errors: str = 'strict') -> Any: ... class PickleError(Exception): ... class PicklingError(PickleError): ... diff --git a/stdlib/pickletools.pyi b/stdlib/pickletools.pyi index 2f0d5f12f8a3..542172814926 100644 --- a/stdlib/pickletools.pyi +++ b/stdlib/pickletools.pyi @@ -40,7 +40,7 @@ def read_uint8(f: IO[bytes]) -> int: ... uint8: ArgumentDescriptor -def read_stringnl(f: IO[bytes], decode: bool = ..., stripquotes: bool = ...) -> bytes | str: ... +def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True) -> bytes | str: ... stringnl: ArgumentDescriptor @@ -160,8 +160,8 @@ def genops(pickle: bytes | bytearray | IO[bytes]) -> Iterator[tuple[OpcodeInfo, def optimize(p: bytes | bytearray | IO[bytes]) -> bytes: ... def dis( pickle: bytes | bytearray | IO[bytes], - out: IO[str] | None = ..., - memo: MutableMapping[int, Any] | None = ..., - indentlevel: int = ..., - annotate: int = ..., + out: IO[str] | None = None, + memo: MutableMapping[int, Any] | None = None, + indentlevel: int = 4, + annotate: int = 0, ) -> None: ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index f91ab78ff35d..488ed824302a 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -37,11 +37,11 @@ class ImpLoader: def find_loader(fullname: str) -> Loader | None: ... def get_importer(path_item: str) -> PathEntryFinder | None: ... def get_loader(module_or_name: str) -> Loader | None: ... -def iter_importers(fullname: str = ...) -> Iterator[MetaPathFinder | PathEntryFinder]: ... -def iter_modules(path: Iterable[str] | None = ..., prefix: str = ...) -> Iterator[ModuleInfo]: ... +def iter_importers(fullname: str = '') -> Iterator[MetaPathFinder | PathEntryFinder]: ... +def iter_modules(path: Iterable[str] | None = None, prefix: str = '') -> Iterator[ModuleInfo]: ... def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented def walk_packages( - path: Iterable[str] | None = ..., prefix: str = ..., onerror: Callable[[str], object] | None = ... + path: Iterable[str] | None = None, prefix: str = '', onerror: Callable[[str], object] | None = None ) -> Iterator[ModuleInfo]: ... def get_data(package: str, resource: str) -> bytes | None: ... diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index 765a7a5ea5f9..a0b483348c9f 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -7,10 +7,10 @@ if sys.version_info < (3, 8): from typing import NamedTuple if sys.version_info >= (3, 8): - def libc_ver(executable: str | None = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> tuple[str, str]: ... + def libc_ver(executable: str | None = None, lib: str = '', version: str = '', chunksize: int = 16384) -> tuple[str, str]: ... else: - def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> tuple[str, str]: ... + def libc_ver(executable: str = None, lib: str = '', version: str = '', chunksize: int = 16384) -> tuple[str, str]: ... if sys.version_info < (3, 8): def linux_distribution( @@ -24,20 +24,20 @@ if sys.version_info < (3, 8): distname: str = ..., version: str = ..., id: str = ..., supported_dists: tuple[str, ...] = ... ) -> tuple[str, str, str]: ... -def win32_ver(release: str = ..., version: str = ..., csd: str = ..., ptype: str = ...) -> tuple[str, str, str, str]: ... +def win32_ver(release: str = '', version: str = '', csd: str = '', ptype: str = '') -> tuple[str, str, str, str]: ... if sys.version_info >= (3, 8): def win32_edition() -> str: ... def win32_is_iot() -> bool: ... def mac_ver( - release: str = ..., versioninfo: tuple[str, str, str] = ..., machine: str = ... + release: str = '', versioninfo: tuple[str, str, str] = ..., machine: str = '' ) -> tuple[str, tuple[str, str, str], str]: ... def java_ver( - release: str = ..., vendor: str = ..., vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... + release: str = '', vendor: str = '', vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... ) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... -def architecture(executable: str = ..., bits: str = ..., linkage: str = ...) -> tuple[str, str]: ... +def architecture(executable: str = '/Users/jelle/py/venvs/py311/bin/python', bits: str = '', linkage: str = '') -> tuple[str, str]: ... class uname_result(NamedTuple): system: str @@ -61,7 +61,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 = 0, terse: bool = 0) -> str: ... if sys.version_info >= (3, 10): def freedesktop_os_release() -> dict[str, str]: ... diff --git a/stdlib/plistlib.pyi b/stdlib/plistlib.pyi index 4ec9cbd5a31c..9ba83b41cf3a 100644 --- a/stdlib/plistlib.pyi +++ b/stdlib/plistlib.pyi @@ -47,23 +47,23 @@ FMT_XML = PlistFormat.FMT_XML FMT_BINARY = PlistFormat.FMT_BINARY if sys.version_info >= (3, 9): - def load(fp: IO[bytes], *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ... + def load(fp: IO[bytes], *, fmt: PlistFormat | None = None, dict_type: type[MutableMapping[str, Any]] = ...) -> Any: ... def loads( - value: ReadableBuffer, *, fmt: PlistFormat | None = ..., dict_type: type[MutableMapping[str, Any]] = ... + value: ReadableBuffer, *, fmt: PlistFormat | None = None, dict_type: type[MutableMapping[str, Any]] = ... ) -> Any: ... else: def load( fp: IO[bytes], *, - fmt: PlistFormat | None = ..., + fmt: PlistFormat | None = None, use_builtin_types: bool = ..., dict_type: type[MutableMapping[str, Any]] = ..., ) -> Any: ... def loads( value: ReadableBuffer, *, - fmt: PlistFormat | None = ..., + fmt: PlistFormat | None = None, use_builtin_types: bool = ..., dict_type: type[MutableMapping[str, Any]] = ..., ) -> Any: ... @@ -73,15 +73,15 @@ def dump( fp: IO[bytes], *, fmt: PlistFormat = ..., - sort_keys: bool = ..., - skipkeys: bool = ..., + sort_keys: bool = True, + skipkeys: bool = False, ) -> None: ... def dumps( value: Mapping[str, Any] | list[Any] | tuple[Any, ...] | str | bool | float | bytes | bytearray | datetime, *, fmt: PlistFormat = ..., - skipkeys: bool = ..., - sort_keys: bool = ..., + skipkeys: bool = False, + sort_keys: bool = True, ) -> bytes: ... if sys.version_info < (3, 9): diff --git a/stdlib/pprint.pyi b/stdlib/pprint.pyi index 0addc8f538b2..98f474f12a0a 100644 --- a/stdlib/pprint.pyi +++ b/stdlib/pprint.pyi @@ -9,28 +9,28 @@ else: if sys.version_info >= (3, 10): def pformat( object: object, - indent: int = ..., - width: int = ..., - depth: int | None = ..., + indent: int = 1, + width: int = 80, + depth: int | None = None, *, - compact: bool = ..., - sort_dicts: bool = ..., - underscore_numbers: bool = ..., + compact: bool = False, + sort_dicts: bool = True, + underscore_numbers: bool = False, ) -> str: ... elif sys.version_info >= (3, 8): def pformat( object: object, - indent: int = ..., - width: int = ..., - depth: int | None = ..., + indent: int = 1, + width: int = 80, + depth: int | None = None, *, - compact: bool = ..., - sort_dicts: bool = ..., + compact: bool = False, + sort_dicts: bool = True, ) -> str: ... else: - def pformat(object: object, indent: int = ..., width: int = ..., depth: int | None = ..., *, compact: bool = ...) -> str: ... + def pformat(object: object, indent: int = 1, width: int = 80, depth: int | None = None, *, compact: bool = False) -> str: ... if sys.version_info >= (3, 10): def pp( @@ -41,7 +41,7 @@ if sys.version_info >= (3, 10): depth: int | None = ..., *, compact: bool = ..., - sort_dicts: bool = ..., + sort_dicts: bool = False, underscore_numbers: bool = ..., ) -> None: ... @@ -54,43 +54,43 @@ elif sys.version_info >= (3, 8): depth: int | None = ..., *, compact: bool = ..., - sort_dicts: bool = ..., + sort_dicts: bool = False, ) -> None: ... if sys.version_info >= (3, 10): def pprint( object: object, - stream: IO[str] | None = ..., - indent: int = ..., - width: int = ..., - depth: int | None = ..., + stream: IO[str] | None = None, + indent: int = 1, + width: int = 80, + depth: int | None = None, *, - compact: bool = ..., - sort_dicts: bool = ..., - underscore_numbers: bool = ..., + compact: bool = False, + sort_dicts: bool = True, + underscore_numbers: bool = False, ) -> None: ... elif sys.version_info >= (3, 8): def pprint( object: object, - stream: IO[str] | None = ..., - indent: int = ..., - width: int = ..., - depth: int | None = ..., + stream: IO[str] | None = None, + indent: int = 1, + width: int = 80, + depth: int | None = None, *, - compact: bool = ..., - sort_dicts: bool = ..., + compact: bool = False, + sort_dicts: bool = True, ) -> None: ... else: def pprint( object: object, - stream: IO[str] | None = ..., - indent: int = ..., - width: int = ..., - depth: int | None = ..., + stream: IO[str] | None = None, + indent: int = 1, + width: int = 80, + depth: int | None = None, *, - compact: bool = ..., + compact: bool = False, ) -> None: ... def isreadable(object: object) -> bool: ... diff --git a/stdlib/profile.pyi b/stdlib/profile.pyi index 4b3f832d3224..bca5a3edc2b8 100644 --- a/stdlib/profile.pyi +++ b/stdlib/profile.pyi @@ -5,9 +5,9 @@ from typing_extensions import ParamSpec, TypeAlias __all__ = ["run", "runctx", "Profile"] -def run(statement: str, filename: str | None = ..., sort: str | int = ...) -> None: ... +def run(statement: str, filename: str | None = None, sort: str | int = ...) -> None: ... def runctx( - statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = ..., sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = None, sort: str | int = ... ) -> None: ... _T = TypeVar("_T") diff --git a/stdlib/py_compile.pyi b/stdlib/py_compile.pyi index 1e9b6c2cb209..83350566412f 100644 --- a/stdlib/py_compile.pyi +++ b/stdlib/py_compile.pyi @@ -21,22 +21,22 @@ def _get_default_invalidation_mode() -> PycInvalidationMode: ... if sys.version_info >= (3, 8): def compile( file: AnyStr, - cfile: AnyStr | None = ..., - dfile: AnyStr | None = ..., - doraise: bool = ..., + cfile: AnyStr | None = None, + dfile: AnyStr | None = None, + doraise: bool = False, optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., - quiet: int = ..., + invalidation_mode: PycInvalidationMode | None = None, + quiet: int = 0, ) -> AnyStr | None: ... else: def compile( file: AnyStr, - cfile: AnyStr | None = ..., - dfile: AnyStr | None = ..., - doraise: bool = ..., + cfile: AnyStr | None = None, + dfile: AnyStr | None = None, + doraise: bool = False, optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = ..., + invalidation_mode: PycInvalidationMode | None = None, ) -> AnyStr | None: ... if sys.version_info >= (3, 10): diff --git a/stdlib/pyclbr.pyi b/stdlib/pyclbr.pyi index ab19b44d7d79..eadb7118e269 100644 --- a/stdlib/pyclbr.pyi +++ b/stdlib/pyclbr.pyi @@ -62,5 +62,5 @@ class Function: else: def __init__(self, module: str, name: str, file: str, lineno: int, parent: Function | Class | None = ...) -> None: ... -def readmodule(module: str, path: Sequence[str] | None = ...) -> dict[str, Class]: ... -def readmodule_ex(module: str, path: Sequence[str] | None = ...) -> dict[str, Class | Function | list[str]]: ... +def readmodule(module: str, path: Sequence[str] | None = None) -> dict[str, Class]: ... +def readmodule_ex(module: str, path: Sequence[str] | None = None) -> dict[str, Class | Function | list[str]]: ... diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 0dd2739797f9..dc19ea19b73f 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -26,7 +26,7 @@ def replace(text: AnyStr, *pairs: AnyStr) -> AnyStr: ... def cram(text: str, maxlen: int) -> str: ... def stripid(text: str) -> str: ... def allmethods(cl: type) -> MutableMapping[str, MethodType]: ... -def visiblename(name: str, all: Container[str] | None = ..., obj: object | None = ...) -> bool: ... +def visiblename(name: str, all: Container[str] | None = None, obj: object | None = None) -> bool: ... def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ... def ispackage(path: str) -> bool: ... def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ... @@ -40,7 +40,7 @@ class ErrorDuringImport(Exception): def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ... def importfile(path: str) -> ModuleType: ... -def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ... +def safeimport(path: str, forceload: bool = 0, cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ... class Doc: PYTHONDOCS: str @@ -186,16 +186,16 @@ def tempfilepager(text: str, cmd: str) -> None: ... def ttypager(text: str) -> None: ... def plainpager(text: str) -> None: ... def describe(thing: Any) -> str: ... -def locate(path: str, forceload: bool = ...) -> object: ... +def locate(path: str, forceload: bool = 0) -> object: ... text: TextDoc html: HTMLDoc -def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ... -def render_doc(thing: str | object, title: str = ..., forceload: bool = ..., renderer: Doc | None = ...) -> str: ... -def doc(thing: str | object, title: str = ..., forceload: bool = ..., output: SupportsWrite[str] | None = ...) -> None: ... -def writedoc(thing: str | object, forceload: bool = ...) -> None: ... -def writedocs(dir: str, pkgpath: str = ..., done: Any | None = ...) -> None: ... +def resolve(thing: str | object, forceload: bool = 0) -> tuple[object, str] | None: ... +def render_doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = 0, renderer: Doc | None = None) -> str: ... +def doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = 0, output: SupportsWrite[str] | None = None) -> None: ... +def writedoc(thing: str | object, forceload: bool = 0) -> None: ... +def writedocs(dir: str, pkgpath: str = '', done: Any | None = None) -> None: ... class Helper: keywords: dict[str, str | tuple[str, str]] diff --git a/stdlib/quopri.pyi b/stdlib/quopri.pyi index 549413226bdb..336f733f64c0 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 = ...) -> None: ... -def encodestring(s: ReadableBuffer, quotetabs: int = ..., header: int = ...) -> bytes: ... -def decode(input: _Input, output: SupportsWrite[bytes], header: int = ...) -> None: ... -def decodestring(s: str | ReadableBuffer, header: int = ...) -> bytes: ... +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: ... diff --git a/stdlib/re.pyi b/stdlib/re.pyi index 3e52d209eb87..4962ab8edad9 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -267,4 +267,4 @@ def subn( ) -> tuple[bytes, int]: ... def escape(pattern: AnyStr) -> AnyStr: ... def purge() -> None: ... -def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = ...) -> Pattern[AnyStr]: ... +def template(pattern: AnyStr | Pattern[AnyStr], flags: _FlagsType = 0) -> Pattern[AnyStr]: ... diff --git a/stdlib/reprlib.pyi b/stdlib/reprlib.pyi index 9955f12627a3..4f2126d1e32e 100644 --- a/stdlib/reprlib.pyi +++ b/stdlib/reprlib.pyi @@ -8,7 +8,7 @@ __all__ = ["Repr", "repr", "recursive_repr"] _ReprFunc: TypeAlias = Callable[[Any], str] -def recursive_repr(fillvalue: str = ...) -> Callable[[_ReprFunc], _ReprFunc]: ... +def recursive_repr(fillvalue: str = '...') -> Callable[[_ReprFunc], _ReprFunc]: ... class Repr: maxlevel: int diff --git a/stdlib/runpy.pyi b/stdlib/runpy.pyi index 256f8dab14e9..5d4b15383c6a 100644 --- a/stdlib/runpy.pyi +++ b/stdlib/runpy.pyi @@ -18,6 +18,6 @@ class _ModifiedArgv0: def __exit__(self, *args: object) -> None: ... def run_module( - mod_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ..., alter_sys: bool = ... + mod_name: str, init_globals: dict[str, Any] | None = None, run_name: str | None = None, alter_sys: bool = False ) -> dict[str, Any]: ... -def run_path(path_name: str, init_globals: dict[str, Any] | None = ..., run_name: str | None = ...) -> dict[str, Any]: ... +def run_path(path_name: str, init_globals: dict[str, Any] | None = None, run_name: str | None = None) -> dict[str, Any]: ... diff --git a/stdlib/secrets.pyi b/stdlib/secrets.pyi index 99b7c14ebafc..4861b6f09340 100644 --- a/stdlib/secrets.pyi +++ b/stdlib/secrets.pyi @@ -10,6 +10,6 @@ _T = TypeVar("_T") def randbelow(exclusive_upper_bound: int) -> int: ... def randbits(k: int) -> int: ... def choice(seq: SupportsLenAndGetItem[_T]) -> _T: ... -def token_bytes(nbytes: int | None = ...) -> bytes: ... -def token_hex(nbytes: int | None = ...) -> str: ... -def token_urlsafe(nbytes: int | None = ...) -> str: ... +def token_bytes(nbytes: int | None = None) -> bytes: ... +def token_hex(nbytes: int | None = None) -> str: ... +def token_urlsafe(nbytes: int | None = None) -> str: ... diff --git a/stdlib/shelve.pyi b/stdlib/shelve.pyi index c801ecd3f186..308f46fdac01 100644 --- a/stdlib/shelve.pyi +++ b/stdlib/shelve.pyi @@ -40,4 +40,4 @@ class BsdDbShelf(Shelf[_VT]): class DbfilenameShelf(Shelf[_VT]): def __init__(self, filename: str, flag: _TFlags = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ... -def open(filename: str, flag: _TFlags = ..., protocol: int | None = ..., writeback: bool = ...) -> Shelf[Any]: ... +def open(filename: str, flag: _TFlags = 'c', protocol: int | None = None, writeback: bool = False) -> Shelf[Any]: ... diff --git a/stdlib/shlex.pyi b/stdlib/shlex.pyi index f9d660594a5a..f30c9ac3f22e 100644 --- a/stdlib/shlex.pyi +++ b/stdlib/shlex.pyi @@ -8,7 +8,7 @@ if sys.version_info >= (3, 8): else: __all__ = ["shlex", "split", "quote"] -def split(s: str, comments: bool = ..., posix: bool = ...) -> list[str]: ... +def split(s: str, comments: bool = False, posix: bool = True) -> list[str]: ... if sys.version_info >= (3, 8): def join(split_command: Iterable[str]) -> str: ... diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index 568879d76003..4de25c11062a 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -47,10 +47,10 @@ class ExecError(OSError): ... class ReadError(OSError): ... class RegistryError(Exception): ... -def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ... -def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = ...) -> _StrOrBytesPathT: ... -def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = ...) -> None: ... -def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = ...) -> None: ... +def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = 0) -> None: ... +def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = True) -> _StrOrBytesPathT: ... +def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... +def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... @overload def copy(src: StrPath, dst: StrPath, *, follow_symlinks: bool = ...) -> _PathReturn: ... @overload @@ -65,21 +65,21 @@ if sys.version_info >= (3, 8): def copytree( src: StrPath, dst: StrPath, - symlinks: bool = ..., - ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ..., + symlinks: bool = False, + ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = None, copy_function: Callable[[str, str], object] = ..., - ignore_dangling_symlinks: bool = ..., - dirs_exist_ok: bool = ..., + ignore_dangling_symlinks: bool = False, + dirs_exist_ok: bool = False, ) -> _PathReturn: ... else: def copytree( src: StrPath, dst: StrPath, - symlinks: bool = ..., - ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ..., + symlinks: bool = False, + ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = None, copy_function: Callable[[str, str], object] = ..., - ignore_dangling_symlinks: bool = ..., + ignore_dangling_symlinks: bool = False, ) -> _PathReturn: ... _OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], Any, Any], object] @@ -139,18 +139,18 @@ if sys.version_info >= (3, 8): def which(cmd: bytes, mode: int = ..., path: StrPath | None = ...) -> bytes | None: ... else: - def which(cmd: _StrPathT, mode: int = ..., path: StrPath | None = ...) -> str | _StrPathT | None: ... + def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ... def make_archive( base_name: str, format: str, - root_dir: StrPath | None = ..., - base_dir: StrPath | None = ..., - verbose: bool = ..., - dry_run: bool = ..., - owner: str | None = ..., - group: str | None = ..., - logger: Any | None = ..., + root_dir: StrPath | None = None, + base_dir: StrPath | None = None, + verbose: bool = 0, + dry_run: bool = 0, + owner: str | None = None, + group: str | None = None, + logger: Any | None = None, ) -> str: ... def get_archive_formats() -> list[tuple[str, str]]: ... @overload @@ -162,7 +162,7 @@ def register_archive_format( name: str, function: Callable[[str, str], object], extra_args: None = ..., description: str = ... ) -> None: ... def unregister_archive_format(name: str) -> None: ... -def unpack_archive(filename: StrPath, extract_dir: StrPath | None = ..., format: str | None = ...) -> None: ... +def unpack_archive(filename: StrPath, extract_dir: StrPath | None = None, format: str | None = None) -> None: ... @overload def register_unpack_format( name: str, diff --git a/stdlib/site.pyi b/stdlib/site.pyi index 53199db0eaf3..a8c6bcb417f4 100644 --- a/stdlib/site.pyi +++ b/stdlib/site.pyi @@ -9,14 +9,14 @@ USER_BASE: str | None def main() -> None: ... def abs_paths() -> None: ... # undocumented def addpackage(sitedir: StrPath, name: StrPath, known_paths: set[str] | None) -> set[str] | None: ... # undocumented -def addsitedir(sitedir: str, known_paths: set[str] | None = ...) -> None: ... -def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = ...) -> set[str] | None: ... # undocumented +def addsitedir(sitedir: str, known_paths: set[str] | None = None) -> None: ... +def addsitepackages(known_paths: set[str] | None, prefixes: Iterable[str] | None = None) -> set[str] | None: ... # undocumented def addusersitepackages(known_paths: set[str] | None) -> set[str] | None: ... # undocumented def check_enableusersite() -> bool | None: ... # undocumented def enablerlcompleter() -> None: ... # undocumented def execsitecustomize() -> None: ... # undocumented def execusercustomize() -> None: ... # undocumented -def getsitepackages(prefixes: Iterable[str] | None = ...) -> list[str]: ... +def getsitepackages(prefixes: Iterable[str] | None = None) -> list[str]: ... def getuserbase() -> str: ... def getusersitepackages() -> str: ... def makepath(*paths: StrPath) -> tuple[str, str]: ... # undocumented diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index 678bdafb25f0..d5bb48f36f84 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -731,15 +731,15 @@ class socket(_socket.socket): def get_inheritable(self) -> bool: ... def set_inheritable(self, inheritable: bool) -> None: ... -def fromfd(fd: _FD, family: AddressFamily | int, type: SocketKind | int, proto: int = ...) -> socket: ... +def fromfd(fd: _FD, family: AddressFamily | int, type: SocketKind | int, proto: int = 0) -> socket: ... if sys.platform != "win32": if sys.version_info >= (3, 9): # flags and address appear to be unused in send_fds and recv_fds def send_fds( - sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: int = ..., address: None = ... + sock: socket, buffers: Iterable[ReadableBuffer], fds: Iterable[int], flags: int = 0, address: None = None ) -> int: ... - def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = ...) -> tuple[bytes, list[int], int, Any]: ... + def recv_fds(sock: socket, bufsize: int, maxfds: int, flags: int = 0) -> tuple[bytes, list[int], int, Any]: ... if sys.platform == "win32": def fromshare(info: bytes) -> socket: ... @@ -749,7 +749,7 @@ if sys.platform == "win32": else: def socketpair( - family: int | AddressFamily | None = ..., type: SocketType | int = ..., proto: int = ... + family: int | AddressFamily | None = None, type: SocketType | int = 1, proto: int = 0 ) -> tuple[socket, socket]: ... class SocketIO(RawIOBase): @@ -761,34 +761,34 @@ class SocketIO(RawIOBase): @property def mode(self) -> Literal["rb", "wb", "rwb"]: ... -def getfqdn(name: str = ...) -> str: ... +def getfqdn(name: str = '') -> str: ... if sys.version_info >= (3, 11): def create_connection( address: tuple[str | None, int], timeout: float | None = ..., # noqa: F811 - source_address: _Address | None = ..., + source_address: _Address | None = None, *, - all_errors: bool = ..., + all_errors: bool = False, ) -> socket: ... else: def create_connection( - address: tuple[str | None, int], timeout: float | None = ..., source_address: _Address | None = ... # noqa: F811 + address: tuple[str | None, int], timeout: float | None = ..., source_address: _Address | None = None # noqa: F811 ) -> socket: ... if sys.version_info >= (3, 8): def has_dualstack_ipv6() -> bool: ... def create_server( - address: _Address, *, family: int = ..., backlog: int | None = ..., reuse_port: bool = ..., dualstack_ipv6: bool = ... + address: _Address, *, family: int = 2, backlog: int | None = None, reuse_port: bool = False, dualstack_ipv6: bool = False ) -> socket: ... # the 5th tuple item is an address def getaddrinfo( host: bytes | str | None, port: bytes | str | int | None, - family: int = ..., - type: int = ..., - proto: int = ..., - flags: int = ..., + family: int = 0, + type: int = 0, + proto: int = 0, + flags: int = 0, ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... diff --git a/stdlib/sre_compile.pyi b/stdlib/sre_compile.pyi index a9f4d577d5d1..2d04a886c931 100644 --- a/stdlib/sre_compile.pyi +++ b/stdlib/sre_compile.pyi @@ -8,4 +8,4 @@ MAXCODE: int def dis(code: list[_NamedIntConstant]) -> None: ... def isstring(obj: Any) -> bool: ... -def compile(p: str | bytes | SubPattern, flags: int = ...) -> Pattern[Any]: ... +def compile(p: str | bytes | SubPattern, flags: int = 0) -> Pattern[Any]: ... diff --git a/stdlib/sre_parse.pyi b/stdlib/sre_parse.pyi index 3dcf8ad78dee..efaf412ce423 100644 --- a/stdlib/sre_parse.pyi +++ b/stdlib/sre_parse.pyi @@ -95,14 +95,14 @@ def fix_flags(src: str | bytes, flags: int) -> int: ... _TemplateType: TypeAlias = tuple[list[tuple[int, int]], list[str | None]] _TemplateByteType: TypeAlias = tuple[list[tuple[int, int]], list[bytes | None]] if sys.version_info >= (3, 8): - def parse(str: str, flags: int = ..., state: State | None = ...) -> SubPattern: ... + def parse(str: str, flags: int = 0, state: State | None = None) -> SubPattern: ... @overload def parse_template(source: str, state: _Pattern[Any]) -> _TemplateType: ... @overload def parse_template(source: bytes, state: _Pattern[Any]) -> _TemplateByteType: ... else: - def parse(str: str, flags: int = ..., pattern: Pattern | None = ...) -> SubPattern: ... + def parse(str: str, flags: int = 0, pattern: Pattern | None = ...) -> SubPattern: ... @overload def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ... @overload diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index 91844e8369df..8dbda4665808 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -46,34 +46,34 @@ CertificateError = SSLCertVerificationError def wrap_socket( sock: socket.socket, - keyfile: StrOrBytesPath | None = ..., - certfile: StrOrBytesPath | None = ..., - server_side: bool = ..., - cert_reqs: int = ..., - ssl_version: int = ..., - ca_certs: str | None = ..., - do_handshake_on_connect: bool = ..., - suppress_ragged_eofs: bool = ..., - ciphers: str | None = ..., + keyfile: StrOrBytesPath | None = None, + certfile: StrOrBytesPath | None = None, + server_side: bool = False, + cert_reqs: int = 0, + ssl_version: int = 2, + ca_certs: str | None = None, + do_handshake_on_connect: bool = True, + suppress_ragged_eofs: bool = True, + ciphers: str | None = None, ) -> SSLSocket: ... def create_default_context( purpose: Purpose = ..., *, - cafile: StrOrBytesPath | None = ..., - capath: StrOrBytesPath | None = ..., - cadata: str | ReadableBuffer | None = ..., + cafile: StrOrBytesPath | None = None, + capath: StrOrBytesPath | None = None, + cadata: str | ReadableBuffer | None = None, ) -> SSLContext: ... def _create_unverified_context( - protocol: int = ..., + protocol: int = None, *, - cert_reqs: int = ..., - check_hostname: bool = ..., + cert_reqs: int = 0, + check_hostname: bool = False, purpose: Purpose = ..., - certfile: StrOrBytesPath | None = ..., - keyfile: StrOrBytesPath | None = ..., - cafile: StrOrBytesPath | None = ..., - capath: StrOrBytesPath | None = ..., - cadata: str | ReadableBuffer | None = ..., + certfile: StrOrBytesPath | None = None, + keyfile: StrOrBytesPath | None = None, + cafile: StrOrBytesPath | None = None, + capath: StrOrBytesPath | None = None, + cadata: str | ReadableBuffer | None = None, ) -> SSLContext: ... _create_default_https_context: Callable[..., SSLContext] @@ -91,11 +91,11 @@ def cert_time_to_seconds(cert_time: str) -> int: ... if sys.version_info >= (3, 10): def get_server_certificate( - addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ..., timeout: float = ... + addr: tuple[str, int], ssl_version: int = 16, ca_certs: str | None = None, timeout: float = ... ) -> str: ... else: - def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ... + def get_server_certificate(addr: tuple[str, int], ssl_version: int = 16, ca_certs: str | None = None) -> str: ... def DER_cert_to_PEM_cert(der_cert_bytes: ReadableBuffer) -> str: ... def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ... diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index a01665ad8227..1bf29e07983e 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -37,7 +37,7 @@ _HashableT = TypeVar("_HashableT", bound=Hashable) class StatisticsError(ValueError): ... if sys.version_info >= (3, 11): - def fmean(data: Iterable[SupportsFloat], weights: Iterable[SupportsFloat] | None = ...) -> float: ... + def fmean(data: Iterable[SupportsFloat], weights: Iterable[SupportsFloat] | None = None) -> float: ... elif sys.version_info >= (3, 8): def fmean(data: Iterable[SupportsFloat]) -> float: ... @@ -48,7 +48,7 @@ if sys.version_info >= (3, 8): def mean(data: Iterable[_NumberT]) -> _NumberT: ... if sys.version_info >= (3, 10): - def harmonic_mean(data: Iterable[_NumberT], weights: Iterable[_Number] | None = ...) -> _NumberT: ... + def harmonic_mean(data: Iterable[_NumberT], weights: Iterable[_Number] | None = None) -> _NumberT: ... else: def harmonic_mean(data: Iterable[_NumberT]) -> _NumberT: ... @@ -68,16 +68,16 @@ def mode(data: Iterable[_HashableT]) -> _HashableT: ... if sys.version_info >= (3, 8): def multimode(data: Iterable[_HashableT]) -> list[_HashableT]: ... -def pstdev(data: Iterable[_NumberT], mu: _NumberT | None = ...) -> _NumberT: ... -def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = ...) -> _NumberT: ... +def pstdev(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: ... +def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: ... if sys.version_info >= (3, 8): def quantiles( - data: Iterable[_NumberT], *, n: int = ..., method: Literal["inclusive", "exclusive"] = ... + data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = 'exclusive' ) -> list[_NumberT]: ... -def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = ...) -> _NumberT: ... -def variance(data: Iterable[_NumberT], xbar: _NumberT | None = ...) -> _NumberT: ... +def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: ... +def variance(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: ... if sys.version_info >= (3, 8): class NormalDist: @@ -124,7 +124,7 @@ if sys.version_info >= (3, 10): if sys.version_info >= (3, 11): def linear_regression( - __regressor: Sequence[_Number], __dependent_variable: Sequence[_Number], *, proportional: bool = ... + __regressor: Sequence[_Number], __dependent_variable: Sequence[_Number], *, proportional: bool = False ) -> LinearRegression: ... elif sys.version_info >= (3, 10): diff --git a/stdlib/string.pyi b/stdlib/string.pyi index 49802ce81019..3dd68e2af33f 100644 --- a/stdlib/string.pyi +++ b/stdlib/string.pyi @@ -30,7 +30,7 @@ punctuation: LiteralString printable: LiteralString whitespace: LiteralString -def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = ...) -> StrOrLiteralStr: ... +def capwords(s: StrOrLiteralStr, sep: StrOrLiteralStr | None = None) -> StrOrLiteralStr: ... if sys.version_info >= (3, 9): _TemplateMetaclass: TypeAlias = type diff --git a/stdlib/struct.pyi b/stdlib/struct.pyi index 02097384e0f7..c9f8251d6bc2 100644 --- a/stdlib/struct.pyi +++ b/stdlib/struct.pyi @@ -9,7 +9,7 @@ class error(Exception): ... def pack(__fmt: str | bytes, *v: Any) -> bytes: ... def pack_into(__fmt: str | bytes, __buffer: WriteableBuffer, __offset: int, *v: Any) -> None: ... def unpack(__format: str | bytes, __buffer: ReadableBuffer) -> tuple[Any, ...]: ... -def unpack_from(__format: str | bytes, buffer: ReadableBuffer, offset: int = ...) -> tuple[Any, ...]: ... +def unpack_from(__format: str | bytes, buffer: ReadableBuffer, offset: int = 0) -> tuple[Any, ...]: ... def iter_unpack(__format: str | bytes, __buffer: ReadableBuffer) -> Iterator[tuple[Any, ...]]: ... def calcsize(__format: str | bytes) -> int: ... diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index 450eb8cd24d1..81d25b2001a3 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -902,7 +902,7 @@ if sys.version_info >= (3, 11): start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, - timeout: float | None = ..., + timeout: float | None = None, text: bool | None = ..., user: str | int | None = ..., group: str | int | None = ..., @@ -933,7 +933,7 @@ elif sys.version_info >= (3, 10): start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, - timeout: float | None = ..., + timeout: float | None = None, text: bool | None = ..., user: str | int | None = ..., group: str | int | None = ..., @@ -963,7 +963,7 @@ elif sys.version_info >= (3, 9): start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, - timeout: float | None = ..., + timeout: float | None = None, text: bool | None = ..., user: str | int | None = ..., group: str | int | None = ..., @@ -991,7 +991,7 @@ else: start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, - timeout: float | None = ..., + timeout: float | None = None, text: bool | None = ..., ) -> int: ... @@ -2575,8 +2575,8 @@ class Popen(Generic[AnyStr]): # The result really is always a str. if sys.version_info >= (3, 11): - def getstatusoutput(cmd: _TXT, *, encoding: str | None = ..., errors: str | None = ...) -> tuple[int, str]: ... - def getoutput(cmd: _TXT, *, encoding: str | None = ..., errors: str | None = ...) -> str: ... + def getstatusoutput(cmd: _TXT, *, encoding: str | None = None, errors: str | None = None) -> tuple[int, str]: ... + def getoutput(cmd: _TXT, *, encoding: str | None = None, errors: str | None = None) -> str: ... else: def getstatusoutput(cmd: _TXT) -> tuple[int, str]: ... diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 895abc2cd047..02d24485305c 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -28,11 +28,11 @@ if sys.version_info >= (3, 10): def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... def get_path_names() -> tuple[str, ...]: ... -def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> str: ... -def get_paths(scheme: str = ..., vars: dict[str, Any] | None = ..., expand: bool = ...) -> dict[str, str]: ... +def get_path(name: str, scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... +def get_paths(scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... -def is_python_build(check_home: bool = ...) -> bool: ... -def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = ...) -> dict[str, Any]: ... +def is_python_build(check_home: bool = None) -> bool: ... +def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = None) -> dict[str, Any]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index 5ad5af7f20bd..e120b4146448 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -89,10 +89,10 @@ PAX_NAME_FIELDS: set[str] ENCODING: str def open( - name: StrOrBytesPath | None = ..., - mode: str = ..., - fileobj: IO[bytes] | None = ..., # depends on mode - bufsize: int = ..., + name: StrOrBytesPath | None = None, + mode: str = 'r', + fileobj: IO[bytes] | None = None, # depends on mode + bufsize: int = 10240, *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index 2c096f0fb4de..bccae1f8c4ff 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -399,7 +399,7 @@ def mkstemp( def mkdtemp(suffix: str | None = ..., prefix: str | None = ..., dir: StrPath | None = ...) -> str: ... # type: ignore[misc] @overload def mkdtemp(suffix: bytes | None = ..., prefix: bytes | None = ..., dir: BytesPath | None = ...) -> bytes: ... -def mktemp(suffix: str = ..., prefix: str = ..., dir: StrPath | None = ...) -> str: ... +def mktemp(suffix: str = '', prefix: str = 'tmp', dir: StrPath | None = None) -> str: ... def gettempdirb() -> bytes: ... def gettempprefixb() -> bytes: ... def gettempdir() -> str: ... diff --git a/stdlib/textwrap.pyi b/stdlib/textwrap.pyi index 9e423cb5ce94..34f5925acb08 100644 --- a/stdlib/textwrap.pyi +++ b/stdlib/textwrap.pyi @@ -53,7 +53,7 @@ class TextWrapper: def wrap( text: str, - width: int = ..., + width: int = 70, *, initial_indent: str = ..., subsequent_indent: str = ..., @@ -69,7 +69,7 @@ def wrap( ) -> list[str]: ... def fill( text: str, - width: int = ..., + width: int = 70, *, initial_indent: str = ..., subsequent_indent: str = ..., @@ -100,4 +100,4 @@ def shorten( placeholder: str = ..., ) -> str: ... def dedent(text: str) -> str: ... -def indent(text: str, prefix: str, predicate: Callable[[str], bool] | None = ...) -> str: ... +def indent(text: str, prefix: str, predicate: Callable[[str], bool] | None = None) -> str: ... diff --git a/stdlib/timeit.pyi b/stdlib/timeit.pyi index dda6cefed0f6..89c4c9c5e97f 100644 --- a/stdlib/timeit.pyi +++ b/stdlib/timeit.pyi @@ -19,14 +19,14 @@ class Timer: def autorange(self, callback: Callable[[int, float], object] | None = ...) -> tuple[int, float]: ... def timeit( - stmt: _Stmt = ..., setup: _Stmt = ..., timer: _Timer = ..., number: int = ..., globals: dict[str, Any] | None = ... + stmt: _Stmt = 'pass', setup: _Stmt = 'pass', timer: _Timer = ..., number: int = 1000000, globals: dict[str, Any] | None = None ) -> float: ... def repeat( - stmt: _Stmt = ..., - setup: _Stmt = ..., + stmt: _Stmt = 'pass', + setup: _Stmt = 'pass', timer: _Timer = ..., - repeat: int = ..., - number: int = ..., - globals: dict[str, Any] | None = ..., + repeat: int = 5, + number: int = 1000000, + globals: dict[str, Any] | None = None, ) -> list[float]: ... -def main(args: Sequence[str] | None = ..., *, _wrap_timer: Callable[[_Timer], _Timer] | None = ...) -> None: ... +def main(args: Sequence[str] | None = None, *, _wrap_timer: Callable[[_Timer], _Timer] | None = None) -> None: ... diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index bf8e24e7ab27..6ae417cc9c7f 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -29,7 +29,7 @@ __all__ = [ _PT: TypeAlias = tuple[str, int, str, str | None] -def print_tb(tb: TracebackType | None, limit: int | None = ..., file: SupportsWrite[str] | None = ...) -> None: ... +def print_tb(tb: TracebackType | None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ... if sys.version_info >= (3, 10): @overload @@ -61,27 +61,27 @@ else: etype: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, - limit: int | None = ..., - file: SupportsWrite[str] | None = ..., - chain: bool = ..., + limit: int | None = None, + file: SupportsWrite[str] | None = None, + chain: bool = True, ) -> None: ... def format_exception( etype: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, - limit: int | None = ..., - chain: bool = ..., + limit: int | None = None, + chain: bool = True, ) -> list[str]: ... -def print_exc(limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ... -def print_last(limit: int | None = ..., file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ... -def print_stack(f: FrameType | None = ..., limit: int | None = ..., file: SupportsWrite[str] | None = ...) -> None: ... -def extract_tb(tb: TracebackType | None, limit: int | None = ...) -> StackSummary: ... -def extract_stack(f: FrameType | None = ..., limit: int | None = ...) -> StackSummary: ... +def print_exc(limit: int | None = None, file: SupportsWrite[str] | None = None, chain: bool = True) -> None: ... +def print_last(limit: int | None = None, file: SupportsWrite[str] | None = None, chain: bool = True) -> None: ... +def print_stack(f: FrameType | None = None, limit: int | None = None, file: SupportsWrite[str] | None = None) -> None: ... +def extract_tb(tb: TracebackType | None, limit: int | None = None) -> StackSummary: ... +def extract_stack(f: FrameType | None = None, limit: int | None = None) -> StackSummary: ... def format_list(extracted_list: list[FrameSummary]) -> list[str]: ... # undocumented -def print_list(extracted_list: list[FrameSummary], file: SupportsWrite[str] | None = ...) -> None: ... +def print_list(extracted_list: list[FrameSummary], file: SupportsWrite[str] | None = None) -> None: ... if sys.version_info >= (3, 10): def format_exception_only(__exc: type[BaseException] | None, value: BaseException | None = ...) -> list[str]: ... @@ -89,9 +89,9 @@ if sys.version_info >= (3, 10): else: def format_exception_only(etype: type[BaseException] | None, value: BaseException | None) -> list[str]: ... -def format_exc(limit: int | None = ..., chain: bool = ...) -> str: ... -def format_tb(tb: TracebackType | None, limit: int | None = ...) -> list[str]: ... -def format_stack(f: FrameType | None = ..., limit: int | None = ...) -> list[str]: ... +def format_exc(limit: int | None = None, chain: bool = True) -> str: ... +def format_tb(tb: TracebackType | None, limit: int | None = None) -> list[str]: ... +def format_stack(f: FrameType | None = None, limit: int | None = None) -> list[str]: ... def clear_frames(tb: TracebackType | None) -> None: ... def walk_stack(f: FrameType | None) -> Iterator[tuple[FrameType, int]]: ... def walk_tb(tb: TracebackType | None) -> Iterator[tuple[FrameType, int]]: ... diff --git a/stdlib/tty.pyi b/stdlib/tty.pyi index 8edae9ec2deb..43f2e1cf9087 100644 --- a/stdlib/tty.pyi +++ b/stdlib/tty.pyi @@ -15,5 +15,5 @@ if sys.platform != "win32": ISPEED: int OSPEED: int CC: int - def setraw(fd: _FD, when: int = ...) -> None: ... - def setcbreak(fd: _FD, when: int = ...) -> None: ... + def setraw(fd: _FD, when: int = 2) -> None: ... + def setcbreak(fd: _FD, when: int = 2) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 6928032f92b1..35ffe3ea339f 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -554,12 +554,12 @@ class MemberDescriptorType: def new_class( name: str, bases: Iterable[object] = ..., - kwds: dict[str, Any] | None = ..., - exec_body: Callable[[dict[str, Any]], object] | None = ..., + kwds: dict[str, Any] | None = None, + exec_body: Callable[[dict[str, Any]], object] | None = None, ) -> type: ... def resolve_bases(bases: Iterable[object]) -> tuple[Any, ...]: ... def prepare_class( - name: str, bases: tuple[type, ...] = ..., kwds: dict[str, Any] | None = ... + name: str, bases: tuple[type, ...] = ..., kwds: dict[str, Any] | None = None ) -> tuple[type, dict[str, Any], dict[str, Any]]: ... # Actually a different type, but `property` is special and we want that too. diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 71018003b6d9..83b70a6097cf 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -728,14 +728,14 @@ _get_type_hints_obj_allowed_types = ( # noqa: Y026 # TODO: Use TypeAlias once if sys.version_info >= (3, 9): def get_type_hints( obj: _get_type_hints_obj_allowed_types, - globalns: dict[str, Any] | None = ..., - localns: dict[str, Any] | None = ..., - include_extras: bool = ..., + globalns: dict[str, Any] | None = None, + localns: dict[str, Any] | None = None, + include_extras: bool = False, ) -> dict[str, Any]: ... else: def get_type_hints( - obj: _get_type_hints_obj_allowed_types, globalns: dict[str, Any] | None = ..., localns: dict[str, Any] | None = ... + obj: _get_type_hints_obj_allowed_types, globalns: dict[str, Any] | None = None, localns: dict[str, Any] | None = None ) -> dict[str, Any]: ... if sys.version_info >= (3, 8): @@ -757,9 +757,9 @@ if sys.version_info >= (3, 11): def get_overloads(func: Callable[..., object]) -> Sequence[Callable[..., object]]: ... def dataclass_transform( *, - eq_default: bool = ..., - order_default: bool = ..., - kw_only_default: bool = ..., + eq_default: bool = True, + order_default: bool = False, + kw_only_default: bool = False, field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ..., **kwargs: Any, ) -> IdentityFunction: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index df2c1c431c65..1f709938be8f 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -151,9 +151,9 @@ OrderedDict = _Alias() def get_type_hints( obj: Callable[..., Any], - globalns: dict[str, Any] | None = ..., - localns: dict[str, Any] | None = ..., - include_extras: bool = ..., + globalns: dict[str, Any] | None = None, + localns: dict[str, Any] | None = None, + include_extras: bool = False, ) -> dict[str, Any]: ... def get_args(tp: Any) -> tuple[Any, ...]: ... def get_origin(tp: Any) -> Any | None: ... @@ -224,9 +224,9 @@ else: def dataclass_transform( *, - eq_default: bool = ..., - order_default: bool = ..., - kw_only_default: bool = ..., + eq_default: bool = True, + order_default: bool = False, + kw_only_default: bool = False, field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ..., **kwargs: object, ) -> IdentityFunction: ... diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index a1b902e0f6d6..a1c497099d79 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -31,14 +31,14 @@ def getTestCaseNames( testCaseClass: type[unittest.case.TestCase], prefix: str, sortUsing: _SortComparisonMethod = ..., - testNamePatterns: list[str] | None = ..., + testNamePatterns: list[str] | None = None, ) -> Sequence[str]: ... def makeSuite( testCaseClass: type[unittest.case.TestCase], - prefix: str = ..., + prefix: str = 'test', sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ..., ) -> unittest.suite.TestSuite: ... def findTestCases( - module: ModuleType, prefix: str = ..., sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... + module: ModuleType, prefix: str = 'test', sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... ) -> unittest.suite.TestSuite: ... diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 47535499a9f2..5dd7c71678f2 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -392,18 +392,18 @@ ANY: Any if sys.version_info >= (3, 10): def create_autospec( spec: Any, - spec_set: Any = ..., - instance: Any = ..., - _parent: Any | None = ..., - _name: Any | None = ..., + spec_set: Any = False, + instance: Any = False, + _parent: Any | None = None, + _name: Any | None = None, *, - unsafe: bool = ..., + unsafe: bool = False, **kwargs: Any, ) -> Any: ... else: def create_autospec( - spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Any | None = ..., _name: Any | None = ..., **kwargs: Any + spec: Any, spec_set: Any = False, instance: Any = False, _parent: Any | None = None, _name: Any | None = None, **kwargs: Any ) -> Any: ... class _SpecState: @@ -423,7 +423,7 @@ class _SpecState: instance: Any = ..., ) -> None: ... -def mock_open(mock: Any | None = ..., read_data: Any = ...) -> Any: ... +def mock_open(mock: Any | None = None, read_data: Any = '') -> Any: ... class PropertyMock(Mock): if sys.version_info >= (3, 8): diff --git a/stdlib/unittest/util.pyi b/stdlib/unittest/util.pyi index f62c728760ff..845accfebedd 100644 --- a/stdlib/unittest/util.pyi +++ b/stdlib/unittest/util.pyi @@ -14,7 +14,7 @@ _MIN_DIFF_LEN: int def _shorten(s: str, prefixlen: int, suffixlen: int) -> str: ... def _common_shorten_repr(*args: str) -> tuple[str, ...]: ... -def safe_repr(obj: object, short: bool = ...) -> str: ... +def safe_repr(obj: object, short: bool = False) -> str: ... def strclass(cls: type) -> str: ... def sorted_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> tuple[list[_T], list[_T]]: ... def unorderable_list_difference(expected: Sequence[_T], actual: Sequence[_T]) -> tuple[list[_T], list[_T]]: ... diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index efb91a4b34ff..4dd3ba82d079 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -115,40 +115,40 @@ class ParseResultBytes(_ParseResultBytesBase, _NetlocResultMixinBytes): ... def parse_qs( qs: AnyStr | None, - keep_blank_values: bool = ..., - strict_parsing: bool = ..., - encoding: str = ..., - errors: str = ..., - max_num_fields: int | None = ..., - separator: str = ..., + keep_blank_values: bool = False, + strict_parsing: bool = False, + encoding: str = 'utf-8', + errors: str = 'replace', + max_num_fields: int | None = None, + separator: str = '&', ) -> dict[AnyStr, list[AnyStr]]: ... def parse_qsl( qs: AnyStr | None, - keep_blank_values: bool = ..., - strict_parsing: bool = ..., - encoding: str = ..., - errors: str = ..., - max_num_fields: int | None = ..., - separator: str = ..., + keep_blank_values: bool = False, + strict_parsing: bool = False, + encoding: str = 'utf-8', + errors: str = 'replace', + max_num_fields: int | None = None, + separator: str = '&', ) -> list[tuple[AnyStr, AnyStr]]: ... @overload def quote(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... -def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... +def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = '/') -> str: ... @overload def quote_plus(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote_plus(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... if sys.version_info >= (3, 9): - def unquote(string: str | bytes, encoding: str = ..., errors: str = ...) -> str: ... + def unquote(string: str | bytes, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... else: - def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ... + def unquote(string: str, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... def unquote_to_bytes(string: str | bytes | bytearray) -> bytes: ... -def unquote_plus(string: str, encoding: str = ..., errors: str = ...) -> str: ... +def unquote_plus(string: str, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... @overload def urldefrag(url: str) -> DefragResult: ... @overload @@ -158,13 +158,13 @@ _Q = TypeVar("_Q", bound=str | Iterable[int]) def urlencode( query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]], - doseq: bool = ..., - safe: _Q = ..., - encoding: str = ..., - errors: str = ..., + doseq: bool = False, + safe: _Q = '', + encoding: str = None, + errors: str = None, quote_via: Callable[[AnyStr, _Q, str, str], str] = ..., ) -> str: ... -def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = ...) -> AnyStr: ... +def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = True) -> AnyStr: ... @overload def urlparse(url: str, scheme: str | None = ..., allow_fragments: bool = ...) -> ParseResult: ... @overload diff --git a/stdlib/urllib/request.pyi b/stdlib/urllib/request.pyi index 00c160293762..0004ad7798e8 100644 --- a/stdlib/urllib/request.pyi +++ b/stdlib/urllib/request.pyi @@ -54,13 +54,13 @@ _DataType: TypeAlias = ReadableBuffer | SupportsRead[bytes] | Iterable[bytes] | def urlopen( url: str | Request, - data: _DataType | None = ..., + data: _DataType | None = None, timeout: float | None = ..., *, - cafile: str | None = ..., - capath: str | None = ..., - cadefault: bool = ..., - context: ssl.SSLContext | None = ..., + cafile: str | None = None, + capath: str | None = None, + cadefault: bool = False, + context: ssl.SSLContext | None = None, ) -> _UrlopenRet: ... def install_opener(opener: OpenerDirector) -> None: ... def build_opener(*handlers: BaseHandler | Callable[[], BaseHandler]) -> OpenerDirector: ... @@ -292,9 +292,9 @@ class HTTPErrorProcessor(BaseHandler): def urlretrieve( url: str, - filename: StrOrBytesPath | None = ..., - reporthook: Callable[[int, int, int], object] | None = ..., - data: _DataType = ..., + filename: StrOrBytesPath | None = None, + reporthook: Callable[[int, int, int], object] | None = None, + data: _DataType = None, ) -> tuple[str, HTTPMessage]: ... def urlcleanup() -> None: ... diff --git a/stdlib/uu.pyi b/stdlib/uu.pyi index 95a7f3dfa9e2..363439a80e0a 100644 --- a/stdlib/uu.pyi +++ b/stdlib/uu.pyi @@ -7,5 +7,5 @@ _File: TypeAlias = str | BinaryIO class Error(Exception): ... -def encode(in_file: _File, out_file: _File, name: str | None = ..., mode: int | None = ..., *, backtick: bool = ...) -> None: ... -def decode(in_file: _File, out_file: _File | None = ..., mode: int | None = ..., quiet: int = ...) -> None: ... +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: ... diff --git a/stdlib/uuid.pyi b/stdlib/uuid.pyi index 3d9b89a0b9f7..771747aa80eb 100644 --- a/stdlib/uuid.pyi +++ b/stdlib/uuid.pyi @@ -65,7 +65,7 @@ class UUID: def __ge__(self, other: UUID) -> bool: ... def getnode() -> int: ... -def uuid1(node: _Int | None = ..., clock_seq: _Int | None = ...) -> UUID: ... +def uuid1(node: _Int | None = None, clock_seq: _Int | None = None) -> UUID: ... def uuid3(namespace: UUID, name: str) -> UUID: ... def uuid4() -> UUID: ... def uuid5(namespace: UUID, name: str) -> UUID: ... diff --git a/stdlib/venv/__init__.pyi b/stdlib/venv/__init__.pyi index 2e34aed4c693..772295a68dab 100644 --- a/stdlib/venv/__init__.pyi +++ b/stdlib/venv/__init__.pyi @@ -55,22 +55,22 @@ class EnvBuilder: if sys.version_info >= (3, 9): def create( env_dir: StrOrBytesPath, - system_site_packages: bool = ..., - clear: bool = ..., - symlinks: bool = ..., - with_pip: bool = ..., - prompt: str | None = ..., - upgrade_deps: bool = ..., + system_site_packages: bool = False, + clear: bool = False, + symlinks: bool = False, + with_pip: bool = False, + prompt: str | None = None, + upgrade_deps: bool = False, ) -> None: ... else: def create( env_dir: StrOrBytesPath, - system_site_packages: bool = ..., - clear: bool = ..., - symlinks: bool = ..., - with_pip: bool = ..., - prompt: str | None = ..., + system_site_packages: bool = False, + clear: bool = False, + symlinks: bool = False, + with_pip: bool = False, + prompt: str | None = None, ) -> None: ... -def main(args: Sequence[str] | None = ...) -> None: ... +def main(args: Sequence[str] | None = None) -> None: ... diff --git a/stdlib/warnings.pyi b/stdlib/warnings.pyi index 5cc6b946409b..851abafc529a 100644 --- a/stdlib/warnings.pyi +++ b/stdlib/warnings.pyi @@ -22,18 +22,18 @@ _ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "module filters: Sequence[tuple[str, str | None, type[Warning], str | None, int]] # undocumented, do not mutate def showwarning( - message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = ..., line: str | None = ... + message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = None, line: str | None = None ) -> None: ... -def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = ...) -> str: ... +def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = None) -> str: ... def filterwarnings( action: _ActionKind, - message: str = ..., + message: str = '', category: type[Warning] = ..., - module: str = ..., - lineno: int = ..., - append: bool = ..., + module: str = '', + lineno: int = 0, + append: bool = False, ) -> None: ... -def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = ..., append: bool = ...) -> None: ... +def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = 0, append: bool = False) -> None: ... def resetwarnings() -> None: ... class _OptionError(Exception): ... diff --git a/stdlib/webbrowser.pyi b/stdlib/webbrowser.pyi index 8cf8935ffaad..0a55b1fae3fe 100644 --- a/stdlib/webbrowser.pyi +++ b/stdlib/webbrowser.pyi @@ -8,10 +8,10 @@ __all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"] class Error(Exception): ... def register( - name: str, klass: Callable[[], BaseBrowser] | None, instance: BaseBrowser | None = ..., *, preferred: bool = ... + name: str, klass: Callable[[], BaseBrowser] | None, instance: BaseBrowser | None = None, *, preferred: bool = False ) -> None: ... -def get(using: str | None = ...) -> BaseBrowser: ... -def open(url: str, new: int = ..., autoraise: bool = ...) -> bool: ... +def get(using: str | None = None) -> BaseBrowser: ... +def open(url: str, new: int = 0, autoraise: bool = True) -> bool: ... def open_new(url: str) -> bool: ... def open_new_tab(url: str) -> bool: ... diff --git a/stdlib/wsgiref/util.pyi b/stdlib/wsgiref/util.pyi index 36e5c1e69676..002eb32cecf4 100644 --- a/stdlib/wsgiref/util.pyi +++ b/stdlib/wsgiref/util.pyi @@ -18,7 +18,7 @@ class FileWrapper: def guess_scheme(environ: WSGIEnvironment) -> str: ... def application_uri(environ: WSGIEnvironment) -> str: ... -def request_uri(environ: WSGIEnvironment, include_query: bool = ...) -> str: ... +def request_uri(environ: WSGIEnvironment, include_query: bool = True) -> str: ... def shift_path_info(environ: WSGIEnvironment) -> str | None: ... def setup_testing_defaults(environ: WSGIEnvironment) -> None: ... def is_hop_by_hop(header_name: str) -> bool: ... diff --git a/stdlib/xml/dom/domreg.pyi b/stdlib/xml/dom/domreg.pyi index 5a276ae5f561..75b7796c4718 100644 --- a/stdlib/xml/dom/domreg.pyi +++ b/stdlib/xml/dom/domreg.pyi @@ -5,4 +5,4 @@ well_known_implementations: dict[str, str] registered: dict[str, Callable[[], DOMImplementation]] def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... -def getDOMImplementation(name: str | None = ..., features: str | Iterable[tuple[str, str | None]] = ...) -> DOMImplementation: ... +def getDOMImplementation(name: str | None = None, features: str | Iterable[tuple[str, str | None]] = ...) -> DOMImplementation: ... diff --git a/stdlib/xml/dom/expatbuilder.pyi b/stdlib/xml/dom/expatbuilder.pyi index e460d6b21afa..bd2331586aa5 100644 --- a/stdlib/xml/dom/expatbuilder.pyi +++ b/stdlib/xml/dom/expatbuilder.pyi @@ -93,8 +93,8 @@ class InternalSubsetExtractor(ExpatBuilder): def end_doctype_decl_handler(self) -> NoReturn: ... def start_element_handler(self, name, attrs) -> NoReturn: ... -def parse(file: str | SupportsRead[ReadableBuffer | str], namespaces: bool = ...): ... -def parseString(string: str | ReadableBuffer, namespaces: bool = ...): ... -def parseFragment(file, context, namespaces: bool = ...): ... -def parseFragmentString(string: str, context, namespaces: bool = ...): ... +def parse(file: str | SupportsRead[ReadableBuffer | str], namespaces: bool = True): ... +def parseString(string: str | ReadableBuffer, namespaces: bool = True): ... +def parseFragment(file, context, namespaces: bool = True): ... +def parseFragmentString(string: str, context, namespaces: bool = True): ... def makeBuilder(options: Options) -> ExpatBuilderNS | ExpatBuilder: ... diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index 5997e031fd73..83248482c657 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -5,9 +5,9 @@ from typing_extensions import Literal from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS from xml.sax.xmlreader import XMLReader -def parse(file: str | SupportsRead[ReadableBuffer | str], parser: XMLReader | None = ..., bufsize: int | None = ...): ... -def parseString(string: str | ReadableBuffer, parser: XMLReader | None = ...): ... -def getDOMImplementation(features=...) -> DOMImplementation | None: ... +def parse(file: str | SupportsRead[ReadableBuffer | str], parser: XMLReader | None = None, bufsize: int | None = None): ... +def parseString(string: str | ReadableBuffer, parser: XMLReader | None = None): ... +def getDOMImplementation(features=None) -> DOMImplementation | None: ... class Node(xml.dom.Node): namespaceURI: str | None diff --git a/stdlib/xml/dom/pulldom.pyi b/stdlib/xml/dom/pulldom.pyi index b4c03a1dd590..2ee0d16fef89 100644 --- a/stdlib/xml/dom/pulldom.pyi +++ b/stdlib/xml/dom/pulldom.pyi @@ -88,6 +88,6 @@ class SAX2DOM(PullDOM): default_bufsize: int def parse( - stream_or_string: str | SupportsRead[bytes] | SupportsRead[str], parser: XMLReader | None = ..., bufsize: int | None = ... + stream_or_string: str | SupportsRead[bytes] | SupportsRead[str], parser: XMLReader | None = None, bufsize: int | None = None ) -> DOMEventStream: ... -def parseString(string: str, parser: XMLReader | None = ...) -> DOMEventStream: ... +def parseString(string: str, parser: XMLReader | None = None) -> DOMEventStream: ... diff --git a/stdlib/xml/etree/ElementInclude.pyi b/stdlib/xml/etree/ElementInclude.pyi index 3e3e3f266206..e98303cd669b 100644 --- a/stdlib/xml/etree/ElementInclude.pyi +++ b/stdlib/xml/etree/ElementInclude.pyi @@ -12,17 +12,17 @@ if sys.version_info >= (3, 9): class FatalIncludeError(SyntaxError): ... -def default_loader(href: StrOrBytesPath | int, parse: str, encoding: str | None = ...) -> str | Element: ... +def default_loader(href: StrOrBytesPath | int, parse: str, encoding: str | None = None) -> str | Element: ... # TODO: loader is of type default_loader ie it takes a callable that has the # same signature as default_loader. But default_loader has a keyword argument # Which can't be represented using Callable... if sys.version_info >= (3, 9): def include( - elem: Element, loader: Callable[..., str | Element] | None = ..., base_url: str | None = ..., max_depth: int | None = ... + elem: Element, loader: Callable[..., str | Element] | None = None, base_url: str | None = None, max_depth: int | None = 6 ) -> None: ... class LimitedRecursiveIncludeError(FatalIncludeError): ... else: - def include(elem: Element, loader: Callable[..., str | Element] | None = ...) -> None: ... + def include(elem: Element, loader: Callable[..., str | Element] | None = None) -> None: ... diff --git a/stdlib/xml/etree/ElementPath.pyi b/stdlib/xml/etree/ElementPath.pyi index 94ce933582dd..c3f6207ea241 100644 --- a/stdlib/xml/etree/ElementPath.pyi +++ b/stdlib/xml/etree/ElementPath.pyi @@ -10,7 +10,7 @@ _Token: TypeAlias = tuple[str, str] _Next: TypeAlias = Callable[[], _Token] _Callback: TypeAlias = Callable[[_SelectorContext, list[Element]], Generator[Element, None, None]] -def xpath_tokenizer(pattern: str, namespaces: dict[str, str] | None = ...) -> Generator[_Token, None, None]: ... +def xpath_tokenizer(pattern: str, namespaces: dict[str, str] | None = None) -> Generator[_Token, None, None]: ... def get_parent_map(context: _SelectorContext) -> dict[Element, Element]: ... def prepare_child(next: _Next, token: _Token) -> _Callback: ... def prepare_star(next: _Next, token: _Token) -> _Callback: ... @@ -28,7 +28,7 @@ class _SelectorContext: _T = TypeVar("_T") -def iterfind(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... -def find(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... -def findall(elem: Element, path: str, namespaces: dict[str, str] | None = ...) -> list[Element]: ... -def findtext(elem: Element, path: str, default: _T | None = ..., namespaces: dict[str, str] | None = ...) -> _T | str: ... +def iterfind(elem: Element, path: str, namespaces: dict[str, str] | None = None) -> Generator[Element, None, None]: ... +def find(elem: Element, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... +def findall(elem: Element, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... +def findtext(elem: Element, path: str, default: _T | None = None, namespaces: dict[str, str] | None = None) -> _T | str: ... diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index c063c1fd3488..7b8a2388e02d 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -129,8 +129,8 @@ class Element: def getiterator(self, tag: str | None = ...) -> list[Element]: ... def SubElement(parent: Element, tag: str, attrib: dict[str, str] = ..., **extra: str) -> Element: ... -def Comment(text: str | None = ...) -> Element: ... -def ProcessingInstruction(target: str, text: str | None = ...) -> Element: ... +def Comment(text: str | None = None) -> Element: ... +def ProcessingInstruction(target: str, text: str | None = None) -> Element: ... PI: Callable[..., Element] @@ -261,11 +261,11 @@ else: def dump(elem: Element) -> None: ... if sys.version_info >= (3, 9): - def indent(tree: Element | ElementTree, space: str = ..., level: int = ...) -> None: ... + def indent(tree: Element | ElementTree, space: str = ' ', level: int = 0) -> None: ... -def parse(source: _FileRead, parser: XMLParser | None = ...) -> ElementTree: ... +def parse(source: _FileRead, parser: XMLParser | None = None) -> ElementTree: ... def iterparse( - source: _FileRead, events: Sequence[str] | None = ..., parser: XMLParser | None = ... + source: _FileRead, events: Sequence[str] | None = None, parser: XMLParser | None = None ) -> Iterator[tuple[str, Any]]: ... class XMLPullParser: @@ -276,13 +276,13 @@ class XMLPullParser: # Use `Any` to avoid false-positive errors. def read_events(self) -> Iterator[tuple[str, Any]]: ... -def XML(text: str | ReadableBuffer, parser: XMLParser | None = ...) -> Element: ... -def XMLID(text: str | ReadableBuffer, parser: XMLParser | None = ...) -> tuple[Element, dict[str, Element]]: ... +def XML(text: str | ReadableBuffer, parser: XMLParser | None = None) -> Element: ... +def XMLID(text: str | ReadableBuffer, parser: XMLParser | None = None) -> tuple[Element, dict[str, Element]]: ... # This is aliased to XML in the source. fromstring = XML -def fromstringlist(sequence: Sequence[str | ReadableBuffer], parser: XMLParser | None = ...) -> Element: ... +def fromstringlist(sequence: Sequence[str | ReadableBuffer], parser: XMLParser | None = None) -> Element: ... # This type is both not precise enough and too precise. The TreeBuilder # requires the elementfactory to accept tag and attrs in its args and produce diff --git a/stdlib/xml/sax/saxutils.pyi b/stdlib/xml/sax/saxutils.pyi index 1361949d0c3e..74d6c98a2f3c 100644 --- a/stdlib/xml/sax/saxutils.pyi +++ b/stdlib/xml/sax/saxutils.pyi @@ -57,4 +57,4 @@ class XMLFilterBase(xmlreader.XMLReader): def getParent(self): ... def setParent(self, parent): ... -def prepare_input_source(source, base=...): ... +def prepare_input_source(source, base=''): ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 0e048f57844d..272ffd775961 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -200,17 +200,17 @@ FastMarshaller: Marshaller | None FastParser: ExpatParser | None FastUnmarshaller: Unmarshaller | None -def getparser(use_datetime: bool = ..., use_builtin_types: bool = ...) -> tuple[ExpatParser, Unmarshaller]: ... +def getparser(use_datetime: bool = False, use_builtin_types: bool = False) -> tuple[ExpatParser, Unmarshaller]: ... def dumps( params: Fault | tuple[_Marshallable, ...], - methodname: str | None = ..., - methodresponse: bool | None = ..., - encoding: str | None = ..., - allow_none: bool = ..., + methodname: str | None = None, + methodresponse: bool | None = None, + encoding: str | None = None, + allow_none: bool = False, ) -> str: ... -def loads(data: str, use_datetime: bool = ..., use_builtin_types: bool = ...) -> tuple[tuple[_Marshallable, ...], str | None]: ... +def loads(data: str, use_datetime: bool = False, use_builtin_types: bool = False) -> tuple[tuple[_Marshallable, ...], str | None]: ... def gzip_encode(data: ReadableBuffer) -> bytes: ... # undocumented -def gzip_decode(data: ReadableBuffer, max_decode: int = ...) -> bytes: ... # undocumented +def gzip_decode(data: ReadableBuffer, max_decode: int = 20971520) -> bytes: ... # undocumented class GzipDecodedResponse(gzip.GzipFile): # undocumented diff --git a/stdlib/xmlrpc/server.pyi b/stdlib/xmlrpc/server.pyi index 4d28974cbbed..f92dab58335c 100644 --- a/stdlib/xmlrpc/server.pyi +++ b/stdlib/xmlrpc/server.pyi @@ -32,7 +32,7 @@ _DispatchProtocol: TypeAlias = ( _DispatchArity0 | _DispatchArity1 | _DispatchArity2 | _DispatchArity3 | _DispatchArity4 | _DispatchArityN ) -def resolve_dotted_attribute(obj: Any, attr: str, allow_dotted_names: bool = ...) -> Any: ... # undocumented +def resolve_dotted_attribute(obj: Any, attr: str, allow_dotted_names: bool = True) -> Any: ... # undocumented def list_public_methods(obj: Any) -> list[str]: ... # undocumented class SimpleXMLRPCDispatcher: # undocumented diff --git a/stdlib/zipapp.pyi b/stdlib/zipapp.pyi index 3363161c3c6f..c7cf1704b135 100644 --- a/stdlib/zipapp.pyi +++ b/stdlib/zipapp.pyi @@ -11,10 +11,10 @@ class ZipAppError(ValueError): ... def create_archive( source: _Path, - target: _Path | None = ..., - interpreter: str | None = ..., - main: str | None = ..., - filter: Callable[[Path], bool] | None = ..., - compressed: bool = ..., + target: _Path | None = None, + interpreter: str | None = None, + main: str | None = None, + filter: Callable[[Path], bool] | None = None, + compressed: bool = False, ) -> None: ... def get_interpreter(archive: _Path) -> str: ... diff --git a/stdlib/zlib.pyi b/stdlib/zlib.pyi index ea41567eefc5..70b647de2ac1 100644 --- a/stdlib/zlib.pyi +++ b/stdlib/zlib.pyi @@ -43,19 +43,19 @@ class _Decompress: def adler32(__data: ReadableBuffer, __value: int = ...) -> int: ... if sys.version_info >= (3, 11): - def compress(__data: ReadableBuffer, level: int = ..., wbits: int = ...) -> bytes: ... + def compress(__data: ReadableBuffer, level: int = ..., wbits: int = 15) -> bytes: ... else: def compress(__data: ReadableBuffer, level: int = ...) -> bytes: ... def compressobj( level: int = ..., - method: int = ..., - wbits: int = ..., - memLevel: int = ..., - strategy: int = ..., - zdict: ReadableBuffer | None = ..., + method: int = 8, + wbits: int = 15, + memLevel: int = 8, + strategy: int = 0, + zdict: ReadableBuffer | None = None, ) -> _Compress: ... def crc32(__data: ReadableBuffer, __value: int = ...) -> int: ... -def decompress(__data: ReadableBuffer, wbits: int = ..., bufsize: int = ...) -> bytes: ... -def decompressobj(wbits: int = ..., zdict: ReadableBuffer = ...) -> _Decompress: ... +def decompress(__data: ReadableBuffer, wbits: int = 15, bufsize: int = 16384) -> bytes: ... +def decompressobj(wbits: int = 15, zdict: ReadableBuffer = ...) -> _Decompress: ... diff --git a/stdlib/zoneinfo/__init__.pyi b/stdlib/zoneinfo/__init__.pyi index 8b9ba9e7023a..0bdf853f4069 100644 --- a/stdlib/zoneinfo/__init__.pyi +++ b/stdlib/zoneinfo/__init__.pyi @@ -26,7 +26,7 @@ class ZoneInfo(tzinfo): # Note: Both here and in clear_cache, the types allow the use of `str` where # a sequence of strings is required. This should be remedied if a solution # to this typing bug is found: https://github.com/python/typing/issues/256 -def reset_tzpath(to: Sequence[StrPath] | None = ...) -> None: ... +def reset_tzpath(to: Sequence[StrPath] | None = None) -> None: ... def available_timezones() -> set[str]: ... TZPATH: Sequence[str] From ba881817b3f69e391f4b2096dc0a3fa78db44912 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 11 Jan 2023 19:32:24 +0000 Subject: [PATCH 02/16] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/asyncio/format_helpers.pyi | 2 +- stdlib/base64.pyi | 4 +++- stdlib/cgi.pyi | 4 ++-- stdlib/cgitb.pyi | 2 +- stdlib/code.pyi | 2 +- stdlib/codecs.pyi | 8 +++---- stdlib/codeop.pyi | 2 +- stdlib/concurrent/futures/_base.pyi | 4 +++- stdlib/dbm/__init__.pyi | 2 +- stdlib/dbm/dumb.pyi | 2 +- stdlib/difflib.pyi | 27 +++++++++++++---------- stdlib/distutils/archive_util.pyi | 2 +- stdlib/distutils/core.pyi | 2 +- stdlib/distutils/dep_util.pyi | 2 +- stdlib/distutils/filelist.pyi | 2 +- stdlib/doctest.pyi | 7 +++++- stdlib/email/base64mime.pyi | 4 ++-- stdlib/email/header.pyi | 2 +- stdlib/email/iterators.pyi | 2 +- stdlib/email/quoprimime.pyi | 6 ++--- stdlib/email/utils.pyi | 4 ++-- stdlib/encodings/utf_8.pyi | 2 +- stdlib/encodings/utf_8_sig.pyi | 4 ++-- stdlib/ftplib.pyi | 2 +- stdlib/getpass.pyi | 2 +- stdlib/hmac.pyi | 2 +- stdlib/importlib/resources.pyi | 4 ++-- stdlib/lib2to3/pgen2/driver.pyi | 2 +- stdlib/lib2to3/pgen2/pgen.pyi | 2 +- stdlib/logging/__init__.pyi | 6 ++++- stdlib/mailcap.pyi | 2 +- stdlib/multiprocessing/dummy/__init__.pyi | 4 +++- stdlib/os/__init__.pyi | 10 ++++++--- stdlib/pickle.pyi | 12 +++++----- stdlib/pkgutil.pyi | 6 ++--- stdlib/platform.pyi | 14 +++++++----- stdlib/pydoc.pyi | 13 ++++++++--- stdlib/reprlib.pyi | 2 +- stdlib/shelve.pyi | 2 +- stdlib/socket.pyi | 9 ++------ stdlib/statistics.pyi | 2 +- stdlib/sysconfig.pyi | 4 ++-- stdlib/tarfile.pyi | 2 +- stdlib/tempfile.pyi | 2 +- stdlib/timeit.pyi | 6 ++--- stdlib/unittest/loader.pyi | 4 ++-- stdlib/unittest/mock.pyi | 9 ++++++-- stdlib/urllib/parse.pyi | 22 +++++++++--------- stdlib/uu.pyi | 4 +++- stdlib/warnings.pyi | 18 ++++++++------- stdlib/xml/dom/domreg.pyi | 4 +++- stdlib/xml/etree/ElementTree.pyi | 2 +- stdlib/xml/sax/saxutils.pyi | 2 +- stdlib/xmlrpc/client.pyi | 4 +++- stdlib/zlib.pyi | 7 +----- 55 files changed, 159 insertions(+), 125 deletions(-) diff --git a/stdlib/asyncio/format_helpers.pyi b/stdlib/asyncio/format_helpers.pyi index 053f0500558e..1c78dff3948a 100644 --- a/stdlib/asyncio/format_helpers.pyi +++ b/stdlib/asyncio/format_helpers.pyi @@ -16,5 +16,5 @@ def _get_function_source(func: _FuncType) -> tuple[str, int]: ... def _get_function_source(func: object) -> tuple[str, int] | None: ... def _format_callback_source(func: object, args: Iterable[Any]) -> str: ... def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ... -def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = '') -> str: ... +def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = "") -> str: ... def extract_stack(f: FrameType | None = None, limit: int | None = None) -> traceback.StackSummary: ... diff --git a/stdlib/base64.pyi b/stdlib/base64.pyi index e60ac754ef51..9a6964553a4a 100644 --- a/stdlib/base64.pyi +++ b/stdlib/base64.pyi @@ -41,7 +41,9 @@ if sys.version_info >= (3, 10): def b32hexencode(s: ReadableBuffer) -> bytes: ... def b32hexdecode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: ... -def a85encode(b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False) -> bytes: ... +def a85encode( + b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False +) -> bytes: ... def a85decode( b: str | ReadableBuffer, *, foldspaces: bool = False, adobe: bool = False, ignorechars: bytearray | bytes = ... ) -> bytes: ... diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index dd2e2c87353b..bb0c2082b821 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -29,7 +29,7 @@ def parse( environ: SupportsItemAccess[str, str] = ..., keep_blank_values: bool = 0, strict_parsing: bool = 0, - separator: str = '&', + separator: str = "&", ) -> dict[str, list[str]]: ... if sys.version_info < (3, 8): @@ -37,7 +37,7 @@ if sys.version_info < (3, 8): def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ... def parse_multipart( - fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = 'utf-8', errors: str = 'replace', separator: str = '&' + fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = "utf-8", errors: str = "replace", separator: str = "&" ) -> dict[str, list[Any]]: ... class _Environ(Protocol): diff --git a/stdlib/cgitb.pyi b/stdlib/cgitb.pyi index d421cf5da654..f2990847befd 100644 --- a/stdlib/cgitb.pyi +++ b/stdlib/cgitb.pyi @@ -29,4 +29,4 @@ class Hook: # undocumented def handle(self, info: OptExcInfo | None = ...) -> None: ... def handler(info: OptExcInfo | None = None) -> None: ... -def enable(display: int = 1, logdir: StrOrBytesPath | None = None, context: int = 5, format: str = 'html') -> None: ... +def enable(display: int = 1, logdir: StrOrBytesPath | None = None, context: int = 5, format: str = "html") -> None: ... diff --git a/stdlib/code.pyi b/stdlib/code.pyi index 9dee9857e408..6fafccebe479 100644 --- a/stdlib/code.pyi +++ b/stdlib/code.pyi @@ -30,4 +30,4 @@ def interact( local: Mapping[str, Any] | None = None, exitmsg: str | None = None, ) -> None: ... -def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... +def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index ee4914dee8fa..4176682edc57 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -128,11 +128,11 @@ def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ... def getreader(encoding: str) -> _StreamReader: ... def getwriter(encoding: str) -> _StreamWriter: ... def open( - filename: str, mode: str = 'r', encoding: str | None = None, errors: str = 'strict', buffering: int = ... + filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = ... ) -> StreamReaderWriter: ... -def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = 'strict') -> StreamRecoder: ... -def iterencode(iterator: Iterable[str], encoding: str, errors: str = 'strict') -> Generator[bytes, None, None]: ... -def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = 'strict') -> Generator[str, None, None]: ... +def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = "strict") -> StreamRecoder: ... +def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes, None, None]: ... +def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = "strict") -> Generator[str, None, None]: ... BOM: Literal[b"\xff\xfe", b"\xfe\xff"] # depends on `sys.byteorder` BOM_BE: Literal[b"\xfe\xff"] diff --git a/stdlib/codeop.pyi b/stdlib/codeop.pyi index cf04beb98ddb..c076599e6ac0 100644 --- a/stdlib/codeop.pyi +++ b/stdlib/codeop.pyi @@ -2,7 +2,7 @@ from types import CodeType __all__ = ["compile_command", "Compile", "CommandCompiler"] -def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... +def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... class Compile: flags: int diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index 8acbbda3aaeb..b659f9a27e4c 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -84,7 +84,9 @@ class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]): @overload def __getitem__(self, __s: slice) -> DoneAndNotDoneFutures[_T]: ... -def wait(fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = 'ALL_COMPLETED') -> DoneAndNotDoneFutures[_T]: ... +def wait( + fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = "ALL_COMPLETED" +) -> DoneAndNotDoneFutures[_T]: ... class _Waiter: event: threading.Event diff --git a/stdlib/dbm/__init__.pyi b/stdlib/dbm/__init__.pyi index 88778cf95873..5c44553dd668 100644 --- a/stdlib/dbm/__init__.pyi +++ b/stdlib/dbm/__init__.pyi @@ -92,4 +92,4 @@ class _error(Exception): ... error: tuple[type[_error], type[OSError]] def whichdb(filename: str) -> str: ... -def open(file: str, flag: _TFlags = 'r', mode: int = 438) -> _Database: ... +def open(file: str, flag: _TFlags = "r", mode: int = 438) -> _Database: ... diff --git a/stdlib/dbm/dumb.pyi b/stdlib/dbm/dumb.pyi index 098678e84ec3..ae2ee1124554 100644 --- a/stdlib/dbm/dumb.pyi +++ b/stdlib/dbm/dumb.pyi @@ -29,4 +29,4 @@ class _Database(MutableMapping[_KeyType, bytes]): self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... -def open(file: str, flag: str = 'c', mode: int = 438) -> _Database: ... +def open(file: str, flag: str = "c", mode: int = 438) -> _Database: ... diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 3c261c20229d..8063ae104f30 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -70,29 +70,32 @@ class Differ: def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ... def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ... # pat is undocumented -def IS_CHARACTER_JUNK(ch: str, ws: str = ' \t') -> bool: ... # ws is undocumented +def IS_CHARACTER_JUNK(ch: str, ws: str = " \t") -> bool: ... # ws is undocumented def unified_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = '', - tofile: str = '', - fromfiledate: str = '', - tofiledate: str = '', + fromfile: str = "", + tofile: str = "", + fromfiledate: str = "", + tofiledate: str = "", n: int = 3, - lineterm: str = '\n', + lineterm: str = "\n", ) -> Iterator[str]: ... def context_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = '', - tofile: str = '', - fromfiledate: str = '', - tofiledate: str = '', + fromfile: str = "", + tofile: str = "", + fromfiledate: str = "", + tofiledate: str = "", n: int = 3, - lineterm: str = '\n', + lineterm: str = "\n", ) -> Iterator[str]: ... def ndiff( - a: Sequence[str], b: Sequence[str], linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = ... + a: Sequence[str], + b: Sequence[str], + linejunk: Callable[[str], bool] | None = None, + charjunk: Callable[[str], bool] | None = ..., ) -> Iterator[str]: ... class HtmlDiff: diff --git a/stdlib/distutils/archive_util.pyi b/stdlib/distutils/archive_util.pyi index d2723d60ca1b..a8947ce35c60 100644 --- a/stdlib/distutils/archive_util.pyi +++ b/stdlib/distutils/archive_util.pyi @@ -11,7 +11,7 @@ def make_archive( def make_tarball( base_name: str, base_dir: str, - compress: str | None = 'gzip', + compress: str | None = "gzip", verbose: int = 0, dry_run: int = 0, owner: str | None = None, diff --git a/stdlib/distutils/core.pyi b/stdlib/distutils/core.pyi index 98639068f635..56081f921378 100644 --- a/stdlib/distutils/core.pyi +++ b/stdlib/distutils/core.pyi @@ -46,4 +46,4 @@ def setup( fullname: str = ..., **attrs: Any, ) -> None: ... -def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = 'run') -> Distribution: ... +def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = "run") -> Distribution: ... diff --git a/stdlib/distutils/dep_util.pyi b/stdlib/distutils/dep_util.pyi index 4fb898c6581b..096ce19d4859 100644 --- a/stdlib/distutils/dep_util.pyi +++ b/stdlib/distutils/dep_util.pyi @@ -1,3 +1,3 @@ def newer(source: str, target: str) -> bool: ... def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ... -def newer_group(sources: list[str], target: str, missing: str = 'error') -> bool: ... +def newer_group(sources: list[str], target: str, missing: str = "error") -> bool: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index e38f9dcdccdd..0d313f151321 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -37,7 +37,7 @@ class FileList: self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... ) -> bool: ... -def findall(dir: str = '.') -> list[str]: ... +def findall(dir: str = ".") -> list[str]: ... def glob_to_re(pattern: str) -> str: ... @overload def translate_pattern( diff --git a/stdlib/doctest.pyi b/stdlib/doctest.pyi index 0c82d689206c..6a81e313c236 100644 --- a/stdlib/doctest.pyi +++ b/stdlib/doctest.pyi @@ -190,7 +190,12 @@ def testfile( encoding: str | None = None, ) -> TestResults: ... def run_docstring_examples( - f: object, globs: dict[str, Any], verbose: bool = False, name: str = 'NoName', compileflags: int | None = None, optionflags: int = 0 + f: object, + globs: dict[str, Any], + verbose: bool = False, + name: str = "NoName", + compileflags: int | None = None, + optionflags: int = 0, ) -> None: ... def set_unittest_reportflags(flags: int) -> int: ... diff --git a/stdlib/email/base64mime.pyi b/stdlib/email/base64mime.pyi index 2c49ba7192ad..563cd7f669a2 100644 --- a/stdlib/email/base64mime.pyi +++ b/stdlib/email/base64mime.pyi @@ -3,10 +3,10 @@ __all__ = ["body_decode", "body_encode", "decode", "decodestring", "header_encod from _typeshed import ReadableBuffer def header_length(bytearray: str | bytes | bytearray) -> int: ... -def header_encode(header_bytes: str | ReadableBuffer, charset: str = 'iso-8859-1') -> str: ... +def header_encode(header_bytes: str | ReadableBuffer, charset: str = "iso-8859-1") -> str: ... # First argument should be a buffer that supports slicing and len(). -def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = '\n') -> str: ... +def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = "\n") -> str: ... def decode(string: str | ReadableBuffer) -> bytes: ... body_decode = decode diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index ce74483dcaf2..8f877efa67df 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -27,5 +27,5 @@ def make_header( decoded_seq: Iterable[tuple[bytes | bytearray | str, str | None]], maxlinelen: int | None = None, header_name: str | None = None, - continuation_ws: str = ' ', + continuation_ws: str = " ", ) -> Header: ... diff --git a/stdlib/email/iterators.pyi b/stdlib/email/iterators.pyi index 67e782c3d436..d964d6843833 100644 --- a/stdlib/email/iterators.pyi +++ b/stdlib/email/iterators.pyi @@ -5,7 +5,7 @@ from email.message import Message __all__ = ["body_line_iterator", "typed_subpart_iterator", "walk"] def body_line_iterator(msg: Message, decode: bool = False) -> Iterator[str]: ... -def typed_subpart_iterator(msg: Message, maintype: str = 'text', subtype: str | None = None) -> Iterator[str]: ... +def typed_subpart_iterator(msg: Message, maintype: str = "text", subtype: str | None = None) -> Iterator[str]: ... def walk(self: Message) -> Iterator[Message]: ... # We include the seemingly private function because it is documented in the stdlib documentation. diff --git a/stdlib/email/quoprimime.pyi b/stdlib/email/quoprimime.pyi index 2e38d8313a87..87d08eecc70c 100644 --- a/stdlib/email/quoprimime.pyi +++ b/stdlib/email/quoprimime.pyi @@ -19,9 +19,9 @@ def header_length(bytearray: Iterable[int]) -> int: ... def body_length(bytearray: Iterable[int]) -> int: ... def unquote(s: str | bytes | bytearray) -> str: ... def quote(c: str | bytes | bytearray) -> str: ... -def header_encode(header_bytes: bytes | bytearray, charset: str = 'iso-8859-1') -> str: ... -def body_encode(body: str, maxlinelen: int = 76, eol: str = '\n') -> str: ... -def decode(encoded: str, eol: str = '\n') -> str: ... +def header_encode(header_bytes: bytes | bytearray, charset: str = "iso-8859-1") -> str: ... +def body_encode(body: str, maxlinelen: int = 76, eol: str = "\n") -> str: ... +def decode(encoded: str, eol: str = "\n") -> str: ... def header_decode(s: str) -> str: ... body_decode = decode diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index bfa7bc1d9161..97838343b1c5 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -28,7 +28,7 @@ _PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None def quote(str: str) -> str: ... def unquote(str: str) -> str: ... def parseaddr(addr: str | None) -> tuple[str, str]: ... -def formataddr(pair: tuple[str | None, str], charset: str | Charset = 'utf-8') -> str: ... +def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") -> str: ... def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... @overload def parsedate(data: None) -> None: ... @@ -55,5 +55,5 @@ def localtime(dt: datetime.datetime | None = None, isdst: int = ...) -> datetime def make_msgid(idstring: str | None = None, domain: str | None = None) -> str: ... def decode_rfc2231(s: str) -> tuple[str | None, str | None, str]: ... def encode_rfc2231(s: str, charset: str | None = None, language: str | None = None) -> str: ... -def collapse_rfc2231_value(value: _ParamType, errors: str = 'replace', fallback_charset: str = 'us-ascii') -> str: ... +def collapse_rfc2231_value(value: _ParamType, errors: str = "replace", fallback_charset: str = "us-ascii") -> str: ... def decode_params(params: list[tuple[str, str]]) -> list[tuple[str, _ParamType]]: ... diff --git a/stdlib/encodings/utf_8.pyi b/stdlib/encodings/utf_8.pyi index 4332129de63d..6b2168688b80 100644 --- a/stdlib/encodings/utf_8.pyi +++ b/stdlib/encodings/utf_8.pyi @@ -18,4 +18,4 @@ class StreamReader(codecs.StreamReader): def getregentry() -> codecs.CodecInfo: ... def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... diff --git a/stdlib/encodings/utf_8_sig.pyi b/stdlib/encodings/utf_8_sig.pyi index 04d6eec1d6df..8b1c38f18a1c 100644 --- a/stdlib/encodings/utf_8_sig.pyi +++ b/stdlib/encodings/utf_8_sig.pyi @@ -18,5 +18,5 @@ class StreamReader(codecs.StreamReader): def decode(self, input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... def getregentry() -> codecs.CodecInfo: ... -def encode(input: str, errors: str | None = 'strict') -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... +def encode(input: str, errors: str | None = "strict") -> tuple[bytes, int]: ... +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 82380eb687ce..2aaf6cb2c173 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -161,5 +161,5 @@ def parse227(resp: str) -> tuple[str, int]: ... # undocumented def parse229(resp: str, peer: Any) -> tuple[str, int]: ... # undocumented def parse257(resp: str) -> str: ... # undocumented def ftpcp( - source: FTP, sourcename: str, target: FTP, targetname: str = '', type: Literal["A", "I"] = 'I' + source: FTP, sourcename: str, target: FTP, targetname: str = "", type: Literal["A", "I"] = "I" ) -> None: ... # undocumented diff --git a/stdlib/getpass.pyi b/stdlib/getpass.pyi index bfa48bdcab18..6104e0dedfee 100644 --- a/stdlib/getpass.pyi +++ b/stdlib/getpass.pyi @@ -2,7 +2,7 @@ from typing import TextIO __all__ = ["getpass", "getuser", "GetPassWarning"] -def getpass(prompt: str = 'Password: ', stream: TextIO | None = None) -> str: ... +def getpass(prompt: str = "Password: ", stream: TextIO | None = None) -> str: ... def getuser() -> str: ... class GetPassWarning(UserWarning): ... diff --git a/stdlib/hmac.pyi b/stdlib/hmac.pyi index 35e84c96dff4..2f2dd30e0d61 100644 --- a/stdlib/hmac.pyi +++ b/stdlib/hmac.pyi @@ -23,7 +23,7 @@ if sys.version_info >= (3, 8): def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ... else: - def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = '') -> HMAC: ... + def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = "") -> HMAC: ... class HMAC: digest_size: int diff --git a/stdlib/importlib/resources.pyi b/stdlib/importlib/resources.pyi index 999bd65cd7bf..ba3d9b087754 100644 --- a/stdlib/importlib/resources.pyi +++ b/stdlib/importlib/resources.pyi @@ -23,9 +23,9 @@ else: Resource: TypeAlias = str | os.PathLike[Any] def open_binary(package: Package, resource: Resource) -> BinaryIO: ... -def open_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> TextIO: ... +def open_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> TextIO: ... def read_binary(package: Package, resource: Resource) -> bytes: ... -def read_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... +def read_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> str: ... def path(package: Package, resource: Resource) -> AbstractContextManager[Path]: ... def is_resource(package: Package, name: str) -> bool: ... def contents(package: Package) -> Iterator[str]: ... diff --git a/stdlib/lib2to3/pgen2/driver.pyi b/stdlib/lib2to3/pgen2/driver.pyi index 7f0d5c4bdefa..6d7cf5c91f94 100644 --- a/stdlib/lib2to3/pgen2/driver.pyi +++ b/stdlib/lib2to3/pgen2/driver.pyi @@ -20,5 +20,5 @@ class Driver: def parse_string(self, text: str, debug: bool = ...) -> _NL: ... def load_grammar( - gt: str = 'Grammar.txt', gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None + gt: str = "Grammar.txt", gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None ) -> Grammar: ... diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 9873447fd851..70c96ba66c26 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -43,4 +43,4 @@ class DFAState: def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override] -def generate_grammar(filename: StrPath = 'Grammar.txt') -> PgenGrammar: ... +def generate_grammar(filename: StrPath = "Grammar.txt") -> PgenGrammar: ... diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index 0422481067a2..7c629f620bd5 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -693,7 +693,11 @@ else: msg: object, *args: object, exc_info: _ExcInfoType = ..., stack_info: bool = ..., extra: Mapping[str, object] | None = ... ) -> None: ... def exception( - msg: object, *args: object, exc_info: _ExcInfoType = True, stack_info: bool = ..., extra: Mapping[str, object] | None = ... + msg: object, + *args: object, + exc_info: _ExcInfoType = True, + stack_info: bool = ..., + extra: Mapping[str, object] | None = ..., ) -> None: ... def log( level: int, diff --git a/stdlib/mailcap.pyi b/stdlib/mailcap.pyi index 0acf924e674b..5905f5826bf7 100644 --- a/stdlib/mailcap.pyi +++ b/stdlib/mailcap.pyi @@ -6,6 +6,6 @@ _Cap: TypeAlias = dict[str, str | int] __all__ = ["getcaps", "findmatch"] def findmatch( - caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = 'view', filename: str = '/dev/null', plist: Sequence[str] = ... + caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = "view", filename: str = "/dev/null", plist: Sequence[str] = ... ) -> tuple[str | None, _Cap | None]: ... def getcaps() -> dict[str, list[_Cap]]: ... diff --git a/stdlib/multiprocessing/dummy/__init__.pyi b/stdlib/multiprocessing/dummy/__init__.pyi index a4a8943d8993..2dddaa4f2063 100644 --- a/stdlib/multiprocessing/dummy/__init__.pyi +++ b/stdlib/multiprocessing/dummy/__init__.pyi @@ -69,7 +69,9 @@ class Value: def Array(typecode: Any, sequence: Sequence[Any], lock: Any = True) -> array.array[Any]: ... def Manager() -> Any: ... -def Pool(processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ...) -> Any: ... +def Pool( + processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ... +) -> Any: ... def active_children() -> list[Any]: ... current_process = threading.current_thread diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index ece20ba32a26..b0c29da1792c 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -725,7 +725,9 @@ def remove(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... def removedirs(name: StrOrBytesPath) -> None: ... def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: ... -def replace(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... +def replace( + src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None +) -> None: ... def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr]]): @@ -744,7 +746,9 @@ def stat(path: _FdOrAnyPath, *, dir_fd: int | None = None, follow_symlinks: bool if sys.platform != "win32": def statvfs(path: _FdOrAnyPath) -> statvfs_result: ... # Unix only -def symlink(src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None) -> None: ... +def symlink( + src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None +) -> None: ... if sys.platform != "win32": def sync() -> None: ... # Unix only @@ -844,7 +848,7 @@ class _wrap_close(_TextIOWrapper): def __init__(self, stream: _TextIOWrapper, proc: Popen[str]) -> None: ... def close(self) -> int | None: ... # type: ignore[override] -def popen(cmd: str, mode: str = 'r', buffering: int = ...) -> _wrap_close: ... +def popen(cmd: str, mode: str = "r", buffering: int = ...) -> _wrap_close: ... def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig diff --git a/stdlib/pickle.pyi b/stdlib/pickle.pyi index b61f7959ea77..dc098cae97b7 100644 --- a/stdlib/pickle.pyi +++ b/stdlib/pickle.pyi @@ -119,24 +119,24 @@ if sys.version_info >= (3, 8): file: _ReadableFileobj, *, fix_imports: bool = True, - encoding: str = 'ASCII', - errors: str = 'strict', + encoding: str = "ASCII", + errors: str = "strict", buffers: Iterable[Any] | None = ..., ) -> Any: ... def loads( __data: ReadableBuffer, *, fix_imports: bool = True, - encoding: str = 'ASCII', - errors: str = 'strict', + encoding: str = "ASCII", + errors: str = "strict", buffers: Iterable[Any] | None = ..., ) -> Any: ... else: def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None, *, fix_imports: bool = True) -> None: ... def dumps(obj: Any, protocol: int | None = None, *, fix_imports: bool = True) -> bytes: ... - def load(file: _ReadableFileobj, *, fix_imports: bool = True, encoding: str = 'ASCII', errors: str = 'strict') -> Any: ... - def loads(data: ReadableBuffer, *, fix_imports: bool = True, encoding: str = 'ASCII', errors: str = 'strict') -> Any: ... + def load(file: _ReadableFileobj, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ... + def loads(data: ReadableBuffer, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ... class PickleError(Exception): ... class PicklingError(PickleError): ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index 488ed824302a..16f6a696808b 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -37,11 +37,11 @@ class ImpLoader: def find_loader(fullname: str) -> Loader | None: ... def get_importer(path_item: str) -> PathEntryFinder | None: ... def get_loader(module_or_name: str) -> Loader | None: ... -def iter_importers(fullname: str = '') -> Iterator[MetaPathFinder | PathEntryFinder]: ... -def iter_modules(path: Iterable[str] | None = None, prefix: str = '') -> Iterator[ModuleInfo]: ... +def iter_importers(fullname: str = "") -> Iterator[MetaPathFinder | PathEntryFinder]: ... +def iter_modules(path: Iterable[str] | None = None, prefix: str = "") -> Iterator[ModuleInfo]: ... def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented def walk_packages( - path: Iterable[str] | None = None, prefix: str = '', onerror: Callable[[str], object] | None = None + path: Iterable[str] | None = None, prefix: str = "", onerror: Callable[[str], object] | None = None ) -> Iterator[ModuleInfo]: ... def get_data(package: str, resource: str) -> bytes | None: ... diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index a0b483348c9f..6efdf3e1502f 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -7,10 +7,10 @@ if sys.version_info < (3, 8): from typing import NamedTuple if sys.version_info >= (3, 8): - def libc_ver(executable: str | None = None, lib: str = '', version: str = '', chunksize: int = 16384) -> tuple[str, str]: ... + def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... else: - def libc_ver(executable: str = None, lib: str = '', version: str = '', chunksize: int = 16384) -> tuple[str, str]: ... + def libc_ver(executable: str = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... if sys.version_info < (3, 8): def linux_distribution( @@ -24,20 +24,22 @@ if sys.version_info < (3, 8): distname: str = ..., version: str = ..., id: str = ..., supported_dists: tuple[str, ...] = ... ) -> tuple[str, str, str]: ... -def win32_ver(release: str = '', version: str = '', csd: str = '', ptype: str = '') -> tuple[str, str, str, str]: ... +def win32_ver(release: str = "", version: str = "", csd: str = "", ptype: str = "") -> tuple[str, str, str, str]: ... if sys.version_info >= (3, 8): def win32_edition() -> str: ... def win32_is_iot() -> bool: ... def mac_ver( - release: str = '', versioninfo: tuple[str, str, str] = ..., machine: str = '' + release: str = "", versioninfo: tuple[str, str, str] = ..., machine: str = "" ) -> tuple[str, tuple[str, str, str], str]: ... def java_ver( - release: str = '', vendor: str = '', vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... + release: str = "", vendor: str = "", vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... ) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... -def architecture(executable: str = '/Users/jelle/py/venvs/py311/bin/python', bits: str = '', linkage: str = '') -> tuple[str, str]: ... +def architecture( + executable: str = "/Users/jelle/py/venvs/py311/bin/python", bits: str = "", linkage: str = "" +) -> tuple[str, str]: ... class uname_result(NamedTuple): system: str diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index dc19ea19b73f..f0efb1ce7bf6 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -192,10 +192,17 @@ text: TextDoc html: HTMLDoc def resolve(thing: str | object, forceload: bool = 0) -> tuple[object, str] | None: ... -def render_doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = 0, renderer: Doc | None = None) -> str: ... -def doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = 0, output: SupportsWrite[str] | None = None) -> None: ... +def render_doc( + thing: str | object, title: str = "Python Library Documentation: %s", forceload: bool = 0, renderer: Doc | None = None +) -> str: ... +def doc( + thing: str | object, + title: str = "Python Library Documentation: %s", + forceload: bool = 0, + output: SupportsWrite[str] | None = None, +) -> None: ... def writedoc(thing: str | object, forceload: bool = 0) -> None: ... -def writedocs(dir: str, pkgpath: str = '', done: Any | None = None) -> None: ... +def writedocs(dir: str, pkgpath: str = "", done: Any | None = None) -> None: ... class Helper: keywords: dict[str, str | tuple[str, str]] diff --git a/stdlib/reprlib.pyi b/stdlib/reprlib.pyi index 4f2126d1e32e..21c8a5cd4e0c 100644 --- a/stdlib/reprlib.pyi +++ b/stdlib/reprlib.pyi @@ -8,7 +8,7 @@ __all__ = ["Repr", "repr", "recursive_repr"] _ReprFunc: TypeAlias = Callable[[Any], str] -def recursive_repr(fillvalue: str = '...') -> Callable[[_ReprFunc], _ReprFunc]: ... +def recursive_repr(fillvalue: str = "...") -> Callable[[_ReprFunc], _ReprFunc]: ... class Repr: maxlevel: int diff --git a/stdlib/shelve.pyi b/stdlib/shelve.pyi index 308f46fdac01..52cccd215ae0 100644 --- a/stdlib/shelve.pyi +++ b/stdlib/shelve.pyi @@ -40,4 +40,4 @@ class BsdDbShelf(Shelf[_VT]): class DbfilenameShelf(Shelf[_VT]): def __init__(self, filename: str, flag: _TFlags = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ... -def open(filename: str, flag: _TFlags = 'c', protocol: int | None = None, writeback: bool = False) -> Shelf[Any]: ... +def open(filename: str, flag: _TFlags = "c", protocol: int | None = None, writeback: bool = False) -> Shelf[Any]: ... diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index d5bb48f36f84..98d86b123b55 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -761,7 +761,7 @@ class SocketIO(RawIOBase): @property def mode(self) -> Literal["rb", "wb", "rwb"]: ... -def getfqdn(name: str = '') -> str: ... +def getfqdn(name: str = "") -> str: ... if sys.version_info >= (3, 11): def create_connection( @@ -785,10 +785,5 @@ if sys.version_info >= (3, 8): # the 5th tuple item is an address def getaddrinfo( - host: bytes | str | None, - port: bytes | str | int | None, - family: int = 0, - type: int = 0, - proto: int = 0, - flags: int = 0, + host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0 ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index 1bf29e07983e..9a834e6b20ea 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -73,7 +73,7 @@ def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: if sys.version_info >= (3, 8): def quantiles( - data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = 'exclusive' + data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = "exclusive" ) -> list[_NumberT]: ... def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: ... diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 02d24485305c..7af163ddc0ae 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -28,8 +28,8 @@ if sys.version_info >= (3, 10): def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... def get_path_names() -> tuple[str, ...]: ... -def get_path(name: str, scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... -def get_paths(scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... +def get_path(name: str, scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... +def get_paths(scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... def is_python_build(check_home: bool = None) -> bool: ... diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index e120b4146448..e92ad95959da 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -90,7 +90,7 @@ ENCODING: str def open( name: StrOrBytesPath | None = None, - mode: str = 'r', + mode: str = "r", fileobj: IO[bytes] | None = None, # depends on mode bufsize: int = 10240, *, diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index bccae1f8c4ff..1ed7a9fb85bb 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -399,7 +399,7 @@ def mkstemp( def mkdtemp(suffix: str | None = ..., prefix: str | None = ..., dir: StrPath | None = ...) -> str: ... # type: ignore[misc] @overload def mkdtemp(suffix: bytes | None = ..., prefix: bytes | None = ..., dir: BytesPath | None = ...) -> bytes: ... -def mktemp(suffix: str = '', prefix: str = 'tmp', dir: StrPath | None = None) -> str: ... +def mktemp(suffix: str = "", prefix: str = "tmp", dir: StrPath | None = None) -> str: ... def gettempdirb() -> bytes: ... def gettempprefixb() -> bytes: ... def gettempdir() -> str: ... diff --git a/stdlib/timeit.pyi b/stdlib/timeit.pyi index 89c4c9c5e97f..be7d16703098 100644 --- a/stdlib/timeit.pyi +++ b/stdlib/timeit.pyi @@ -19,11 +19,11 @@ class Timer: def autorange(self, callback: Callable[[int, float], object] | None = ...) -> tuple[int, float]: ... def timeit( - stmt: _Stmt = 'pass', setup: _Stmt = 'pass', timer: _Timer = ..., number: int = 1000000, globals: dict[str, Any] | None = None + stmt: _Stmt = "pass", setup: _Stmt = "pass", timer: _Timer = ..., number: int = 1000000, globals: dict[str, Any] | None = None ) -> float: ... def repeat( - stmt: _Stmt = 'pass', - setup: _Stmt = 'pass', + stmt: _Stmt = "pass", + setup: _Stmt = "pass", timer: _Timer = ..., repeat: int = 5, number: int = 1000000, diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index a1c497099d79..72b21f2553f3 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -35,10 +35,10 @@ def getTestCaseNames( ) -> Sequence[str]: ... def makeSuite( testCaseClass: type[unittest.case.TestCase], - prefix: str = 'test', + prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ..., ) -> unittest.suite.TestSuite: ... def findTestCases( - module: ModuleType, prefix: str = 'test', sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... + module: ModuleType, prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... ) -> unittest.suite.TestSuite: ... diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 5dd7c71678f2..97e3715aae11 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -403,7 +403,12 @@ if sys.version_info >= (3, 10): else: def create_autospec( - spec: Any, spec_set: Any = False, instance: Any = False, _parent: Any | None = None, _name: Any | None = None, **kwargs: Any + spec: Any, + spec_set: Any = False, + instance: Any = False, + _parent: Any | None = None, + _name: Any | None = None, + **kwargs: Any, ) -> Any: ... class _SpecState: @@ -423,7 +428,7 @@ class _SpecState: instance: Any = ..., ) -> None: ... -def mock_open(mock: Any | None = None, read_data: Any = '') -> Any: ... +def mock_open(mock: Any | None = None, read_data: Any = "") -> Any: ... class PropertyMock(Mock): if sys.version_info >= (3, 8): diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 4dd3ba82d079..bc7bfbdb92e0 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -117,38 +117,38 @@ def parse_qs( qs: AnyStr | None, keep_blank_values: bool = False, strict_parsing: bool = False, - encoding: str = 'utf-8', - errors: str = 'replace', + encoding: str = "utf-8", + errors: str = "replace", max_num_fields: int | None = None, - separator: str = '&', + separator: str = "&", ) -> dict[AnyStr, list[AnyStr]]: ... def parse_qsl( qs: AnyStr | None, keep_blank_values: bool = False, strict_parsing: bool = False, - encoding: str = 'utf-8', - errors: str = 'replace', + encoding: str = "utf-8", + errors: str = "replace", max_num_fields: int | None = None, - separator: str = '&', + separator: str = "&", ) -> list[tuple[AnyStr, AnyStr]]: ... @overload def quote(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... -def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = '/') -> str: ... +def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = "/") -> str: ... @overload def quote_plus(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote_plus(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... if sys.version_info >= (3, 9): - def unquote(string: str | bytes, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... + def unquote(string: str | bytes, encoding: str = "utf-8", errors: str = "replace") -> str: ... else: - def unquote(string: str, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... + def unquote(string: str, encoding: str = "utf-8", errors: str = "replace") -> str: ... def unquote_to_bytes(string: str | bytes | bytearray) -> bytes: ... -def unquote_plus(string: str, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... +def unquote_plus(string: str, encoding: str = "utf-8", errors: str = "replace") -> str: ... @overload def urldefrag(url: str) -> DefragResult: ... @overload @@ -159,7 +159,7 @@ _Q = TypeVar("_Q", bound=str | Iterable[int]) def urlencode( query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]], doseq: bool = False, - safe: _Q = '', + safe: _Q = "", encoding: str = None, errors: str = None, quote_via: Callable[[AnyStr, _Q, str, str], str] = ..., diff --git a/stdlib/uu.pyi b/stdlib/uu.pyi index 363439a80e0a..20e79bf3fec9 100644 --- a/stdlib/uu.pyi +++ b/stdlib/uu.pyi @@ -7,5 +7,7 @@ _File: TypeAlias = str | BinaryIO class Error(Exception): ... -def encode(in_file: _File, out_file: _File, name: str | None = None, mode: int | None = None, *, backtick: bool = False) -> None: ... +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: ... diff --git a/stdlib/warnings.pyi b/stdlib/warnings.pyi index 851abafc529a..8c14bb914640 100644 --- a/stdlib/warnings.pyi +++ b/stdlib/warnings.pyi @@ -22,16 +22,18 @@ _ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "module filters: Sequence[tuple[str, str | None, type[Warning], str | None, int]] # undocumented, do not mutate def showwarning( - message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = None, line: str | None = None + message: Warning | str, + category: type[Warning], + filename: str, + lineno: int, + file: TextIO | None = None, + line: str | None = None, ) -> None: ... -def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = None) -> str: ... +def formatwarning( + message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = None +) -> str: ... def filterwarnings( - action: _ActionKind, - message: str = '', - category: type[Warning] = ..., - module: str = '', - lineno: int = 0, - append: bool = False, + action: _ActionKind, message: str = "", category: type[Warning] = ..., module: str = "", lineno: int = 0, append: bool = False ) -> None: ... def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = 0, append: bool = False) -> None: ... def resetwarnings() -> None: ... diff --git a/stdlib/xml/dom/domreg.pyi b/stdlib/xml/dom/domreg.pyi index 75b7796c4718..a46d3ff090e6 100644 --- a/stdlib/xml/dom/domreg.pyi +++ b/stdlib/xml/dom/domreg.pyi @@ -5,4 +5,6 @@ well_known_implementations: dict[str, str] registered: dict[str, Callable[[], DOMImplementation]] def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... -def getDOMImplementation(name: str | None = None, features: str | Iterable[tuple[str, str | None]] = ...) -> DOMImplementation: ... +def getDOMImplementation( + name: str | None = None, features: str | Iterable[tuple[str, str | None]] = ... +) -> DOMImplementation: ... diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index 7b8a2388e02d..4cf07295b66d 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -261,7 +261,7 @@ else: def dump(elem: Element) -> None: ... if sys.version_info >= (3, 9): - def indent(tree: Element | ElementTree, space: str = ' ', level: int = 0) -> None: ... + def indent(tree: Element | ElementTree, space: str = " ", level: int = 0) -> None: ... def parse(source: _FileRead, parser: XMLParser | None = None) -> ElementTree: ... def iterparse( diff --git a/stdlib/xml/sax/saxutils.pyi b/stdlib/xml/sax/saxutils.pyi index 74d6c98a2f3c..b65e9960394f 100644 --- a/stdlib/xml/sax/saxutils.pyi +++ b/stdlib/xml/sax/saxutils.pyi @@ -57,4 +57,4 @@ class XMLFilterBase(xmlreader.XMLReader): def getParent(self): ... def setParent(self, parent): ... -def prepare_input_source(source, base=''): ... +def prepare_input_source(source, base=""): ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 272ffd775961..fa3b676e9ee1 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -208,7 +208,9 @@ def dumps( encoding: str | None = None, allow_none: bool = False, ) -> str: ... -def loads(data: str, use_datetime: bool = False, use_builtin_types: bool = False) -> tuple[tuple[_Marshallable, ...], str | None]: ... +def loads( + data: str, use_datetime: bool = False, use_builtin_types: bool = False +) -> tuple[tuple[_Marshallable, ...], str | None]: ... def gzip_encode(data: ReadableBuffer) -> bytes: ... # undocumented def gzip_decode(data: ReadableBuffer, max_decode: int = 20971520) -> bytes: ... # undocumented diff --git a/stdlib/zlib.pyi b/stdlib/zlib.pyi index 70b647de2ac1..11151a92e16c 100644 --- a/stdlib/zlib.pyi +++ b/stdlib/zlib.pyi @@ -49,12 +49,7 @@ else: def compress(__data: ReadableBuffer, level: int = ...) -> bytes: ... def compressobj( - level: int = ..., - method: int = 8, - wbits: int = 15, - memLevel: int = 8, - strategy: int = 0, - zdict: ReadableBuffer | None = None, + level: int = ..., method: int = 8, wbits: int = 15, memLevel: int = 8, strategy: int = 0, zdict: ReadableBuffer | None = None ) -> _Compress: ... def crc32(__data: ReadableBuffer, __value: int = ...) -> int: ... def decompress(__data: ReadableBuffer, wbits: int = 15, bufsize: int = 16384) -> bytes: ... From 9d0075c0e8881b9d53bec4b751d43b6d717b4f2e Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 11 Jan 2023 11:42:47 -0800 Subject: [PATCH 03/16] revert some stuff to ... --- stdlib/cgi.pyi | 4 ++-- stdlib/compileall.pyi | 2 +- stdlib/distutils/file_util.pyi | 12 ++++++------ stdlib/distutils/spawn.pyi | 2 +- stdlib/distutils/sysconfig.pyi | 4 ++-- stdlib/distutils/util.pyi | 8 ++++---- stdlib/platform.pyi | 4 ++-- stdlib/pydoc.pyi | 12 ++++++------ stdlib/shutil.pyi | 4 ++-- stdlib/sysconfig.pyi | 2 +- stdlib/urllib/parse.pyi | 4 ++-- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index bb0c2082b821..3cca2f1dd4c0 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -27,8 +27,8 @@ if sys.version_info < (3, 8): def parse( fp: IO[Any] | None = None, environ: SupportsItemAccess[str, str] = ..., - keep_blank_values: bool = 0, - strict_parsing: bool = 0, + keep_blank_values: bool = ..., + strict_parsing: bool = ..., separator: str = "&", ) -> dict[str, list[str]]: ... diff --git a/stdlib/compileall.pyi b/stdlib/compileall.pyi index 5ad2dd2dc2a7..4c83fa70cc46 100644 --- a/stdlib/compileall.pyi +++ b/stdlib/compileall.pyi @@ -101,7 +101,7 @@ else: ) -> int: ... def compile_path( - skip_curdir: bool = 1, + skip_curdir: bool = ..., maxlevels: int = 0, force: bool = False, quiet: int = 0, diff --git a/stdlib/distutils/file_util.pyi b/stdlib/distutils/file_util.pyi index 6738be023a10..a97dfca60007 100644 --- a/stdlib/distutils/file_util.pyi +++ b/stdlib/distutils/file_util.pyi @@ -3,12 +3,12 @@ from collections.abc import Sequence def copy_file( src: str, dst: str, - preserve_mode: bool = 1, - preserve_times: bool = 1, - update: bool = 0, + preserve_mode: bool = ..., + preserve_times: bool = ..., + update: bool = ..., link: str | None = None, - verbose: bool = 1, - dry_run: bool = 0, + verbose: bool = ..., + dry_run: bool = ..., ) -> tuple[str, str]: ... -def move_file(src: str, dst: str, verbose: bool = 1, dry_run: bool = 0) -> str: ... +def move_file(src: str, dst: str, verbose: bool = ..., dry_run: bool = ...) -> str: ... def write_file(filename: str, contents: Sequence[str]) -> None: ... diff --git a/stdlib/distutils/spawn.pyi b/stdlib/distutils/spawn.pyi index e18fcbb4f4c9..a8a2c4140b2d 100644 --- a/stdlib/distutils/spawn.pyi +++ b/stdlib/distutils/spawn.pyi @@ -1,2 +1,2 @@ -def spawn(cmd: list[str], search_path: bool = 1, verbose: bool = 0, dry_run: bool = 0) -> None: ... +def spawn(cmd: list[str], search_path: bool = ..., verbose: bool = ..., dry_run: bool = ...) -> None: ... def find_executable(executable: str, path: str | None = None) -> str | None: ... diff --git a/stdlib/distutils/sysconfig.pyi b/stdlib/distutils/sysconfig.pyi index 7351b42fef7e..8b291e8b94a5 100644 --- a/stdlib/distutils/sysconfig.pyi +++ b/stdlib/distutils/sysconfig.pyi @@ -8,6 +8,6 @@ def get_config_var(name: str) -> int | str | None: ... def get_config_vars(*args: str) -> Mapping[str, int | str]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... -def get_python_inc(plat_specific: bool = 0, prefix: str | None = None) -> str: ... -def get_python_lib(plat_specific: bool = 0, standard_lib: bool = 0, prefix: str | None = None) -> str: ... +def get_python_inc(plat_specific: bool = ..., prefix: str | None = None) -> str: ... +def get_python_lib(plat_specific: bool = ..., standard_lib: bool = ..., prefix: str | None = None) -> str: ... def customize_compiler(compiler: CCompiler) -> None: ... diff --git a/stdlib/distutils/util.pyi b/stdlib/distutils/util.pyi index 81af04390993..3788ada29925 100644 --- a/stdlib/distutils/util.pyi +++ b/stdlib/distutils/util.pyi @@ -10,17 +10,17 @@ def check_environ() -> None: ... def subst_vars(s: str, local_vars: Mapping[str, str]) -> None: ... def split_quoted(s: str) -> list[str]: ... def execute( - func: Callable[..., object], args: tuple[Any, ...], msg: str | None = None, verbose: bool = 0, dry_run: bool = 0 + func: Callable[..., object], args: tuple[Any, ...], msg: str | None = None, verbose: bool = ..., dry_run: bool = ... ) -> None: ... def strtobool(val: str) -> Literal[0, 1]: ... def byte_compile( py_files: list[str], optimize: int = 0, - force: bool = 0, + force: bool = ..., prefix: str | None = None, base_dir: str | None = None, - verbose: bool = 1, - dry_run: bool = 0, + verbose: bool = ..., + dry_run: bool = ..., direct: bool | None = None, ) -> None: ... def rfc822_escape(header: str) -> str: ... diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index 6efdf3e1502f..92e8657e20b5 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -10,7 +10,7 @@ if sys.version_info >= (3, 8): def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... else: - def libc_ver(executable: str = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... + def libc_ver(executable: str = ..., lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... if sys.version_info < (3, 8): def linux_distribution( @@ -63,7 +63,7 @@ def python_branch() -> str: ... def python_revision() -> str: ... def python_build() -> tuple[str, str]: ... def python_compiler() -> str: ... -def platform(aliased: bool = 0, terse: bool = 0) -> str: ... +def platform(aliased: bool = ..., terse: bool = ...) -> str: ... if sys.version_info >= (3, 10): def freedesktop_os_release() -> dict[str, str]: ... diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index f0efb1ce7bf6..724dc0f4045f 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -40,7 +40,7 @@ class ErrorDuringImport(Exception): def __init__(self, filename: str, exc_info: OptExcInfo) -> None: ... def importfile(path: str) -> ModuleType: ... -def safeimport(path: str, forceload: bool = 0, cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ... +def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, ModuleType] = ...) -> ModuleType: ... class Doc: PYTHONDOCS: str @@ -186,22 +186,22 @@ def tempfilepager(text: str, cmd: str) -> None: ... def ttypager(text: str) -> None: ... def plainpager(text: str) -> None: ... def describe(thing: Any) -> str: ... -def locate(path: str, forceload: bool = 0) -> object: ... +def locate(path: str, forceload: bool = ...) -> object: ... text: TextDoc html: HTMLDoc -def resolve(thing: str | object, forceload: bool = 0) -> tuple[object, str] | None: ... +def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ... def render_doc( - thing: str | object, title: str = "Python Library Documentation: %s", forceload: bool = 0, renderer: Doc | None = None + thing: str | object, title: str = "Python Library Documentation: %s", forceload: bool = ..., renderer: Doc | None = None ) -> str: ... def doc( thing: str | object, title: str = "Python Library Documentation: %s", - forceload: bool = 0, + forceload: bool = ..., output: SupportsWrite[str] | None = None, ) -> None: ... -def writedoc(thing: str | object, forceload: bool = 0) -> None: ... +def writedoc(thing: str | object, forceload: bool = ...) -> None: ... def writedocs(dir: str, pkgpath: str = "", done: Any | None = None) -> None: ... class Helper: diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index 4de25c11062a..2632ef4f57a8 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -146,8 +146,8 @@ def make_archive( format: str, root_dir: StrPath | None = None, base_dir: StrPath | None = None, - verbose: bool = 0, - dry_run: bool = 0, + verbose: bool = ..., + dry_run: bool = ..., owner: str | None = None, group: str | None = None, logger: Any | None = None, diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 7af163ddc0ae..c857fd25fa3a 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -32,7 +32,7 @@ def get_path(name: str, scheme: str = "venv", vars: dict[str, Any] | None = None def get_paths(scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... -def is_python_build(check_home: bool = None) -> bool: ... +def is_python_build(check_home: bool = ...) -> bool: ... def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = None) -> dict[str, Any]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index bc7bfbdb92e0..53555d2eb744 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -159,8 +159,8 @@ _Q = TypeVar("_Q", bound=str | Iterable[int]) def urlencode( query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]], doseq: bool = False, - safe: _Q = "", - encoding: str = None, + safe: _Q = ..., + encoding: str = ..., errors: str = None, quote_via: Callable[[AnyStr, _Q, str, str], str] = ..., ) -> str: ... From f876535b0228f17d5937a0823166f41c216e3c49 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 11 Jan 2023 11:45:17 -0800 Subject: [PATCH 04/16] two more --- stdlib/ssl.pyi | 2 +- stdlib/urllib/parse.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index 8dbda4665808..9f275d3e822c 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -64,7 +64,7 @@ def create_default_context( cadata: str | ReadableBuffer | None = None, ) -> SSLContext: ... def _create_unverified_context( - protocol: int = None, + protocol: int = ..., *, cert_reqs: int = 0, check_hostname: bool = False, diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 53555d2eb744..0843a543162d 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -161,7 +161,7 @@ def urlencode( doseq: bool = False, safe: _Q = ..., encoding: str = ..., - errors: str = None, + errors: str = ..., quote_via: Callable[[AnyStr, _Q, str, str], str] = ..., ) -> str: ... def urljoin(base: AnyStr, url: AnyStr | None, allow_fragments: bool = True) -> AnyStr: ... From e85b535c14bd9dc6bc943df45d9b8a2862089191 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 11 Jan 2023 12:03:09 -0800 Subject: [PATCH 05/16] two more --- stdlib/asyncio/runners.pyi | 2 +- stdlib/compileall.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 8a6989449188..b2a78aed0e39 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -32,4 +32,4 @@ elif sys.version_info >= (3, 8): def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = None) -> _T: ... else: - def run(main: Coroutine[Any, Any, _T], *, debug: bool = None) -> _T: ... + def run(main: Coroutine[Any, Any, _T], *, debug: bool = ...) -> _T: ... diff --git a/stdlib/compileall.pyi b/stdlib/compileall.pyi index 4c83fa70cc46..bea31f47fc1f 100644 --- a/stdlib/compileall.pyi +++ b/stdlib/compileall.pyi @@ -79,7 +79,7 @@ elif sys.version_info >= (3, 9): else: def compile_dir( dir: StrPath, - maxlevels: int = None, + maxlevels: int = ..., ddir: StrPath | None = None, force: bool = False, rx: _SupportsSearch | None = None, From 1cff810c12d32719cc2041de1abcdb8af94d2eb1 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 11 Jan 2023 17:57:05 -0800 Subject: [PATCH 06/16] run stubtest on master (only stdlib for now) --- .github/workflows/stubtest_stdlib.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stubtest_stdlib.yml b/.github/workflows/stubtest_stdlib.yml index 3d0dd4a0d3ce..b0d8164031d3 100644 --- a/.github/workflows/stubtest_stdlib.yml +++ b/.github/workflows/stubtest_stdlib.yml @@ -44,6 +44,6 @@ jobs: cache: pip cache-dependency-path: requirements-tests.txt - name: Install dependencies - run: pip install $(grep mypy== requirements-tests.txt) + run: pip install git+https://github.com/python/mypy@c4a5f5620763dcfe2b95847806a889d560e2aa51 - name: Run stubtest run: python tests/stubtest_stdlib.py From 40aefbdc5bcbbe8d7b8572cac2bcdb4dbf05ccd9 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 11 Jan 2023 18:31:59 -0800 Subject: [PATCH 07/16] undo some more things found by stubtest --- stdlib/hmac.pyi | 2 +- stdlib/locale.pyi | 4 ++-- stdlib/platform.pyi | 2 +- stdlib/shutil.pyi | 2 +- stdlib/socket.pyi | 2 +- stdlib/ssl.pyi | 8 ++++---- stdlib/sysconfig.pyi | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/stdlib/hmac.pyi b/stdlib/hmac.pyi index 2f2dd30e0d61..68ea0d60280b 100644 --- a/stdlib/hmac.pyi +++ b/stdlib/hmac.pyi @@ -23,7 +23,7 @@ if sys.version_info >= (3, 8): def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ... else: - def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = "") -> HMAC: ... + def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = ...) -> HMAC: ... class HMAC: digest_size: int diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index 99b78b50adff..0b0dd9456e52 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -115,10 +115,10 @@ def setlocale(category: int, locale: _str | Iterable[_str | None] | None = None) def localeconv() -> Mapping[_str, int | _str | list[int]]: ... def nl_langinfo(__key: int) -> _str: ... def getdefaultlocale(envvars: tuple[_str, ...] = ...) -> tuple[_str | None, _str | None]: ... -def getlocale(category: int = 2) -> tuple[_str | None, _str | None]: ... +def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: ... def getpreferredencoding(do_setlocale: bool = True) -> _str: ... def normalize(localename: _str) -> _str: ... -def resetlocale(category: int = 0) -> None: ... +def resetlocale(category: int = ...) -> None: ... def strcoll(__os1: _str, __os2: _str) -> int: ... def strxfrm(__string: _str) -> _str: ... def format(percent: _str, value: float | Decimal, grouping: bool = False, monetary: bool = False, *additional: Any) -> _str: ... diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index 92e8657e20b5..2551614a6884 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -38,7 +38,7 @@ def java_ver( ) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... def architecture( - executable: str = "/Users/jelle/py/venvs/py311/bin/python", bits: str = "", linkage: str = "" + executable: str = ..., bits: str = "", linkage: str = "" ) -> tuple[str, str]: ... class uname_result(NamedTuple): diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index 2632ef4f57a8..4b4e66b43737 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -47,7 +47,7 @@ class ExecError(OSError): ... class ReadError(OSError): ... class RegistryError(Exception): ... -def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = 0) -> None: ... +def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ... def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = True) -> _StrOrBytesPathT: ... def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index 98d86b123b55..9bf5690724d0 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -749,7 +749,7 @@ if sys.platform == "win32": else: def socketpair( - family: int | AddressFamily | None = None, type: SocketType | int = 1, proto: int = 0 + family: int | AddressFamily | None = None, type: SocketType | int = ..., proto: int = ... ) -> tuple[socket, socket]: ... class SocketIO(RawIOBase): diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index 9f275d3e822c..b08ce47125ba 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -49,8 +49,8 @@ def wrap_socket( keyfile: StrOrBytesPath | None = None, certfile: StrOrBytesPath | None = None, server_side: bool = False, - cert_reqs: int = 0, - ssl_version: int = 2, + cert_reqs: int = ..., + ssl_version: int = ..., ca_certs: str | None = None, do_handshake_on_connect: bool = True, suppress_ragged_eofs: bool = True, @@ -66,7 +66,7 @@ def create_default_context( def _create_unverified_context( protocol: int = ..., *, - cert_reqs: int = 0, + cert_reqs: int = ..., check_hostname: bool = False, purpose: Purpose = ..., certfile: StrOrBytesPath | None = None, @@ -91,7 +91,7 @@ def cert_time_to_seconds(cert_time: str) -> int: ... if sys.version_info >= (3, 10): def get_server_certificate( - addr: tuple[str, int], ssl_version: int = 16, ca_certs: str | None = None, timeout: float = ... + addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = None, timeout: float = ... ) -> str: ... else: diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index c857fd25fa3a..dfae3209e832 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -28,8 +28,8 @@ if sys.version_info >= (3, 10): def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... def get_path_names() -> tuple[str, ...]: ... -def get_path(name: str, scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... -def get_paths(scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... +def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... +def get_paths(scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... def is_python_build(check_home: bool = ...) -> bool: ... From ada36e9227dc6b4ec5b2bbe84f68447e425cfd1b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 12 Jan 2023 02:33:25 +0000 Subject: [PATCH 08/16] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/platform.pyi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index 2551614a6884..937b8be60810 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -37,9 +37,7 @@ def java_ver( release: str = "", vendor: str = "", vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... ) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... -def architecture( - executable: str = ..., bits: str = "", linkage: str = "" -) -> tuple[str, str]: ... +def architecture(executable: str = ..., bits: str = "", linkage: str = "") -> tuple[str, str]: ... class uname_result(NamedTuple): system: str From 490d2a2f59b545a7ec993d53f3782f74d66ea9fa Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Wed, 11 Jan 2023 18:38:34 -0800 Subject: [PATCH 09/16] one more --- stdlib/ssl.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index b08ce47125ba..23e6a40add45 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -95,7 +95,7 @@ if sys.version_info >= (3, 10): ) -> str: ... else: - def get_server_certificate(addr: tuple[str, int], ssl_version: int = 16, ca_certs: str | None = None) -> str: ... + def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = None) -> str: ... def DER_cert_to_PEM_cert(der_cert_bytes: ReadableBuffer) -> str: ... def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ... From c752fab997a549738ee6c301c01fc394a6a54cb3 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 17 Jan 2023 21:50:11 -0800 Subject: [PATCH 10/16] re-run stubdefault --- .github/workflows/stubtest_stdlib.yml | 2 +- stdlib/_bisect.pyi | 8 +- stdlib/_compression.pyi | 4 +- stdlib/_curses.pyi | 2 +- stdlib/_decimal.pyi | 76 ++++++------- stdlib/_markupbase.pyi | 4 +- stdlib/_sitebuiltins.pyi | 2 +- stdlib/_weakrefset.pyi | 2 +- stdlib/abc.pyi | 2 +- stdlib/argparse.pyi | 78 ++++++------- stdlib/ast.pyi | 2 +- stdlib/asynchat.pyi | 2 +- stdlib/asyncio/base_events.pyi | 56 ++++----- stdlib/asyncio/base_subprocess.pyi | 4 +- stdlib/asyncio/events.pyi | 48 ++++---- stdlib/asyncio/format_helpers.pyi | 2 +- stdlib/asyncio/locks.pyi | 2 +- stdlib/asyncio/proactor_events.pyi | 12 +- stdlib/asyncio/runners.pyi | 4 +- stdlib/asyncio/selector_events.pyi | 2 +- stdlib/asyncio/sslproto.pyi | 8 +- stdlib/asyncio/streams.pyi | 30 ++--- stdlib/asyncio/subprocess.pyi | 34 +++--- stdlib/asyncio/taskgroups.pyi | 2 +- stdlib/asyncio/tasks.pyi | 8 +- stdlib/asyncio/transports.pyi | 10 +- stdlib/asyncore.pyi | 16 +-- stdlib/base64.pyi | 4 +- stdlib/bdb.pyi | 18 +-- stdlib/builtins.pyi | 42 +++---- stdlib/bz2.pyi | 12 +- stdlib/cProfile.pyi | 6 +- stdlib/calendar.pyi | 32 +++--- stdlib/cgi.pyi | 26 ++--- stdlib/cgitb.pyi | 14 +-- stdlib/chunk.pyi | 6 +- stdlib/cmd.pyi | 6 +- stdlib/code.pyi | 14 +-- stdlib/codecs.pyi | 70 ++++++------ stdlib/codeop.pyi | 4 +- stdlib/collections/__init__.pyi | 50 ++++---- stdlib/compileall.pyi | 76 ++++++------- stdlib/concurrent/futures/_base.pyi | 10 +- stdlib/concurrent/futures/process.pyi | 2 +- stdlib/concurrent/futures/thread.pyi | 6 +- stdlib/configparser.pyi | 82 ++++++------- stdlib/contextlib.pyi | 2 +- stdlib/csv.pyi | 22 ++-- stdlib/ctypes/__init__.pyi | 4 +- stdlib/curses/textpad.pyi | 4 +- stdlib/dataclasses.pyi | 34 +++--- stdlib/dbm/__init__.pyi | 2 +- stdlib/dbm/dumb.pyi | 4 +- stdlib/difflib.pyi | 67 ++++++----- stdlib/dis.pyi | 14 +-- stdlib/distutils/archive_util.pyi | 2 +- stdlib/distutils/ccompiler.pyi | 120 ++++++++++---------- stdlib/distutils/cmd.pyi | 46 ++++---- stdlib/distutils/command/build_py.pyi | 2 +- stdlib/distutils/command/config.pyi | 58 +++++----- stdlib/distutils/command/register.pyi | 2 +- stdlib/distutils/core.pyi | 2 +- stdlib/distutils/dep_util.pyi | 2 +- stdlib/distutils/dist.pyi | 6 +- stdlib/distutils/fancy_getopt.pyi | 6 +- stdlib/distutils/filelist.pyi | 18 +-- stdlib/distutils/log.pyi | 2 +- stdlib/distutils/text_file.pyi | 6 +- stdlib/distutils/version.pyi | 6 +- stdlib/doctest.pyi | 43 ++++--- stdlib/email/_header_value_parser.pyi | 4 +- stdlib/email/base64mime.pyi | 4 +- stdlib/email/charset.pyi | 2 +- stdlib/email/errors.pyi | 2 +- stdlib/email/feedparser.pyi | 4 +- stdlib/email/generator.pyi | 24 ++-- stdlib/email/header.pyi | 18 +-- stdlib/email/headerregistry.pyi | 6 +- stdlib/email/iterators.pyi | 2 +- stdlib/email/message.pyi | 50 ++++---- stdlib/email/mime/application.pyi | 4 +- stdlib/email/mime/audio.pyi | 4 +- stdlib/email/mime/base.pyi | 2 +- stdlib/email/mime/image.pyi | 4 +- stdlib/email/mime/message.pyi | 2 +- stdlib/email/mime/multipart.pyi | 8 +- stdlib/email/mime/text.pyi | 2 +- stdlib/email/parser.pyi | 10 +- stdlib/email/quoprimime.pyi | 6 +- stdlib/email/utils.pyi | 6 +- stdlib/encodings/utf_8.pyi | 4 +- stdlib/encodings/utf_8_sig.pyi | 14 +-- stdlib/enum.pyi | 2 +- stdlib/filecmp.pyi | 4 +- stdlib/fractions.pyi | 8 +- stdlib/ftplib.pyi | 26 ++--- stdlib/functools.pyi | 12 +- stdlib/getopt.pyi | 2 +- stdlib/getpass.pyi | 2 +- stdlib/gettext.pyi | 6 +- stdlib/glob.pyi | 8 +- stdlib/graphlib.pyi | 2 +- stdlib/gzip.pyi | 46 ++++---- stdlib/hmac.pyi | 4 +- stdlib/html/parser.pyi | 2 +- stdlib/http/client.pyi | 42 +++---- stdlib/http/cookiejar.pyi | 16 +-- stdlib/http/cookies.pyi | 14 +-- stdlib/http/server.pyi | 12 +- stdlib/imaplib.pyi | 8 +- stdlib/importlib/abc.pyi | 10 +- stdlib/importlib/machinery.pyi | 26 ++--- stdlib/importlib/metadata/__init__.pyi | 2 +- stdlib/importlib/resources.pyi | 4 +- stdlib/inspect.pyi | 8 +- stdlib/io.pyi | 12 +- stdlib/ipaddress.pyi | 4 +- stdlib/json/decoder.pyi | 14 +-- stdlib/json/encoder.pyi | 18 +-- stdlib/lib2to3/pgen2/driver.pyi | 14 +-- stdlib/lib2to3/pgen2/parse.pyi | 4 +- stdlib/lib2to3/pgen2/pgen.pyi | 8 +- stdlib/lib2to3/pytree.pyi | 20 ++-- stdlib/lib2to3/refactor.pyi | 16 +-- stdlib/locale.pyi | 4 +- stdlib/logging/__init__.pyi | 34 +++--- stdlib/logging/config.pyi | 4 +- stdlib/logging/handlers.pyi | 22 ++-- stdlib/lzma.pyi | 26 ++--- stdlib/mailbox.pyi | 46 ++++---- stdlib/mailcap.pyi | 2 +- stdlib/mimetypes.pyi | 12 +- stdlib/modulefinder.pyi | 10 +- stdlib/multiprocessing/connection.pyi | 10 +- stdlib/multiprocessing/context.pyi | 38 +++---- stdlib/multiprocessing/dummy/__init__.pyi | 12 +- stdlib/multiprocessing/dummy/connection.pyi | 2 +- stdlib/multiprocessing/heap.pyi | 2 +- stdlib/multiprocessing/managers.pyi | 24 ++-- stdlib/multiprocessing/pool.pyi | 42 +++---- stdlib/multiprocessing/popen_fork.pyi | 4 +- stdlib/multiprocessing/process.pyi | 10 +- stdlib/multiprocessing/queues.pyi | 6 +- stdlib/multiprocessing/reduction.pyi | 2 +- stdlib/multiprocessing/shared_memory.pyi | 6 +- stdlib/multiprocessing/sharedctypes.pyi | 2 +- stdlib/multiprocessing/synchronize.pyi | 16 +-- stdlib/multiprocessing/util.pyi | 6 +- stdlib/netrc.pyi | 4 +- stdlib/nntplib.pyi | 48 ++++---- stdlib/numbers.pyi | 4 +- stdlib/optparse.pyi | 48 ++++---- stdlib/os/__init__.pyi | 24 ++-- stdlib/pathlib.pyi | 50 ++++---- stdlib/pdb.pyi | 18 +-- stdlib/pickle.pyi | 16 +-- stdlib/pkgutil.pyi | 8 +- stdlib/platform.pyi | 12 +- stdlib/plistlib.pyi | 6 +- stdlib/poplib.pyi | 16 +-- stdlib/pprint.pyi | 36 +++--- stdlib/profile.pyi | 10 +- stdlib/pstats.pyi | 4 +- stdlib/py_compile.pyi | 12 +- stdlib/pydoc.pyi | 93 +++++++-------- stdlib/queue.pyi | 10 +- stdlib/random.pyi | 12 +- stdlib/re.pyi | 32 +++--- stdlib/reprlib.pyi | 2 +- stdlib/rlcompleter.pyi | 2 +- stdlib/sched.pyi | 2 +- stdlib/selectors.pyi | 22 ++-- stdlib/shelve.pyi | 6 +- stdlib/shlex.pyi | 12 +- stdlib/shutil.pyi | 10 +- stdlib/smtpd.pyi | 16 +-- stdlib/smtplib.pyi | 50 ++++---- stdlib/socket.pyi | 63 +++++----- stdlib/socketserver.pyi | 8 +- stdlib/sqlite3/dbapi2.pyi | 8 +- stdlib/sre_constants.pyi | 2 +- stdlib/sre_parse.pyi | 6 +- stdlib/ssl.pyi | 76 ++++++------- stdlib/statistics.pyi | 6 +- stdlib/string.pyi | 2 +- stdlib/struct.pyi | 2 +- stdlib/subprocess.pyi | 22 ++-- stdlib/sysconfig.pyi | 6 +- stdlib/tarfile.pyi | 88 +++++++------- stdlib/telnetlib.pyi | 8 +- stdlib/tempfile.pyi | 6 +- stdlib/textwrap.pyi | 24 ++-- stdlib/threading.pyi | 38 +++---- stdlib/timeit.pyi | 16 +-- stdlib/trace.pyi | 30 ++--- stdlib/traceback.pyi | 18 +-- stdlib/tracemalloc.pyi | 8 +- stdlib/typing.pyi | 10 +- stdlib/typing_extensions.pyi | 12 +- stdlib/unittest/case.pyi | 100 ++++++++-------- stdlib/unittest/loader.pyi | 12 +- stdlib/unittest/main.pyi | 26 ++--- stdlib/unittest/mock.pyi | 83 +++++++------- stdlib/unittest/result.pyi | 2 +- stdlib/unittest/runner.pyi | 16 +-- stdlib/unittest/suite.pyi | 2 +- stdlib/urllib/error.pyi | 2 +- stdlib/urllib/parse.pyi | 26 ++--- stdlib/urllib/request.pyi | 78 ++++++------- stdlib/urllib/response.pyi | 2 +- stdlib/urllib/robotparser.pyi | 2 +- stdlib/uu.pyi | 4 +- stdlib/uuid.pyi | 12 +- stdlib/venv/__init__.pyi | 12 +- stdlib/warnings.pyi | 24 ++-- stdlib/weakref.pyi | 10 +- stdlib/webbrowser.pyi | 16 +-- stdlib/wsgiref/handlers.pyi | 6 +- stdlib/wsgiref/headers.pyi | 4 +- stdlib/wsgiref/util.pyi | 2 +- stdlib/xml/dom/domreg.pyi | 4 +- stdlib/xml/dom/expatbuilder.pyi | 6 +- stdlib/xml/dom/minidom.pyi | 18 +-- stdlib/xml/dom/pulldom.pyi | 2 +- stdlib/xml/etree/ElementInclude.pyi | 4 +- stdlib/xml/etree/ElementTree.pyi | 60 +++++----- stdlib/xml/sax/__init__.pyi | 2 +- stdlib/xml/sax/saxutils.pyi | 10 +- stdlib/xml/sax/xmlreader.pyi | 6 +- stdlib/xmlrpc/client.pyi | 16 ++- stdlib/xmlrpc/server.pyi | 48 ++++---- stdlib/zipfile.pyi | 40 +++---- stdlib/zipimport.pyi | 4 +- stdlib/zlib.pyi | 9 +- stubs/JACK-Client/METADATA.toml | 2 + stubs/JACK-Client/jack/__init__.pyi | 55 ++++++--- 236 files changed, 2023 insertions(+), 2024 deletions(-) diff --git a/.github/workflows/stubtest_stdlib.yml b/.github/workflows/stubtest_stdlib.yml index b0d8164031d3..3d0dd4a0d3ce 100644 --- a/.github/workflows/stubtest_stdlib.yml +++ b/.github/workflows/stubtest_stdlib.yml @@ -44,6 +44,6 @@ jobs: cache: pip cache-dependency-path: requirements-tests.txt - name: Install dependencies - run: pip install git+https://github.com/python/mypy@c4a5f5620763dcfe2b95847806a889d560e2aa51 + run: pip install $(grep mypy== requirements-tests.txt) - name: Run stubtest run: python tests/stubtest_stdlib.py diff --git a/stdlib/_bisect.pyi b/stdlib/_bisect.pyi index 21323ab5a7af..d902e1eea7d4 100644 --- a/stdlib/_bisect.pyi +++ b/stdlib/_bisect.pyi @@ -61,14 +61,14 @@ if sys.version_info >= (3, 10): else: def bisect_left( - a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... ) -> int: ... def bisect_right( - a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None + a: Sequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... ) -> int: ... def insort_left( - a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None + a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... ) -> None: ... def insort_right( - a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None + a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = ..., hi: int | None = ... ) -> None: ... diff --git a/stdlib/_compression.pyi b/stdlib/_compression.pyi index 7047a7bcd325..817f251586b2 100644 --- a/stdlib/_compression.pyi +++ b/stdlib/_compression.pyi @@ -21,5 +21,5 @@ class DecompressReader(RawIOBase): **decomp_args: Any, ) -> None: ... def readinto(self, b: WriteableBuffer) -> int: ... - def read(self, size: int = ...) -> bytes: ... - def seek(self, offset: int, whence: int = ...) -> int: ... + def read(self, size: int = -1) -> bytes: ... + def seek(self, offset: int, whence: int = 0) -> int: ... diff --git a/stdlib/_curses.pyi b/stdlib/_curses.pyi index 1faebfbe2011..f6782b8bb40a 100644 --- a/stdlib/_curses.pyi +++ b/stdlib/_curses.pyi @@ -345,7 +345,7 @@ if sys.platform != "win32": def set_tabsize(__size: int) -> None: ... def setsyx(__y: int, __x: int) -> None: ... - def setupterm(term: str | None = None, fd: int = ...) -> None: ... + def setupterm(term: str | None = None, fd: int = -1) -> None: ... def start_color() -> None: ... def termattrs() -> int: ... def termname() -> bytes: ... diff --git a/stdlib/_decimal.pyi b/stdlib/_decimal.pyi index b3f9d93d59f0..c0e6c9882181 100644 --- a/stdlib/_decimal.pyi +++ b/stdlib/_decimal.pyi @@ -66,17 +66,17 @@ if sys.version_info >= (3, 11): ) -> _ContextManager: ... else: - def localcontext(ctx: Context | None = None) -> _ContextManager: ... + def localcontext(ctx: Context | None = ...) -> _ContextManager: ... class Decimal: def __new__(cls: type[Self], value: _DecimalNew = ..., context: Context | None = ...) -> Self: ... @classmethod def from_float(cls: type[Self], __f: float) -> Self: ... def __bool__(self) -> bool: ... - def compare(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def compare(self, other: _Decimal, context: Context | None = None) -> Decimal: ... def as_tuple(self) -> DecimalTuple: ... def as_integer_ratio(self) -> tuple[int, int]: ... - def to_eng_string(self, context: Context | None = ...) -> str: ... + def to_eng_string(self, context: Context | None = None) -> str: ... def __abs__(self) -> Decimal: ... def __add__(self, __other: _Decimal) -> Decimal: ... def __divmod__(self, __other: _Decimal) -> tuple[Decimal, Decimal]: ... @@ -100,7 +100,7 @@ class Decimal: def __rtruediv__(self, __other: _Decimal) -> Decimal: ... def __sub__(self, __other: _Decimal) -> Decimal: ... def __truediv__(self, __other: _Decimal) -> Decimal: ... - def remainder_near(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def remainder_near(self, other: _Decimal, context: Context | None = None) -> Decimal: ... def __float__(self) -> float: ... def __int__(self) -> int: ... def __trunc__(self) -> int: ... @@ -116,53 +116,53 @@ class Decimal: def __round__(self, __ndigits: int) -> Decimal: ... def __floor__(self) -> int: ... def __ceil__(self) -> int: ... - def fma(self, other: _Decimal, third: _Decimal, context: Context | None = ...) -> Decimal: ... + def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal: ... def __rpow__(self, __other: _Decimal, __context: Context | None = ...) -> Decimal: ... - def normalize(self, context: Context | None = ...) -> Decimal: ... - def quantize(self, exp: _Decimal, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def same_quantum(self, other: _Decimal, context: Context | None = ...) -> bool: ... - def to_integral_exact(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def to_integral_value(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def to_integral(self, rounding: str | None = ..., context: Context | None = ...) -> Decimal: ... - def sqrt(self, context: Context | None = ...) -> Decimal: ... - def max(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def min(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def normalize(self, context: Context | None = None) -> Decimal: ... + def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal: ... + def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool: ... + def to_integral_exact(self, rounding: str | None = None, context: Context | None = None) -> Decimal: ... + def to_integral_value(self, rounding: str | None = None, context: Context | None = None) -> Decimal: ... + def to_integral(self, rounding: str | None = None, context: Context | None = None) -> Decimal: ... + def sqrt(self, context: Context | None = None) -> Decimal: ... + def max(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def min(self, other: _Decimal, context: Context | None = None) -> Decimal: ... def adjusted(self) -> int: ... def canonical(self) -> Decimal: ... - def compare_signal(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def compare_total(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def compare_total_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def compare_signal(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def compare_total(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def compare_total_mag(self, other: _Decimal, context: Context | None = None) -> Decimal: ... def copy_abs(self) -> Decimal: ... def copy_negate(self) -> Decimal: ... - def copy_sign(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def exp(self, context: Context | None = ...) -> Decimal: ... + def copy_sign(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def exp(self, context: Context | None = None) -> Decimal: ... def is_canonical(self) -> bool: ... def is_finite(self) -> bool: ... def is_infinite(self) -> bool: ... def is_nan(self) -> bool: ... - def is_normal(self, context: Context | None = ...) -> bool: ... + def is_normal(self, context: Context | None = None) -> bool: ... def is_qnan(self) -> bool: ... def is_signed(self) -> bool: ... def is_snan(self) -> bool: ... - def is_subnormal(self, context: Context | None = ...) -> bool: ... + def is_subnormal(self, context: Context | None = None) -> bool: ... def is_zero(self) -> bool: ... - def ln(self, context: Context | None = ...) -> Decimal: ... - def log10(self, context: Context | None = ...) -> Decimal: ... - def logb(self, context: Context | None = ...) -> Decimal: ... - def logical_and(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def logical_invert(self, context: Context | None = ...) -> Decimal: ... - def logical_or(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def logical_xor(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def max_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def min_mag(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def next_minus(self, context: Context | None = ...) -> Decimal: ... - def next_plus(self, context: Context | None = ...) -> Decimal: ... - def next_toward(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def number_class(self, context: Context | None = ...) -> str: ... + def ln(self, context: Context | None = None) -> Decimal: ... + def log10(self, context: Context | None = None) -> Decimal: ... + def logb(self, context: Context | None = None) -> Decimal: ... + def logical_and(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def logical_invert(self, context: Context | None = None) -> Decimal: ... + def logical_or(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def logical_xor(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def max_mag(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def min_mag(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def next_minus(self, context: Context | None = None) -> Decimal: ... + def next_plus(self, context: Context | None = None) -> Decimal: ... + def next_toward(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def number_class(self, context: Context | None = None) -> str: ... def radix(self) -> Decimal: ... - def rotate(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def scaleb(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... - def shift(self, other: _Decimal, context: Context | None = ...) -> Decimal: ... + def rotate(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def scaleb(self, other: _Decimal, context: Context | None = None) -> Decimal: ... + def shift(self, other: _Decimal, context: Context | None = None) -> Decimal: ... def __reduce__(self: Self) -> tuple[type[Self], tuple[str]]: ... def __copy__(self: Self) -> Self: ... def __deepcopy__(self: Self, __memo: Any) -> Self: ... @@ -259,7 +259,7 @@ class Context: def normalize(self, __x: _Decimal) -> Decimal: ... def number_class(self, __x: _Decimal) -> str: ... def plus(self, __x: _Decimal) -> Decimal: ... - def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = ...) -> Decimal: ... + def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = None) -> Decimal: ... def quantize(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... def radix(self) -> Decimal: ... def remainder(self, __x: _Decimal, __y: _Decimal) -> Decimal: ... diff --git a/stdlib/_markupbase.pyi b/stdlib/_markupbase.pyi index 7d2a39a7aaea..62bad25e5ccc 100644 --- a/stdlib/_markupbase.pyi +++ b/stdlib/_markupbase.pyi @@ -5,9 +5,9 @@ class ParserBase: def reset(self) -> None: ... def getpos(self) -> tuple[int, int]: ... def unknown_decl(self, data: str) -> None: ... - def parse_comment(self, i: int, report: int = ...) -> int: ... # undocumented + def parse_comment(self, i: int, report: int = 1) -> int: ... # undocumented def parse_declaration(self, i: int) -> int: ... # undocumented - def parse_marked_section(self, i: int, report: int = ...) -> int: ... # undocumented + def parse_marked_section(self, i: int, report: int = 1) -> int: ... # undocumented def updatepos(self, i: int, j: int) -> int: ... # undocumented if sys.version_info < (3, 10): # Removed from ParserBase: https://bugs.python.org/issue31844 diff --git a/stdlib/_sitebuiltins.pyi b/stdlib/_sitebuiltins.pyi index 4a35921e1ef7..3bda2d88425d 100644 --- a/stdlib/_sitebuiltins.pyi +++ b/stdlib/_sitebuiltins.pyi @@ -6,7 +6,7 @@ class Quitter: name: str eof: str def __init__(self, name: str, eof: str) -> None: ... - def __call__(self, code: int | None = ...) -> NoReturn: ... + def __call__(self, code: int | None = None) -> NoReturn: ... class _Printer: MAXLINES: ClassVar[Literal[23]] diff --git a/stdlib/_weakrefset.pyi b/stdlib/_weakrefset.pyi index da09442e855b..fdf26641bbeb 100644 --- a/stdlib/_weakrefset.pyi +++ b/stdlib/_weakrefset.pyi @@ -13,7 +13,7 @@ _T = TypeVar("_T") class WeakSet(MutableSet[_T], Generic[_T]): @overload - def __init__(self, data: None = ...) -> None: ... + def __init__(self, data: None = None) -> None: ... @overload def __init__(self, data: Iterable[_T]) -> None: ... def add(self, item: _T) -> None: ... diff --git a/stdlib/abc.pyi b/stdlib/abc.pyi index 7b39c88ed394..44a5b2289832 100644 --- a/stdlib/abc.pyi +++ b/stdlib/abc.pyi @@ -20,7 +20,7 @@ class ABCMeta(type): def __instancecheck__(cls: ABCMeta, instance: Any) -> bool: ... def __subclasscheck__(cls: ABCMeta, subclass: type) -> bool: ... - def _dump_registry(cls: ABCMeta, file: SupportsWrite[str] | None = ...) -> None: ... + def _dump_registry(cls: ABCMeta, file: SupportsWrite[str] | None = None) -> None: ... def register(cls: ABCMeta, subclass: type[_T]) -> type[_T]: ... def abstractmethod(funcobj: _FuncT) -> _FuncT: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 1bdcace7d897..6939dbf992fb 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -78,7 +78,7 @@ class _ActionsContainer: _has_negative_number_optionals: list[bool] def __init__(self, description: str | None, prefix_chars: str, argument_default: Any, conflict_handler: str) -> None: ... def register(self, registry_name: str, value: Any, object: Any) -> None: ... - def _registry_get(self, registry_name: str, value: Any, default: Any = ...) -> Any: ... + def _registry_get(self, registry_name: str, value: Any, default: Any = None) -> Any: ... def set_defaults(self, **kwargs: Any) -> None: ... def get_default(self, dest: str) -> Any: ... def add_argument( @@ -104,7 +104,7 @@ class _ActionsContainer: def _add_container_actions(self, container: _ActionsContainer) -> None: ... def _get_positional_kwargs(self, dest: str, **kwargs: Any) -> dict[str, Any]: ... def _get_optional_kwargs(self, *args: Any, **kwargs: Any) -> dict[str, Any]: ... - def _pop_action_class(self, kwargs: Any, default: type[Action] | None = ...) -> type[Action]: ... + def _pop_action_class(self, kwargs: Any, default: type[Action] | None = None) -> type[Action]: ... def _get_handler(self) -> Callable[[Action, Iterable[tuple[str, Action]]], Any]: ... def _check_conflict(self, action: Action) -> None: ... def _handle_conflict_error(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> NoReturn: ... @@ -164,7 +164,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): # The type-ignores in these overloads should be temporary. See: # https://github.com/python/typeshed/pull/2643#issuecomment-442280277 @overload - def parse_args(self, args: Sequence[str] | None = ...) -> Namespace: ... + def parse_args(self, args: Sequence[str] | None = None) -> Namespace: ... @overload def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore[misc] @overload @@ -202,19 +202,19 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): help: str | None = ..., metavar: str | None = ..., ) -> _SubParsersAction[_ArgumentParserT]: ... - def print_usage(self, file: IO[str] | None = ...) -> None: ... - def print_help(self, file: IO[str] | None = ...) -> None: ... + def print_usage(self, file: IO[str] | None = None) -> None: ... + def print_help(self, file: IO[str] | None = None) -> None: ... def format_usage(self) -> str: ... def format_help(self) -> str: ... def parse_known_args( - self, args: Sequence[str] | None = ..., namespace: Namespace | None = ... + self, args: Sequence[str] | None = None, namespace: Namespace | None = None ) -> tuple[Namespace, list[str]]: ... def convert_arg_line_to_args(self, arg_line: str) -> list[str]: ... - def exit(self, status: int = ..., message: str | None = ...) -> NoReturn: ... + def exit(self, status: int = 0, message: str | None = None) -> NoReturn: ... def error(self, message: str) -> NoReturn: ... - def parse_intermixed_args(self, args: Sequence[str] | None = ..., namespace: Namespace | None = ...) -> Namespace: ... + def parse_intermixed_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None) -> Namespace: ... def parse_known_intermixed_args( - self, args: Sequence[str] | None = ..., namespace: Namespace | None = ... + self, args: Sequence[str] | None = None, namespace: Namespace | None = None ) -> tuple[Namespace, list[str]]: ... # undocumented def _get_optional_actions(self) -> list[Action]: ... @@ -230,7 +230,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def _get_value(self, action: Action, arg_string: str) -> Any: ... def _check_value(self, action: Action, value: Any) -> None: ... def _get_formatter(self) -> HelpFormatter: ... - def _print_message(self, message: str, file: IO[str] | None = ...) -> None: ... + def _print_message(self, message: str, file: IO[str] | None = None) -> None: ... class HelpFormatter: # undocumented @@ -246,7 +246,7 @@ class HelpFormatter: _whitespace_matcher: Pattern[str] _long_break_matcher: Pattern[str] _Section: type[Any] # Nested class - def __init__(self, prog: str, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ...) -> None: ... + def __init__(self, prog: str, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None) -> None: ... def _indent(self) -> None: ... def _dedent(self) -> None: ... def _add_item(self, func: Callable[..., str], args: Iterable[Any]) -> None: ... @@ -254,7 +254,7 @@ class HelpFormatter: def end_section(self) -> None: ... def add_text(self, text: str | None) -> None: ... def add_usage( - self, usage: str | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None = ... + self, usage: str | None, actions: Iterable[Action], groups: Iterable[_ArgumentGroup], prefix: str | None = None ) -> None: ... def add_argument(self, action: Action) -> None: ... def add_arguments(self, actions: Iterable[Action]) -> None: ... @@ -297,17 +297,17 @@ class Action(_AttributeHolder): self, option_strings: Sequence[str], dest: str, - nargs: int | str | None = ..., - const: _T | None = ..., - default: _T | str | None = ..., - type: Callable[[str], _T] | FileType | None = ..., - choices: Iterable[_T] | None = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | tuple[str, ...] | None = ..., + nargs: int | str | None = None, + const: _T | None = None, + default: _T | str | None = None, + type: Callable[[str], _T] | FileType | None = None, + choices: Iterable[_T] | None = None, + required: bool = False, + help: str | None = None, + metavar: str | tuple[str, ...] | None = None, ) -> None: ... def __call__( - self, parser: ArgumentParser, namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = ... + self, parser: ArgumentParser, namespace: Namespace, values: str | Sequence[Any] | None, option_string: str | None = None ) -> None: ... if sys.version_info >= (3, 9): def format_usage(self) -> str: ... @@ -318,12 +318,12 @@ if sys.version_info >= (3, 9): self, option_strings: Sequence[str], dest: str, - default: _T | str | None = ..., - type: Callable[[str], _T] | FileType | None = ..., - choices: Iterable[_T] | None = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | tuple[str, ...] | None = ..., + default: _T | str | None = None, + type: Callable[[str], _T] | FileType | None = None, + choices: Iterable[_T] | None = None, + required: bool = False, + help: str | None = None, + metavar: str | tuple[str, ...] | None = None, ) -> None: ... class Namespace(_AttributeHolder): @@ -339,7 +339,7 @@ class FileType: _bufsize: int _encoding: str | None _errors: str | None - def __init__(self, mode: str = ..., bufsize: int = ..., encoding: str | None = ..., errors: str | None = ...) -> None: ... + def __init__(self, mode: str = 'r', bufsize: int = -1, encoding: str | None = None, errors: str | None = None) -> None: ... def __call__(self, string: str) -> IO[Any]: ... # undocumented @@ -347,14 +347,14 @@ class _ArgumentGroup(_ActionsContainer): title: str | None _group_actions: list[Action] def __init__( - self, container: _ActionsContainer, title: str | None = ..., description: str | None = ..., **kwargs: Any + self, container: _ActionsContainer, title: str | None = None, description: str | None = None, **kwargs: Any ) -> None: ... # undocumented class _MutuallyExclusiveGroup(_ArgumentGroup): required: bool _container: _ActionsContainer - def __init__(self, container: _ActionsContainer, required: bool = ...) -> None: ... + def __init__(self, container: _ActionsContainer, required: bool = False) -> None: ... # undocumented class _StoreAction(Action): ... @@ -387,13 +387,13 @@ class _StoreConstAction(Action): # undocumented class _StoreTrueAction(_StoreConstAction): def __init__( - self, option_strings: Sequence[str], dest: str, default: bool = ..., required: bool = ..., help: str | None = ... + self, option_strings: Sequence[str], dest: str, default: bool = False, required: bool = False, help: str | None = None ) -> None: ... # undocumented class _StoreFalseAction(_StoreConstAction): def __init__( - self, option_strings: Sequence[str], dest: str, default: bool = ..., required: bool = ..., help: str | None = ... + self, option_strings: Sequence[str], dest: str, default: bool = True, required: bool = False, help: str | None = None ) -> None: ... # undocumented @@ -431,18 +431,18 @@ class _AppendConstAction(Action): # undocumented class _CountAction(Action): def __init__( - self, option_strings: Sequence[str], dest: str, default: Any = ..., required: bool = ..., help: str | None = ... + self, option_strings: Sequence[str], dest: str, default: Any = None, required: bool = False, help: str | None = None ) -> None: ... # undocumented class _HelpAction(Action): - def __init__(self, option_strings: Sequence[str], dest: str = ..., default: str = ..., help: str | None = ...) -> None: ... + def __init__(self, option_strings: Sequence[str], dest: str = '==SUPPRESS==', default: str = '==SUPPRESS==', help: str | None = None) -> None: ... # undocumented class _VersionAction(Action): version: str | None def __init__( - self, option_strings: Sequence[str], version: str | None = ..., dest: str = ..., default: str = ..., help: str = ... + self, option_strings: Sequence[str], version: str | None = None, dest: str = '==SUPPRESS==', default: str = '==SUPPRESS==', help: str = "show program's version number and exit" ) -> None: ... # undocumented @@ -458,10 +458,10 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]): option_strings: Sequence[str], prog: str, parser_class: type[_ArgumentParserT], - dest: str = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | tuple[str, ...] | None = ..., + dest: str = '==SUPPRESS==', + required: bool = False, + help: str | None = None, + metavar: str | tuple[str, ...] | None = None, ) -> None: ... # Note: `add_parser` accepts all kwargs of `ArgumentParser.__init__`. It also diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index f02b7ad41c67..ad14c643fe9e 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -272,7 +272,7 @@ if sys.version_info >= (3, 9): ) -> str: ... else: - def dump(node: AST, annotate_fields: bool = True, include_attributes: bool = False) -> str: ... + def dump(node: AST, annotate_fields: bool = ..., include_attributes: bool = ...) -> str: ... def fix_missing_locations(node: _T) -> _T: ... def get_docstring(node: AsyncFunctionDef | FunctionDef | ClassDef | Module, clean: bool = True) -> str | None: ... diff --git a/stdlib/asynchat.pyi b/stdlib/asynchat.pyi index 4d43b02c056c..79a70d1c1ec8 100644 --- a/stdlib/asynchat.pyi +++ b/stdlib/asynchat.pyi @@ -2,7 +2,7 @@ import asyncore from abc import abstractmethod class simple_producer: - def __init__(self, data: bytes, buffer_size: int = ...) -> None: ... + def __init__(self, data: bytes, buffer_size: int = 512) -> None: ... def more(self) -> bytes: ... class async_chat(asyncore.dispatcher): diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 83576ab6455e..6e00dd998ee7 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -74,11 +74,11 @@ class BaseEventLoop(AbstractEventLoop): def close(self) -> None: ... async def shutdown_asyncgens(self) -> None: ... # Methods scheduling callbacks. All these return Handles. - def call_soon(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... + def call_soon(self, callback: Callable[..., object], *args: Any, context: Context | None = None) -> Handle: ... def call_later( - self, delay: float, callback: Callable[..., object], *args: Any, context: Context | None = ... + self, delay: float, callback: Callable[..., object], *args: Any, context: Context | None = None ) -> TimerHandle: ... - def call_at(self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> TimerHandle: ... + def call_at(self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = None) -> TimerHandle: ... def time(self) -> float: ... # Future methods def create_future(self) -> Future[Any]: ... @@ -95,7 +95,7 @@ class BaseEventLoop(AbstractEventLoop): def set_task_factory(self, factory: _TaskFactory | None) -> None: ... def get_task_factory(self) -> _TaskFactory | None: ... # Methods for interacting with threads - def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... + def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any, context: Context | None = None) -> Handle: ... def run_in_executor(self, executor: Any, func: Callable[..., _T], *args: Any) -> Future[_T]: ... def set_default_executor(self, executor: Any) -> None: ... # Network I/O methods returning Futures. @@ -104,12 +104,12 @@ class BaseEventLoop(AbstractEventLoop): host: bytes | str | None, port: bytes | str | int | None, *, - family: int = ..., - type: int = ..., - proto: int = ..., - flags: int = ..., + family: int = 0, + type: int = 0, + proto: int = 0, + flags: int = 0, ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... - async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = ...) -> tuple[str, str]: ... + async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ... if sys.version_info >= (3, 11): @overload async def create_connection( @@ -331,10 +331,10 @@ class BaseEventLoop(AbstractEventLoop): ) -> tuple[Transport, _ProtocolT]: ... async def sock_sendfile( - self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ... + self, sock: socket, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool | None = True ) -> int: ... async def sendfile( - self, transport: WriteTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ... + self, transport: WriteTransport, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool = True ) -> int: ... if sys.version_info >= (3, 11): async def create_datagram_endpoint( # type: ignore[override] @@ -377,15 +377,15 @@ class BaseEventLoop(AbstractEventLoop): protocol_factory: Callable[[], _ProtocolT], cmd: bytes | str, *, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., - universal_newlines: Literal[False] = ..., - shell: Literal[True] = ..., - bufsize: Literal[0] = ..., - encoding: None = ..., - errors: None = ..., - text: Literal[False, None] = ..., + stdin: int | IO[Any] | None = -1, + stdout: int | IO[Any] | None = -1, + stderr: int | IO[Any] | None = -1, + universal_newlines: Literal[False] = False, + shell: Literal[True] = True, + bufsize: Literal[0] = 0, + encoding: None = None, + errors: None = None, + text: Literal[False, None] = None, **kwargs: Any, ) -> tuple[SubprocessTransport, _ProtocolT]: ... async def subprocess_exec( @@ -393,14 +393,14 @@ class BaseEventLoop(AbstractEventLoop): protocol_factory: Callable[[], _ProtocolT], program: Any, *args: Any, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., - universal_newlines: Literal[False] = ..., - shell: Literal[True] = ..., - bufsize: Literal[0] = ..., - encoding: None = ..., - errors: None = ..., + stdin: int | IO[Any] | None = -1, + stdout: int | IO[Any] | None = -1, + stderr: int | IO[Any] | None = -1, + universal_newlines: Literal[False] = False, + shell: Literal[True] = False, + bufsize: Literal[0] = 0, + encoding: None = None, + errors: None = None, **kwargs: Any, ) -> tuple[SubprocessTransport, _ProtocolT]: ... def add_reader(self, fd: FileDescriptorLike, callback: Callable[..., Any], *args: Any) -> None: ... diff --git a/stdlib/asyncio/base_subprocess.pyi b/stdlib/asyncio/base_subprocess.pyi index d3ab16a3edd2..9dea83762230 100644 --- a/stdlib/asyncio/base_subprocess.pyi +++ b/stdlib/asyncio/base_subprocess.pyi @@ -30,8 +30,8 @@ class BaseSubprocessTransport(transports.SubprocessTransport): stdout: _File, stderr: _File, bufsize: int, - waiter: futures.Future[Any] | None = ..., - extra: Any | None = ..., + waiter: futures.Future[Any] | None = None, + extra: Any | None = None, **kwargs: Any, ) -> None: ... def _start( diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 096da5fe02b3..67850f928db7 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -70,7 +70,7 @@ class Handle: _cancelled: bool _args: Sequence[Any] def __init__( - self, callback: Callable[..., object], args: Sequence[Any], loop: AbstractEventLoop, context: Context | None = ... + self, callback: Callable[..., object], args: Sequence[Any], loop: AbstractEventLoop, context: Context | None = None ) -> None: ... def cancel(self) -> None: ... def _run(self) -> None: ... @@ -83,7 +83,7 @@ class TimerHandle(Handle): callback: Callable[..., object], args: Sequence[Any], loop: AbstractEventLoop, - context: Context | None = ..., + context: Context | None = None, ) -> None: ... def when(self) -> float: ... def __lt__(self, other: TimerHandle) -> bool: ... @@ -196,13 +196,13 @@ class AbstractEventLoop: host: bytes | str | None, port: bytes | str | int | None, *, - family: int = ..., - type: int = ..., - proto: int = ..., - flags: int = ..., + family: int = 0, + type: int = 0, + proto: int = 0, + flags: int = 0, ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... @abstractmethod - async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = ...) -> tuple[str, str]: ... + async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ... if sys.version_info >= (3, 11): @overload @abstractmethod @@ -485,26 +485,26 @@ class AbstractEventLoop: @abstractmethod async def sock_sendfile( - self, sock: socket, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool | None = ... + self, sock: socket, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool | None = None ) -> int: ... @abstractmethod async def sendfile( - self, transport: WriteTransport, file: IO[bytes], offset: int = ..., count: int | None = ..., *, fallback: bool = ... + self, transport: WriteTransport, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool = True ) -> int: ... @abstractmethod async def create_datagram_endpoint( self, protocol_factory: Callable[[], _ProtocolT], - local_addr: tuple[str, int] | None = ..., - remote_addr: tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = None, + remote_addr: tuple[str, int] | None = None, *, - family: int = ..., - proto: int = ..., - flags: int = ..., - reuse_address: bool | None = ..., - reuse_port: bool | None = ..., - allow_broadcast: bool | None = ..., - sock: socket | None = ..., + family: int = 0, + proto: int = 0, + flags: int = 0, + reuse_address: bool | None = None, + reuse_port: bool | None = None, + allow_broadcast: bool | None = None, + sock: socket | None = None, ) -> tuple[DatagramTransport, _ProtocolT]: ... # Pipes and subprocesses. @abstractmethod @@ -521,9 +521,9 @@ class AbstractEventLoop: protocol_factory: Callable[[], _ProtocolT], cmd: bytes | str, *, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., + stdin: int | IO[Any] | None = -1, + stdout: int | IO[Any] | None = -1, + stderr: int | IO[Any] | None = -1, universal_newlines: Literal[False] = ..., shell: Literal[True] = ..., bufsize: Literal[0] = ..., @@ -538,9 +538,9 @@ class AbstractEventLoop: protocol_factory: Callable[[], _ProtocolT], program: Any, *args: Any, - stdin: int | IO[Any] | None = ..., - stdout: int | IO[Any] | None = ..., - stderr: int | IO[Any] | None = ..., + stdin: int | IO[Any] | None = -1, + stdout: int | IO[Any] | None = -1, + stderr: int | IO[Any] | None = -1, universal_newlines: Literal[False] = ..., shell: Literal[True] = ..., bufsize: Literal[0] = ..., diff --git a/stdlib/asyncio/format_helpers.pyi b/stdlib/asyncio/format_helpers.pyi index 1c78dff3948a..053f0500558e 100644 --- a/stdlib/asyncio/format_helpers.pyi +++ b/stdlib/asyncio/format_helpers.pyi @@ -16,5 +16,5 @@ def _get_function_source(func: _FuncType) -> tuple[str, int]: ... def _get_function_source(func: object) -> tuple[str, int] | None: ... def _format_callback_source(func: object, args: Iterable[Any]) -> str: ... def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ... -def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = "") -> str: ... +def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = '') -> str: ... def extract_stack(f: FrameType | None = None, limit: int | None = None) -> traceback.StackSummary: ... diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index 2efa8ecc0e02..3a260145a4db 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -76,7 +76,7 @@ class Condition(_ContextManagerMixin): def release(self) -> None: ... async def wait(self) -> Literal[True]: ... async def wait_for(self, predicate: Callable[[], _T]) -> _T: ... - def notify(self, n: int = ...) -> None: ... + def notify(self, n: int = 1) -> None: ... def notify_all(self) -> None: ... class Semaphore(_ContextManagerMixin): diff --git a/stdlib/asyncio/proactor_events.pyi b/stdlib/asyncio/proactor_events.pyi index 704939450cc5..a543cf4eb8ac 100644 --- a/stdlib/asyncio/proactor_events.pyi +++ b/stdlib/asyncio/proactor_events.pyi @@ -20,9 +20,9 @@ class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTr loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., + waiter: futures.Future[Any] | None = None, + extra: Mapping[Any, Any] | None = None, + server: events.AbstractServer | None = None, ) -> None: ... if sys.version_info >= (3, 8): def __del__(self, _warn: _WarnCallbackProtocol = ...) -> None: ... @@ -64,9 +64,9 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePip loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., + waiter: futures.Future[Any] | None = None, + extra: Mapping[Any, Any] | None = None, + server: events.AbstractServer | None = None, ) -> None: ... def _set_extra(self, sock: socket) -> None: ... def can_write_eof(self) -> Literal[True]: ... diff --git a/stdlib/asyncio/runners.pyi b/stdlib/asyncio/runners.pyi index 67603e7288d8..e85d291a7382 100644 --- a/stdlib/asyncio/runners.pyi +++ b/stdlib/asyncio/runners.pyi @@ -16,12 +16,12 @@ _T = TypeVar("_T") if sys.version_info >= (3, 11): @final class Runner: - def __init__(self, *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ...) -> None: ... + def __init__(self, *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, exc_type: Unused, exc_val: Unused, exc_tb: Unused) -> None: ... def close(self) -> None: ... def get_loop(self) -> AbstractEventLoop: ... - def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = ...) -> _T: ... + def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ... if sys.version_info >= (3, 12): def run( diff --git a/stdlib/asyncio/selector_events.pyi b/stdlib/asyncio/selector_events.pyi index c5468d4d72c7..430f2dd405cd 100644 --- a/stdlib/asyncio/selector_events.pyi +++ b/stdlib/asyncio/selector_events.pyi @@ -5,4 +5,4 @@ from . import base_events __all__ = ("BaseSelectorEventLoop",) class BaseSelectorEventLoop(base_events.BaseEventLoop): - def __init__(self, selector: selectors.BaseSelector | None = ...) -> None: ... + def __init__(self, selector: selectors.BaseSelector | None = None) -> None: ... diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index 3c1c7b2e4edb..4db8e5b1454a 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -71,7 +71,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): _ssl_protocol: SSLProtocol _closed: bool def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ... - def get_extra_info(self, name: str, default: Any | None = ...) -> dict[str, Any]: ... + def get_extra_info(self, name: str, default: Any | None = None) -> dict[str, Any]: ... @property def _protocol_paused(self) -> bool: ... def write(self, data: bytes | bytearray | memoryview) -> None: ... @@ -138,10 +138,10 @@ class SSLProtocol(_SSLProtocolBase): ) -> None: ... def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ... - def _wakeup_waiter(self, exc: BaseException | None = ...) -> None: ... + def _wakeup_waiter(self, exc: BaseException | None = None) -> None: ... def connection_lost(self, exc: BaseException | None) -> None: ... def eof_received(self) -> None: ... - def _get_extra_info(self, name: str, default: Any | None = ...) -> Any: ... + def _get_extra_info(self, name: str, default: Any | None = None) -> Any: ... def _start_shutdown(self) -> None: ... if sys.version_info >= (3, 11): def _write_appdata(self, list_of_data: list[bytes]) -> None: ... @@ -151,7 +151,7 @@ class SSLProtocol(_SSLProtocolBase): def _start_handshake(self) -> None: ... def _check_handshake_timeout(self) -> None: ... def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ... - def _fatal_error(self, exc: BaseException, message: str = ...) -> None: ... + def _fatal_error(self, exc: BaseException, message: str = 'Fatal error on transport') -> None: ... def _abort(self) -> None: ... if sys.version_info >= (3, 11): def get_buffer(self, n: int) -> memoryview: ... diff --git a/stdlib/asyncio/streams.pyi b/stdlib/asyncio/streams.pyi index c5a5ca070377..68d6f64a5d30 100644 --- a/stdlib/asyncio/streams.pyi +++ b/stdlib/asyncio/streams.pyi @@ -78,21 +78,21 @@ if sys.version_info >= (3, 10): else: async def open_connection( - host: str | None = None, - port: int | str | None = None, + host: str | None = ..., + port: int | str | None = ..., *, loop: events.AbstractEventLoop | None = ..., - limit: int = 65536, + limit: int = ..., ssl_handshake_timeout: float | None = ..., **kwds: Any, ) -> tuple[StreamReader, StreamWriter]: ... async def start_server( client_connected_cb: _ClientConnectedCallback, - host: str | None = None, - port: int | str | None = None, + host: str | None = ..., + port: int | str | None = ..., *, loop: events.AbstractEventLoop | None = ..., - limit: int = 65536, + limit: int = ..., ssl_handshake_timeout: float | None = ..., **kwds: Any, ) -> Server: ... @@ -107,26 +107,26 @@ if sys.platform != "win32": ) -> Server: ... else: async def open_unix_connection( - path: StrPath | None = None, *, loop: events.AbstractEventLoop | None = ..., limit: int = 65536, **kwds: Any + path: StrPath | None = ..., *, loop: events.AbstractEventLoop | None = ..., limit: int = ..., **kwds: Any ) -> tuple[StreamReader, StreamWriter]: ... async def start_unix_server( client_connected_cb: _ClientConnectedCallback, - path: StrPath | None = None, + path: StrPath | None = ..., *, loop: events.AbstractEventLoop | None = ..., - limit: int = 65536, + limit: int = ..., **kwds: Any, ) -> Server: ... class FlowControlMixin(protocols.Protocol): - def __init__(self, loop: events.AbstractEventLoop | None = ...) -> None: ... + def __init__(self, loop: events.AbstractEventLoop | None = None) -> None: ... class StreamReaderProtocol(FlowControlMixin, protocols.Protocol): def __init__( self, stream_reader: StreamReader, - client_connected_cb: _ClientConnectedCallback | None = ..., - loop: events.AbstractEventLoop | None = ..., + client_connected_cb: _ClientConnectedCallback | None = None, + loop: events.AbstractEventLoop | None = None, ) -> None: ... class StreamWriter: @@ -146,7 +146,7 @@ class StreamWriter: def close(self) -> None: ... def is_closing(self) -> bool: ... async def wait_closed(self) -> None: ... - def get_extra_info(self, name: str, default: Any = ...) -> Any: ... + def get_extra_info(self, name: str, default: Any = None) -> Any: ... async def drain(self) -> None: ... if sys.version_info >= (3, 11): async def start_tls( @@ -154,7 +154,7 @@ class StreamWriter: ) -> None: ... class StreamReader(AsyncIterator[bytes]): - def __init__(self, limit: int = ..., loop: events.AbstractEventLoop | None = ...) -> None: ... + def __init__(self, limit: int = 65536, loop: events.AbstractEventLoop | None = None) -> None: ... def exception(self) -> Exception: ... def set_exception(self, exc: Exception) -> None: ... def set_transport(self, transport: transports.BaseTransport) -> None: ... @@ -164,7 +164,7 @@ class StreamReader(AsyncIterator[bytes]): async def readline(self) -> bytes: ... # Can be any buffer that supports len(); consider changing to a Protocol if PEP 688 is accepted async def readuntil(self, separator: bytes | bytearray | memoryview = ...) -> bytes: ... - async def read(self, n: int = ...) -> bytes: ... + async def read(self, n: int = -1) -> bytes: ... async def readexactly(self, n: int) -> bytes: ... def __aiter__(self: Self) -> Self: ... async def __anext__(self) -> bytes: ... diff --git a/stdlib/asyncio/subprocess.pyi b/stdlib/asyncio/subprocess.pyi index f70ea46b3660..15487c3befc5 100644 --- a/stdlib/asyncio/subprocess.pyi +++ b/stdlib/asyncio/subprocess.pyi @@ -38,7 +38,7 @@ class Process: def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... - async def communicate(self, input: bytes | bytearray | memoryview | None = ...) -> tuple[bytes, bytes]: ... + async def communicate(self, input: bytes | bytearray | memoryview | None = None) -> tuple[bytes, bytes]: ... if sys.version_info >= (3, 11): async def create_subprocess_shell( @@ -109,10 +109,10 @@ if sys.version_info >= (3, 11): elif sys.version_info >= (3, 10): async def create_subprocess_shell( cmd: str | bytes, - stdin: int | IO[Any] | None = None, - stdout: int | IO[Any] | None = None, - stderr: int | IO[Any] | None = None, - limit: int = 65536, + stdin: int | IO[Any] | None = ..., + stdout: int | IO[Any] | None = ..., + stderr: int | IO[Any] | None = ..., + limit: int = ..., *, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., @@ -141,10 +141,10 @@ elif sys.version_info >= (3, 10): async def create_subprocess_exec( program: _ExecArg, *args: _ExecArg, - stdin: int | IO[Any] | None = None, - stdout: int | IO[Any] | None = None, - stderr: int | IO[Any] | None = None, - limit: int = 65536, + stdin: int | IO[Any] | None = ..., + stdout: int | IO[Any] | None = ..., + stderr: int | IO[Any] | None = ..., + limit: int = ..., # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., shell: Literal[True] = ..., @@ -173,11 +173,11 @@ elif sys.version_info >= (3, 10): else: # >= 3.9 async def create_subprocess_shell( cmd: str | bytes, - stdin: int | IO[Any] | None = None, - stdout: int | IO[Any] | None = None, - stderr: int | IO[Any] | None = None, + stdin: int | IO[Any] | None = ..., + stdout: int | IO[Any] | None = ..., + stderr: int | IO[Any] | None = ..., loop: events.AbstractEventLoop | None = ..., - limit: int = 65536, + limit: int = ..., *, # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., @@ -205,11 +205,11 @@ else: # >= 3.9 async def create_subprocess_exec( program: _ExecArg, *args: _ExecArg, - stdin: int | IO[Any] | None = None, - stdout: int | IO[Any] | None = None, - stderr: int | IO[Any] | None = None, + stdin: int | IO[Any] | None = ..., + stdout: int | IO[Any] | None = ..., + stderr: int | IO[Any] | None = ..., loop: events.AbstractEventLoop | None = ..., - limit: int = 65536, + limit: int = ..., # These parameters are forced to these values by BaseEventLoop.subprocess_shell universal_newlines: Literal[False] = ..., shell: Literal[True] = ..., diff --git a/stdlib/asyncio/taskgroups.pyi b/stdlib/asyncio/taskgroups.pyi index 0d508c97c1f9..9e6c6e047368 100644 --- a/stdlib/asyncio/taskgroups.pyi +++ b/stdlib/asyncio/taskgroups.pyi @@ -16,5 +16,5 @@ class TaskGroup: async def __aenter__(self: Self) -> Self: ... async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... def create_task( - self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ..., context: Context | None = ... + self, coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = None, context: Context | None = None ) -> Task[_T]: ... diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index 25c764eb2389..76bc4e2a29e0 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -55,7 +55,7 @@ if sys.version_info >= (3, 10): else: def as_completed( - fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = None + fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ... ) -> Iterator[Future[_T]]: ... @overload @@ -288,8 +288,8 @@ class Task(Future[_T_co], Generic[_T_co]): # type: ignore[type-var] # pyright: def get_name(self) -> str: ... def set_name(self, __value: object) -> None: ... - def get_stack(self, *, limit: int | None = ...) -> list[FrameType]: ... - def print_stack(self, *, limit: int | None = ..., file: TextIO | None = ...) -> None: ... + def get_stack(self, *, limit: int | None = None) -> list[FrameType]: ... + def print_stack(self, *, limit: int | None = None, file: TextIO | None = None) -> None: ... if sys.version_info >= (3, 11): def cancelling(self) -> int: ... def uncancel(self) -> int: ... @@ -309,7 +309,7 @@ if sys.version_info >= (3, 11): ) -> Task[_T]: ... elif sys.version_info >= (3, 8): - def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = None) -> Task[_T]: ... + def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T], *, name: str | None = ...) -> Task[_T]: ... else: def create_task(coro: Generator[Any, None, _T] | Coroutine[Any, Any, _T]) -> Task[_T]: ... diff --git a/stdlib/asyncio/transports.pyi b/stdlib/asyncio/transports.pyi index 893292dd12b6..531f77672438 100644 --- a/stdlib/asyncio/transports.pyi +++ b/stdlib/asyncio/transports.pyi @@ -7,8 +7,8 @@ from typing import Any __all__ = ("BaseTransport", "ReadTransport", "WriteTransport", "Transport", "DatagramTransport", "SubprocessTransport") class BaseTransport: - def __init__(self, extra: Mapping[str, Any] | None = ...) -> None: ... - def get_extra_info(self, name: str, default: Any = ...) -> Any: ... + def __init__(self, extra: Mapping[str, Any] | None = None) -> None: ... + def get_extra_info(self, name: str, default: Any = None) -> Any: ... def is_closing(self) -> bool: ... def close(self) -> None: ... def set_protocol(self, protocol: BaseProtocol) -> None: ... @@ -20,7 +20,7 @@ class ReadTransport(BaseTransport): def resume_reading(self) -> None: ... class WriteTransport(BaseTransport): - def set_write_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... + def set_write_buffer_limits(self, high: int | None = None, low: int | None = None) -> None: ... def get_write_buffer_size(self) -> int: ... def get_write_buffer_limits(self) -> tuple[int, int]: ... def write(self, data: bytes | bytearray | memoryview) -> None: ... @@ -32,7 +32,7 @@ class WriteTransport(BaseTransport): class Transport(ReadTransport, WriteTransport): ... class DatagramTransport(BaseTransport): - def sendto(self, data: bytes | bytearray | memoryview, addr: _Address | None = ...) -> None: ... + def sendto(self, data: bytes | bytearray | memoryview, addr: _Address | None = None) -> None: ... def abort(self) -> None: ... class SubprocessTransport(BaseTransport): @@ -44,4 +44,4 @@ class SubprocessTransport(BaseTransport): def kill(self) -> None: ... class _FlowControlMixin(Transport): - def __init__(self, extra: Mapping[str, Any] | None = ..., loop: AbstractEventLoop | None = ...) -> None: ... + def __init__(self, extra: Mapping[str, Any] | None = None, loop: AbstractEventLoop | None = None) -> None: ... diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index 22f6ea4ac887..1fd860fb2410 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -33,11 +33,11 @@ class dispatcher: closing: bool ignore_log_types: frozenset[str] socket: _Socket | None - def __init__(self, sock: _Socket | None = ..., map: _MapType | None = ...) -> None: ... - def add_channel(self, map: _MapType | None = ...) -> None: ... - def del_channel(self, map: _MapType | None = ...) -> None: ... - def create_socket(self, family: int = ..., type: int = ...) -> None: ... - def set_socket(self, sock: _Socket, map: _MapType | None = ...) -> None: ... + def __init__(self, sock: _Socket | None = None, map: _MapType | None = None) -> None: ... + def add_channel(self, map: _MapType | None = None) -> None: ... + def del_channel(self, map: _MapType | None = None) -> None: ... + def create_socket(self, family: int = 2, type: int = 1) -> None: ... + def set_socket(self, sock: _Socket, map: _MapType | None = None) -> None: ... def set_reuse_addr(self) -> None: ... def readable(self) -> bool: ... def writable(self) -> bool: ... @@ -49,7 +49,7 @@ class dispatcher: def recv(self, buffer_size: int) -> bytes: ... def close(self) -> None: ... def log(self, message: Any) -> None: ... - def log_info(self, message: Any, type: str = ...) -> None: ... + def log_info(self, message: Any, type: str = 'info') -> None: ... def handle_read_event(self) -> None: ... def handle_connect_event(self) -> None: ... def handle_write_event(self) -> None: ... @@ -77,7 +77,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: ... @@ -86,5 +86,5 @@ if sys.platform != "win32": def fileno(self) -> int: ... class file_dispatcher(dispatcher): - def __init__(self, fd: FileDescriptorLike, map: _MapType | None = ...) -> None: ... + def __init__(self, fd: FileDescriptorLike, map: _MapType | None = None) -> None: ... def set_file(self, fd: int) -> None: ... diff --git a/stdlib/base64.pyi b/stdlib/base64.pyi index 9a6964553a4a..e60ac754ef51 100644 --- a/stdlib/base64.pyi +++ b/stdlib/base64.pyi @@ -41,9 +41,7 @@ if sys.version_info >= (3, 10): def b32hexencode(s: ReadableBuffer) -> bytes: ... def b32hexdecode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: ... -def a85encode( - b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False -) -> bytes: ... +def a85encode(b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False) -> bytes: ... def a85decode( b: str | ReadableBuffer, *, foldspaces: bool = False, adobe: bool = False, ignorechars: bytearray | bytes = ... ) -> bytes: ... diff --git a/stdlib/bdb.pyi b/stdlib/bdb.pyi index 58808632b31d..24709751ad2f 100644 --- a/stdlib/bdb.pyi +++ b/stdlib/bdb.pyi @@ -24,7 +24,7 @@ class Bdb: stopframe: FrameType | None returnframe: FrameType | None stoplineno: int - def __init__(self, skip: Iterable[str] | None = ...) -> None: ... + def __init__(self, skip: Iterable[str] | None = None) -> None: ... def canonic(self, filename: str) -> str: ... def reset(self) -> None: ... def trace_dispatch(self, frame: FrameType, event: str, arg: Any) -> TraceFunction: ... @@ -41,15 +41,15 @@ class Bdb: def user_line(self, frame: FrameType) -> None: ... def user_return(self, frame: FrameType, return_value: Any) -> None: ... def user_exception(self, frame: FrameType, exc_info: ExcInfo) -> None: ... - def set_until(self, frame: FrameType, lineno: int | None = ...) -> None: ... + def set_until(self, frame: FrameType, lineno: int | None = None) -> None: ... def set_step(self) -> None: ... def set_next(self, frame: FrameType) -> None: ... def set_return(self, frame: FrameType) -> None: ... - def set_trace(self, frame: FrameType | None = ...) -> None: ... + def set_trace(self, frame: FrameType | None = None) -> None: ... def set_continue(self) -> None: ... def set_quit(self) -> None: ... def set_break( - self, filename: str, lineno: int, temporary: bool = ..., cond: str | None = ..., funcname: str | None = ... + self, filename: str, lineno: int, temporary: bool = False, cond: str | None = None, funcname: str | None = None ) -> None: ... def clear_break(self, filename: str, lineno: int) -> None: ... def clear_bpbynumber(self, arg: SupportsInt) -> None: ... @@ -61,9 +61,9 @@ class Bdb: def get_file_breaks(self, filename: str) -> list[Breakpoint]: ... def get_all_breaks(self) -> list[Breakpoint]: ... def get_stack(self, f: FrameType | None, t: TracebackType | None) -> tuple[list[tuple[FrameType, int]], int]: ... - def format_stack_entry(self, frame_lineno: int, lprefix: str = ...) -> str: ... - def run(self, cmd: str | CodeType, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... - def runeval(self, expr: str, globals: dict[str, Any] | None = ..., locals: Mapping[str, Any] | None = ...) -> None: ... + def format_stack_entry(self, frame_lineno: int, lprefix: str = ': ') -> str: ... + def run(self, cmd: str | CodeType, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None) -> None: ... + def runeval(self, expr: str, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None) -> None: ... def runctx(self, cmd: str | CodeType, globals: dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> _T | None: ... @@ -84,7 +84,7 @@ class Breakpoint: hits: int number: int def __init__( - self, file: str, line: int, temporary: bool = ..., cond: str | None = ..., funcname: str | None = ... + self, file: str, line: int, temporary: bool = False, cond: str | None = None, funcname: str | None = None ) -> None: ... if sys.version_info >= (3, 11): @staticmethod @@ -93,7 +93,7 @@ class Breakpoint: def deleteMe(self) -> None: ... def enable(self) -> None: ... def disable(self) -> None: ... - def bpprint(self, out: IO[str] | None = ...) -> None: ... + def bpprint(self, out: IO[str] | None = None) -> None: ... def bpformat(self) -> str: ... def checkfuncname(b: Breakpoint, frame: FrameType) -> bool: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index aac00e3079c3..73ffbf8cf9ab 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -426,7 +426,7 @@ class str(Sequence[str]): @overload def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc] def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... - def encode(self, encoding: str = ..., errors: str = ...) -> bytes: ... + def encode(self, encoding: str = 'utf-8', errors: str = 'strict') -> bytes: ... def endswith( self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... @@ -507,21 +507,21 @@ class str(Sequence[str]): @overload def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc] @overload - def rsplit(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ... + def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ... @overload - def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc] + def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc] @overload def rstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ... @overload def rstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc] @overload - def split(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ... + def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ... @overload - def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc] + def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc] @overload - def splitlines(self: LiteralString, keepends: bool = ...) -> list[LiteralString]: ... + def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ... @overload - def splitlines(self, keepends: bool = ...) -> list[str]: ... # type: ignore[misc] + def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc] def startswith( self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... @@ -596,7 +596,7 @@ class bytes(ByteString): def count( self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... - def decode(self, encoding: str = ..., errors: str = ...) -> str: ... + def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... def endswith( self, __suffix: ReadableBuffer | tuple[ReadableBuffer, ...], @@ -645,10 +645,10 @@ class bytes(ByteString): ) -> int: ... def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytes: ... def rpartition(self, __sep: ReadableBuffer) -> tuple[bytes, bytes, bytes]: ... - def rsplit(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... + def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ... def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytes: ... - def split(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ... - def splitlines(self, keepends: bool = ...) -> list[bytes]: ... + def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytes]: ... + def splitlines(self, keepends: bool = False) -> list[bytes]: ... def startswith( self, __prefix: ReadableBuffer | tuple[ReadableBuffer, ...], @@ -701,7 +701,7 @@ class bytearray(MutableSequence[int], ByteString): self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def copy(self) -> bytearray: ... - def decode(self, encoding: str = ..., errors: str = ...) -> str: ... + def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... def endswith( self, __suffix: ReadableBuffer | tuple[ReadableBuffer, ...], @@ -754,10 +754,10 @@ class bytearray(MutableSequence[int], ByteString): ) -> int: ... def rjust(self, __width: SupportsIndex, __fillchar: bytes | bytearray = ...) -> bytearray: ... def rpartition(self, __sep: ReadableBuffer) -> tuple[bytearray, bytearray, bytearray]: ... - def rsplit(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... + def rsplit(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ... def rstrip(self, __bytes: ReadableBuffer | None = ...) -> bytearray: ... - def split(self, sep: ReadableBuffer | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ... - def splitlines(self, keepends: bool = ...) -> list[bytearray]: ... + def split(self, sep: ReadableBuffer | None = None, maxsplit: SupportsIndex = -1) -> list[bytearray]: ... + def splitlines(self, keepends: bool = False) -> list[bytearray]: ... def startswith( self, __prefix: ReadableBuffer | tuple[ReadableBuffer, ...], @@ -976,9 +976,9 @@ class list(MutableSequence[_T], Generic[_T]): # Use list[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison] # to work around invariance @overload - def sort(self: list[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ...) -> None: ... + def sort(self: list[SupportsRichComparisonT], *, key: None = None, reverse: bool = False) -> None: ... @overload - def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ... + def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> None: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... __hash__: ClassVar[None] # type: ignore[assignment] @@ -1228,9 +1228,9 @@ if sys.version_info >= (3, 8): mode: str, flags: int = 0, dont_inherit: int = False, - optimize: int = ..., + optimize: int = -1, *, - _feature_version: int = ..., + _feature_version: int = -1, ) -> Any: ... else: @@ -1238,8 +1238,8 @@ else: source: str | ReadableBuffer | _ast.Module | _ast.Expression | _ast.Interactive, filename: str | ReadableBuffer | _PathLike[Any], mode: str, - flags: int = 0, - dont_inherit: int = False, + flags: int = ..., + dont_inherit: int = ..., optimize: int = ..., ) -> Any: ... diff --git a/stdlib/bz2.pyi b/stdlib/bz2.pyi index 7fbca226aedc..39ecc2927a2c 100644 --- a/stdlib/bz2.pyi +++ b/stdlib/bz2.pyi @@ -120,12 +120,12 @@ class BZ2File(BaseStream, IO[bytes]): compresslevel: int = ..., ) -> None: ... - def read(self, size: int | None = ...) -> bytes: ... - def read1(self, size: int = ...) -> bytes: ... - def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore[override] + def read(self, size: int | None = -1) -> bytes: ... + def read1(self, size: int = -1) -> bytes: ... + def readline(self, size: SupportsIndex = -1) -> bytes: ... # type: ignore[override] def readinto(self, b: WriteableBuffer) -> int: ... - def readlines(self, size: SupportsIndex = ...) -> list[bytes]: ... - def seek(self, offset: int, whence: int = ...) -> int: ... + def readlines(self, size: SupportsIndex = -1) -> list[bytes]: ... + def seek(self, offset: int, whence: int = 0) -> int: ... def write(self, data: ReadableBuffer) -> int: ... def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... @@ -137,7 +137,7 @@ class BZ2Compressor: @final class BZ2Decompressor: - def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ... + def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ... @property def eof(self) -> bool: ... @property diff --git a/stdlib/cProfile.pyi b/stdlib/cProfile.pyi index e5400c1ca976..77608b268f6f 100644 --- a/stdlib/cProfile.pyi +++ b/stdlib/cProfile.pyi @@ -7,9 +7,9 @@ from typing_extensions import ParamSpec, TypeAlias __all__ = ["run", "runctx", "Profile"] -def run(statement: str, filename: str | None = None, sort: str | int = ...) -> None: ... +def run(statement: str, filename: str | None = None, sort: str | int = -1) -> None: ... def runctx( - statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = None, sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = None, sort: str | int = -1 ) -> None: ... _T = TypeVar("_T") @@ -23,7 +23,7 @@ class Profile: ) -> None: ... def enable(self) -> None: ... def disable(self) -> None: ... - def print_stats(self, sort: str | int = ...) -> None: ... + def print_stats(self, sort: str | int = -1) -> None: ... def dump_stats(self, file: StrOrBytesPath) -> None: ... def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 3d3eae283f7b..215afa033414 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -51,7 +51,7 @@ def monthrange(year: int, month: int) -> tuple[int, int]: ... class Calendar: firstweekday: int - def __init__(self, firstweekday: int = ...) -> None: ... + def __init__(self, firstweekday: int = 0) -> None: ... def getfirstweekday(self) -> int: ... def setfirstweekday(self, firstweekday: int) -> None: ... def iterweekdays(self) -> Iterable[int]: ... @@ -61,9 +61,9 @@ class Calendar: def monthdatescalendar(self, year: int, month: int) -> list[list[datetime.date]]: ... def monthdays2calendar(self, year: int, month: int) -> list[list[tuple[int, int]]]: ... def monthdayscalendar(self, year: int, month: int) -> list[list[int]]: ... - def yeardatescalendar(self, year: int, width: int = ...) -> list[list[int]]: ... - def yeardays2calendar(self, year: int, width: int = ...) -> list[list[tuple[int, int]]]: ... - def yeardayscalendar(self, year: int, width: int = ...) -> list[list[int]]: ... + def yeardatescalendar(self, year: int, width: int = 3) -> list[list[int]]: ... + def yeardays2calendar(self, year: int, width: int = 3) -> list[list[tuple[int, int]]]: ... + def yeardayscalendar(self, year: int, width: int = 3) -> list[list[int]]: ... def itermonthdays3(self, year: int, month: int) -> Iterable[tuple[int, int, int]]: ... def itermonthdays4(self, year: int, month: int) -> Iterable[tuple[int, int, int, int]]: ... @@ -73,11 +73,11 @@ class TextCalendar(Calendar): def formatweek(self, theweek: int, width: int) -> str: ... def formatweekday(self, day: int, width: int) -> str: ... def formatweekheader(self, width: int) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = ...) -> str: ... - def prmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> None: ... - def formatmonth(self, theyear: int, themonth: int, w: int = ..., l: int = ...) -> str: ... - def formatyear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> str: ... - def pryear(self, theyear: int, w: int = ..., l: int = ..., c: int = ..., m: int = ...) -> None: ... + def formatmonthname(self, theyear: int, themonth: int, width: int, withyear: bool = True) -> str: ... + def prmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> None: ... + def formatmonth(self, theyear: int, themonth: int, w: int = 0, l: int = 0) -> str: ... + def formatyear(self, theyear: int, w: int = 2, l: int = 1, c: int = 6, m: int = 3) -> str: ... + def pryear(self, theyear: int, w: int = 0, l: int = 0, c: int = 6, m: int = 3) -> None: ... def firstweekday() -> int: ... def monthcalendar(year: int, month: int) -> list[list[int]]: ... @@ -101,10 +101,10 @@ class HTMLCalendar(Calendar): def formatweek(self, theweek: int) -> str: ... def formatweekday(self, day: int) -> str: ... def formatweekheader(self) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... - def formatmonth(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... - def formatyear(self, theyear: int, width: int = ...) -> str: ... - def formatyearpage(self, theyear: int, width: int = ..., css: str | None = ..., encoding: str | None = ...) -> str: ... + def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ... + def formatmonth(self, theyear: int, themonth: int, withyear: bool = True) -> str: ... + def formatyear(self, theyear: int, width: int = 3) -> str: ... + def formatyearpage(self, theyear: int, width: int = 3, css: str | None = 'calendar.css', encoding: str | None = None) -> str: ... class different_locale: def __init__(self, locale: _LocaleType) -> None: ... @@ -112,12 +112,12 @@ class different_locale: def __exit__(self, *args: Unused) -> None: ... class LocaleTextCalendar(TextCalendar): - def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... + def __init__(self, firstweekday: int = 0, locale: _LocaleType | None = None) -> None: ... class LocaleHTMLCalendar(HTMLCalendar): - def __init__(self, firstweekday: int = ..., locale: _LocaleType | None = ...) -> None: ... + def __init__(self, firstweekday: int = 0, locale: _LocaleType | None = None) -> None: ... def formatweekday(self, day: int) -> str: ... - def formatmonthname(self, theyear: int, themonth: int, withyear: bool = ...) -> str: ... + def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ... c: TextCalendar diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index c8ca5f4ea72d..984923a8c4ab 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -29,7 +29,7 @@ def parse( environ: SupportsItemAccess[str, str] = ..., keep_blank_values: bool = ..., strict_parsing: bool = ..., - separator: str = "&", + separator: str = '&', ) -> dict[str, list[str]]: ... if sys.version_info < (3, 8): @@ -37,7 +37,7 @@ if sys.version_info < (3, 8): def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ... def parse_multipart( - fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = "utf-8", errors: str = "replace", separator: str = "&" + fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = 'utf-8', errors: str = 'replace', separator: str = '&' ) -> dict[str, list[Any]]: ... class _Environ(Protocol): @@ -93,24 +93,24 @@ class FieldStorage: value: None | bytes | _list[Any] def __init__( self, - fp: IO[Any] | None = ..., - headers: Mapping[str, str] | Message | None = ..., + fp: IO[Any] | None = None, + headers: Mapping[str, str] | Message | None = None, outerboundary: bytes = ..., environ: SupportsGetItem[str, str] = ..., - keep_blank_values: int = ..., - strict_parsing: int = ..., - limit: int | None = ..., - encoding: str = ..., - errors: str = ..., - max_num_fields: int | None = ..., - separator: str = ..., + keep_blank_values: int = 0, + strict_parsing: int = 0, + limit: int | None = None, + encoding: str = 'utf-8', + errors: str = 'replace', + max_num_fields: int | None = None, + separator: str = '&', ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, *args: Unused) -> None: ... def __iter__(self) -> Iterator[str]: ... def __getitem__(self, key: str) -> Any: ... - def getvalue(self, key: str, default: Any = ...) -> Any: ... - def getfirst(self, key: str, default: Any = ...) -> Any: ... + def getvalue(self, key: str, default: Any = None) -> Any: ... + def getfirst(self, key: str, default: Any = None) -> Any: ... def getlist(self, key: str) -> _list[Any]: ... def keys(self) -> _list[str]: ... def __contains__(self, key: str) -> bool: ... diff --git a/stdlib/cgitb.pyi b/stdlib/cgitb.pyi index f2990847befd..c0cc8719f82e 100644 --- a/stdlib/cgitb.pyi +++ b/stdlib/cgitb.pyi @@ -19,14 +19,14 @@ def text(einfo: OptExcInfo, context: int = 5) -> str: ... class Hook: # undocumented def __init__( self, - display: int = ..., - logdir: StrOrBytesPath | None = ..., - context: int = ..., - file: IO[str] | None = ..., - format: str = ..., + display: int = 1, + logdir: StrOrBytesPath | None = None, + context: int = 5, + file: IO[str] | None = None, + format: str = 'html', ) -> None: ... def __call__(self, etype: type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... - def handle(self, info: OptExcInfo | None = ...) -> None: ... + def handle(self, info: OptExcInfo | None = None) -> None: ... def handler(info: OptExcInfo | None = None) -> None: ... -def enable(display: int = 1, logdir: StrOrBytesPath | None = None, context: int = 5, format: str = "html") -> None: ... +def enable(display: int = 1, logdir: StrOrBytesPath | None = None, context: int = 5, format: str = 'html') -> None: ... diff --git a/stdlib/chunk.pyi b/stdlib/chunk.pyi index 50ff267c5436..9788d35f680c 100644 --- a/stdlib/chunk.pyi +++ b/stdlib/chunk.pyi @@ -9,12 +9,12 @@ class Chunk: size_read: int offset: int seekable: bool - def __init__(self, file: IO[bytes], align: bool = ..., bigendian: bool = ..., inclheader: bool = ...) -> None: ... + def __init__(self, file: IO[bytes], align: bool = True, bigendian: bool = True, inclheader: bool = False) -> None: ... def getname(self) -> bytes: ... def getsize(self) -> int: ... def close(self) -> None: ... def isatty(self) -> bool: ... - def seek(self, pos: int, whence: int = ...) -> None: ... + def seek(self, pos: int, whence: int = 0) -> None: ... def tell(self) -> int: ... - def read(self, size: int = ...) -> bytes: ... + def read(self, size: int = -1) -> bytes: ... def skip(self) -> None: ... diff --git a/stdlib/cmd.pyi b/stdlib/cmd.pyi index ddefff2edf05..36edcb1f2161 100644 --- a/stdlib/cmd.pyi +++ b/stdlib/cmd.pyi @@ -23,9 +23,9 @@ class Cmd: stdout: IO[str] cmdqueue: list[str] completekey: str - def __init__(self, completekey: str = ..., stdin: IO[str] | None = ..., stdout: IO[str] | None = ...) -> None: ... + def __init__(self, completekey: str = 'tab', stdin: IO[str] | None = None, stdout: IO[str] | None = None) -> None: ... old_completer: Callable[[str, int], str | None] | None - def cmdloop(self, intro: Any | None = ...) -> None: ... + def cmdloop(self, intro: Any | None = None) -> None: ... def precmd(self, line: str) -> str: ... def postcmd(self, stop: bool, line: str) -> bool: ... def preloop(self) -> None: ... @@ -43,4 +43,4 @@ class Cmd: def complete_help(self, *args: Any) -> list[str]: ... def do_help(self, arg: str) -> bool | None: ... def print_topics(self, header: str, cmds: list[str] | None, cmdlen: Any, maxcol: int) -> None: ... - def columnize(self, list: list[str] | None, displaywidth: int = ...) -> None: ... + def columnize(self, list: list[str] | None, displaywidth: int = 80) -> None: ... diff --git a/stdlib/code.pyi b/stdlib/code.pyi index 6fafccebe479..450152d9976a 100644 --- a/stdlib/code.pyi +++ b/stdlib/code.pyi @@ -8,21 +8,21 @@ __all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact", "compile_ class InteractiveInterpreter: locals: Mapping[str, Any] # undocumented compile: CommandCompiler # undocumented - def __init__(self, locals: Mapping[str, Any] | None = ...) -> None: ... - def runsource(self, source: str, filename: str = ..., symbol: str = ...) -> bool: ... + def __init__(self, locals: Mapping[str, Any] | None = None) -> None: ... + def runsource(self, source: str, filename: str = '', symbol: str = 'single') -> bool: ... def runcode(self, code: CodeType) -> None: ... - def showsyntaxerror(self, filename: str | None = ...) -> None: ... + def showsyntaxerror(self, filename: str | None = None) -> None: ... def showtraceback(self) -> None: ... def write(self, data: str) -> None: ... class InteractiveConsole(InteractiveInterpreter): buffer: list[str] # undocumented filename: str # undocumented - def __init__(self, locals: Mapping[str, Any] | None = ..., filename: str = ...) -> None: ... - def interact(self, banner: str | None = ..., exitmsg: str | None = ...) -> None: ... + def __init__(self, locals: Mapping[str, Any] | None = None, filename: str = '') -> None: ... + def interact(self, banner: str | None = None, exitmsg: str | None = None) -> None: ... def push(self, line: str) -> bool: ... def resetbuffer(self) -> None: ... - def raw_input(self, prompt: str = ...) -> str: ... + def raw_input(self, prompt: str = '') -> str: ... def interact( banner: str | None = None, @@ -30,4 +30,4 @@ def interact( local: Mapping[str, Any] | None = None, exitmsg: str | None = None, ) -> None: ... -def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... +def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index 4176682edc57..d8e3e2cf9e8b 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -112,13 +112,13 @@ class CodecInfo(tuple[_Encoder, _Decoder, _StreamReader, _StreamWriter]): cls: type[Self], encode: _Encoder, decode: _Decoder, - streamreader: _StreamReader | None = ..., - streamwriter: _StreamWriter | None = ..., - incrementalencoder: _IncrementalEncoder | None = ..., - incrementaldecoder: _IncrementalDecoder | None = ..., - name: str | None = ..., + streamreader: _StreamReader | None = None, + streamwriter: _StreamWriter | None = None, + incrementalencoder: _IncrementalEncoder | None = None, + incrementaldecoder: _IncrementalDecoder | None = None, + name: str | None = None, *, - _is_text_encoding: bool | None = ..., + _is_text_encoding: bool | None = None, ) -> Self: ... def getencoder(encoding: str) -> _Encoder: ... @@ -128,11 +128,11 @@ def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ... def getreader(encoding: str) -> _StreamReader: ... def getwriter(encoding: str) -> _StreamWriter: ... def open( - filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = ... + filename: str, mode: str = 'r', encoding: str | None = None, errors: str = 'strict', buffering: int = -1 ) -> StreamReaderWriter: ... -def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = "strict") -> StreamRecoder: ... -def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes, None, None]: ... -def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = "strict") -> Generator[str, None, None]: ... +def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = 'strict') -> StreamRecoder: ... +def iterencode(iterator: Iterable[str], encoding: str, errors: str = 'strict') -> Generator[bytes, None, None]: ... +def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = 'strict') -> Generator[str, None, None]: ... BOM: Literal[b"\xff\xfe", b"\xfe\xff"] # depends on `sys.byteorder` BOM_BE: Literal[b"\xfe\xff"] @@ -155,14 +155,14 @@ def namereplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... class Codec: # These are sort of @abstractmethod but sort of not. # The StreamReader and StreamWriter subclasses only implement one. - def encode(self, input: str, errors: str = ...) -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = ...) -> tuple[str, int]: ... + def encode(self, input: str, errors: str = 'strict') -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = 'strict') -> tuple[str, int]: ... class IncrementalEncoder: errors: str - def __init__(self, errors: str = ...) -> None: ... + def __init__(self, errors: str = 'strict') -> None: ... @abstractmethod - def encode(self, input: str, final: bool = ...) -> bytes: ... + def encode(self, input: str, final: bool = False) -> bytes: ... def reset(self) -> None: ... # documentation says int but str is needed for the subclass. def getstate(self) -> int | str: ... @@ -170,9 +170,9 @@ class IncrementalEncoder: class IncrementalDecoder: errors: str - def __init__(self, errors: str = ...) -> None: ... + def __init__(self, errors: str = 'strict') -> None: ... @abstractmethod - def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ... + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... def reset(self) -> None: ... def getstate(self) -> tuple[bytes, int]: ... def setstate(self, state: tuple[bytes, int]) -> None: ... @@ -180,24 +180,24 @@ class IncrementalDecoder: # These are not documented but used in encodings/*.py implementations. class BufferedIncrementalEncoder(IncrementalEncoder): buffer: str - def __init__(self, errors: str = ...) -> None: ... + def __init__(self, errors: str = 'strict') -> None: ... @abstractmethod def _buffer_encode(self, input: str, errors: str, final: bool) -> bytes: ... - def encode(self, input: str, final: bool = ...) -> bytes: ... + def encode(self, input: str, final: bool = False) -> bytes: ... class BufferedIncrementalDecoder(IncrementalDecoder): buffer: bytes - def __init__(self, errors: str = ...) -> None: ... + def __init__(self, errors: str = 'strict') -> None: ... @abstractmethod def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ... - def decode(self, input: ReadableBuffer, final: bool = ...) -> str: ... + def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... # TODO: it is not possible to specify the requirement that all other # attributes and methods are passed-through from the stream. class StreamWriter(Codec): stream: _WritableStream errors: str - def __init__(self, stream: _WritableStream, errors: str = ...) -> None: ... + def __init__(self, stream: _WritableStream, errors: str = 'strict') -> None: ... def write(self, object: str) -> None: ... def writelines(self, list: Iterable[str]) -> None: ... def reset(self) -> None: ... @@ -208,10 +208,10 @@ class StreamWriter(Codec): class StreamReader(Codec): stream: _ReadableStream errors: str - def __init__(self, stream: _ReadableStream, errors: str = ...) -> None: ... - def read(self, size: int = ..., chars: int = ..., firstline: bool = ...) -> str: ... - def readline(self, size: int | None = ..., keepends: bool = ...) -> str: ... - def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> list[str]: ... + def __init__(self, stream: _ReadableStream, errors: str = 'strict') -> None: ... + def read(self, size: int = -1, chars: int = -1, firstline: bool = False) -> str: ... + def readline(self, size: int | None = None, keepends: bool = True) -> str: ... + def readlines(self, sizehint: int | None = None, keepends: bool = True) -> list[str]: ... def reset(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... @@ -223,16 +223,16 @@ class StreamReader(Codec): # and delegates attributes to the underlying binary stream with __getattr__. class StreamReaderWriter(TextIO): stream: _Stream - def __init__(self, stream: _Stream, Reader: _StreamReader, Writer: _StreamWriter, errors: str = ...) -> None: ... - def read(self, size: int = ...) -> str: ... - def readline(self, size: int | None = ...) -> str: ... - def readlines(self, sizehint: int | None = ...) -> list[str]: ... + def __init__(self, stream: _Stream, Reader: _StreamReader, Writer: _StreamWriter, errors: str = 'strict') -> None: ... + def read(self, size: int = -1) -> str: ... + def readline(self, size: int | None = None) -> str: ... + def readlines(self, sizehint: int | None = None) -> list[str]: ... def __next__(self) -> str: ... def __iter__(self: Self) -> Self: ... def write(self, data: str) -> None: ... # type: ignore[override] def writelines(self, list: Iterable[str]) -> None: ... def reset(self) -> None: ... - def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override] + def seek(self, offset: int, whence: int = 0) -> None: ... # type: ignore[override] def __enter__(self: Self) -> Self: ... def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... def __getattr__(self, name: str) -> Any: ... @@ -250,11 +250,11 @@ class StreamReaderWriter(TextIO): class StreamRecoder(BinaryIO): def __init__( - self, stream: _Stream, encode: _Encoder, decode: _Decoder, Reader: _StreamReader, Writer: _StreamWriter, errors: str = ... + self, stream: _Stream, encode: _Encoder, decode: _Decoder, Reader: _StreamReader, Writer: _StreamWriter, errors: str = 'strict' ) -> None: ... - def read(self, size: int = ...) -> bytes: ... - def readline(self, size: int | None = ...) -> bytes: ... - def readlines(self, sizehint: int | None = ...) -> list[bytes]: ... + def read(self, size: int = -1) -> bytes: ... + def readline(self, size: int | None = None) -> bytes: ... + def readlines(self, sizehint: int | None = None) -> list[bytes]: ... def __next__(self) -> bytes: ... def __iter__(self: Self) -> Self: ... def write(self, data: bytes) -> None: ... # type: ignore[override] @@ -263,7 +263,7 @@ class StreamRecoder(BinaryIO): def __getattr__(self, name: str) -> Any: ... def __enter__(self: Self) -> Self: ... def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ... - def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override] + def seek(self, offset: int, whence: int = 0) -> None: ... # type: ignore[override] # These methods don't actually exist directly, but they are needed to satisfy the BinaryIO # interface. At runtime, they are delegated through __getattr__. def close(self) -> None: ... diff --git a/stdlib/codeop.pyi b/stdlib/codeop.pyi index c076599e6ac0..6bb3a79e6765 100644 --- a/stdlib/codeop.pyi +++ b/stdlib/codeop.pyi @@ -2,7 +2,7 @@ from types import CodeType __all__ = ["compile_command", "Compile", "CommandCompiler"] -def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... +def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... class Compile: flags: int @@ -10,4 +10,4 @@ class Compile: class CommandCompiler: compiler: Compile - def __call__(self, source: str, filename: str = ..., symbol: str = ...) -> CodeType | None: ... + def __call__(self, source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 79eb17a4c31e..0ef9d9ca4a6a 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -76,7 +76,7 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. @classmethod @overload - def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> UserDict[_T, Any | None]: ... + def fromkeys(cls, iterable: Iterable[_T], value: None = None) -> UserDict[_T, Any | None]: ... @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S) -> UserDict[_T, _S]: ... @@ -92,7 +92,7 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): class UserList(MutableSequence[_T]): data: list[_T] @overload - def __init__(self, initlist: None = ...) -> None: ... + def __init__(self, initlist: None = None) -> None: ... @overload def __init__(self, initlist: Iterable[_T]) -> None: ... def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ... @@ -119,7 +119,7 @@ class UserList(MutableSequence[_T]): def __imul__(self: Self, n: int) -> Self: ... def append(self, item: _T) -> None: ... def insert(self, i: int, item: _T) -> None: ... - def pop(self, i: int = ...) -> _T: ... + def pop(self, i: int = -1) -> _T: ... def remove(self, item: _T) -> None: ... def copy(self: Self) -> Self: ... def __copy__(self: Self) -> Self: ... @@ -163,18 +163,18 @@ class UserString(Sequence[UserString]): def capitalize(self: Self) -> Self: ... def casefold(self: Self) -> Self: ... def center(self: Self, width: int, *args: Any) -> Self: ... - def count(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... + def count(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ... if sys.version_info >= (3, 8): def encode(self: UserString, encoding: str | None = ..., errors: str | None = ...) -> bytes: ... else: def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ... - def endswith(self, suffix: str | tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ... - def expandtabs(self: Self, tabsize: int = ...) -> Self: ... - def find(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... + def endswith(self, suffix: str | tuple[str, ...], start: int | None = 0, end: int | None = 9223372036854775807) -> bool: ... + def expandtabs(self: Self, tabsize: int = 8) -> Self: ... + def find(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ... def format(self, *args: Any, **kwds: Any) -> str: ... def format_map(self, mapping: Mapping[str, Any]) -> str: ... - def index(self, sub: str, start: int = ..., end: int = ...) -> int: ... + def index(self, sub: str, start: int = 0, end: int = 9223372036854775807) -> int: ... def isalpha(self) -> bool: ... def isalnum(self) -> bool: ... def isdecimal(self) -> bool: ... @@ -190,7 +190,7 @@ class UserString(Sequence[UserString]): def join(self, seq: Iterable[str]) -> str: ... def ljust(self: Self, width: int, *args: Any) -> Self: ... def lower(self: Self) -> Self: ... - def lstrip(self: Self, chars: str | None = ...) -> Self: ... + def lstrip(self: Self, chars: str | None = None) -> Self: ... @staticmethod @overload def maketrans(x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ... @@ -202,17 +202,17 @@ class UserString(Sequence[UserString]): def removeprefix(self: Self, __prefix: str | UserString) -> Self: ... def removesuffix(self: Self, __suffix: str | UserString) -> Self: ... - def replace(self: Self, old: str | UserString, new: str | UserString, maxsplit: int = ...) -> Self: ... - def rfind(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... - def rindex(self, sub: str | UserString, start: int = ..., end: int = ...) -> int: ... + def replace(self: Self, old: str | UserString, new: str | UserString, maxsplit: int = -1) -> Self: ... + def rfind(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ... + def rindex(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ... def rjust(self: Self, width: int, *args: Any) -> Self: ... def rpartition(self, sep: str) -> tuple[str, str, str]: ... - def rstrip(self: Self, chars: str | None = ...) -> Self: ... - def split(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... - def rsplit(self, sep: str | None = ..., maxsplit: int = ...) -> list[str]: ... - def splitlines(self, keepends: bool = ...) -> list[str]: ... - def startswith(self, prefix: str | tuple[str, ...], start: int | None = ..., end: int | None = ...) -> bool: ... - def strip(self: Self, chars: str | None = ...) -> Self: ... + def rstrip(self: Self, chars: str | None = None) -> Self: ... + def split(self, sep: str | None = None, maxsplit: int = -1) -> list[str]: ... + def rsplit(self, sep: str | None = None, maxsplit: int = -1) -> list[str]: ... + def splitlines(self, keepends: bool = False) -> list[str]: ... + def startswith(self, prefix: str | tuple[str, ...], start: int | None = 0, end: int | None = 9223372036854775807) -> bool: ... + def strip(self: Self, chars: str | None = None) -> Self: ... def swapcase(self: Self) -> Self: ... def title(self: Self) -> Self: ... def translate(self: Self, *args: Any) -> Self: ... @@ -268,9 +268,9 @@ class Counter(dict[_T, int], Generic[_T]): def __init__(self, __iterable: Iterable[_T]) -> None: ... def copy(self: Self) -> Self: ... def elements(self) -> Iterator[_T]: ... - def most_common(self, n: int | None = ...) -> list[tuple[_T, int]]: ... + def most_common(self, n: int | None = None) -> list[tuple[_T, int]]: ... @classmethod - def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore[override] + def fromkeys(cls, iterable: Any, v: int | None = None) -> NoReturn: ... # type: ignore[override] @overload def subtract(self, __iterable: None = ...) -> None: ... @overload @@ -341,8 +341,8 @@ class _odict_values(dict_values[_KT_co, _VT_co], Reversible[_VT_co], Generic[_KT def __reversed__(self) -> Iterator[_VT_co]: ... class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): - def popitem(self, last: bool = ...) -> tuple[_KT, _VT]: ... - def move_to_end(self, key: _KT, last: bool = ...) -> None: ... + def popitem(self, last: bool = True) -> tuple[_KT, _VT]: ... + def move_to_end(self, key: _KT, last: bool = True) -> None: ... def copy(self: Self) -> Self: ... def __reversed__(self) -> Iterator[_KT]: ... def keys(self) -> _odict_keys[_KT, _VT]: ... @@ -353,7 +353,7 @@ class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. @classmethod @overload - def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> OrderedDict[_T, Any | None]: ... + def fromkeys(cls, iterable: Iterable[_T], value: None = None) -> OrderedDict[_T, Any | None]: ... @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S) -> OrderedDict[_T, _S]: ... @@ -398,7 +398,7 @@ class defaultdict(dict[_KT, _VT], Generic[_KT, _VT]): class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): maps: list[MutableMapping[_KT, _VT]] def __init__(self, *maps: MutableMapping[_KT, _VT]) -> None: ... - def new_child(self: Self, m: MutableMapping[_KT, _VT] | None = ...) -> Self: ... + def new_child(self: Self, m: MutableMapping[_KT, _VT] | None = None) -> Self: ... @property def parents(self: Self) -> Self: ... def __setitem__(self, key: _KT, value: _VT) -> None: ... @@ -409,7 +409,7 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __contains__(self, key: object) -> bool: ... def __missing__(self, key: _KT) -> _VT: ... # undocumented def __bool__(self) -> bool: ... - def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... + def setdefault(self, key: _KT, default: _VT = None) -> _VT: ... @overload def pop(self, key: _KT) -> _VT: ... @overload diff --git a/stdlib/compileall.pyi b/stdlib/compileall.pyi index bea31f47fc1f..613a2bc40987 100644 --- a/stdlib/compileall.pyi +++ b/stdlib/compileall.pyi @@ -17,7 +17,7 @@ if sys.version_info >= (3, 10): rx: _SupportsSearch | None = None, quiet: int = 0, legacy: bool = False, - optimize: int = ..., + optimize: int = -1, workers: int = 1, invalidation_mode: PycInvalidationMode | None = None, *, @@ -33,7 +33,7 @@ if sys.version_info >= (3, 10): rx: _SupportsSearch | None = None, quiet: int = 0, legacy: bool = False, - optimize: int = ..., + optimize: int = -1, invalidation_mode: PycInvalidationMode | None = None, *, stripdir: StrPath | None = None, @@ -45,59 +45,59 @@ if sys.version_info >= (3, 10): elif sys.version_info >= (3, 9): def compile_dir( dir: StrPath, - maxlevels: int | None = None, - ddir: StrPath | None = None, - force: bool = False, - rx: _SupportsSearch | None = None, - quiet: int = 0, - legacy: bool = False, + maxlevels: int | None = ..., + ddir: StrPath | None = ..., + force: bool = ..., + rx: _SupportsSearch | None = ..., + quiet: int = ..., + legacy: bool = ..., optimize: int = ..., - workers: int = 1, - invalidation_mode: PycInvalidationMode | None = None, + workers: int = ..., + invalidation_mode: PycInvalidationMode | None = ..., *, - stripdir: str | None = None, # https://bugs.python.org/issue40447 - prependdir: StrPath | None = None, - limit_sl_dest: StrPath | None = None, - hardlink_dupes: bool = False, + stripdir: str | None = ..., # https://bugs.python.org/issue40447 + prependdir: StrPath | None = ..., + limit_sl_dest: StrPath | None = ..., + hardlink_dupes: bool = ..., ) -> int: ... def compile_file( fullname: StrPath, - ddir: StrPath | None = None, - force: bool = False, - rx: _SupportsSearch | None = None, - quiet: int = 0, - legacy: bool = False, + ddir: StrPath | None = ..., + force: bool = ..., + rx: _SupportsSearch | None = ..., + quiet: int = ..., + legacy: bool = ..., optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = None, + invalidation_mode: PycInvalidationMode | None = ..., *, - stripdir: str | None = None, # https://bugs.python.org/issue40447 - prependdir: StrPath | None = None, - limit_sl_dest: StrPath | None = None, - hardlink_dupes: bool = False, + stripdir: str | None = ..., # https://bugs.python.org/issue40447 + prependdir: StrPath | None = ..., + limit_sl_dest: StrPath | None = ..., + hardlink_dupes: bool = ..., ) -> int: ... else: def compile_dir( dir: StrPath, maxlevels: int = ..., - ddir: StrPath | None = None, - force: bool = False, - rx: _SupportsSearch | None = None, - quiet: int = 0, - legacy: bool = False, + ddir: StrPath | None = ..., + force: bool = ..., + rx: _SupportsSearch | None = ..., + quiet: int = ..., + legacy: bool = ..., optimize: int = ..., - workers: int = 1, - invalidation_mode: PycInvalidationMode | None = None, + workers: int = ..., + invalidation_mode: PycInvalidationMode | None = ..., ) -> int: ... def compile_file( fullname: StrPath, - ddir: StrPath | None = None, - force: bool = False, - rx: _SupportsSearch | None = None, - quiet: int = 0, - legacy: bool = False, + ddir: StrPath | None = ..., + force: bool = ..., + rx: _SupportsSearch | None = ..., + quiet: int = ..., + legacy: bool = ..., optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = None, + invalidation_mode: PycInvalidationMode | None = ..., ) -> int: ... def compile_path( @@ -106,6 +106,6 @@ def compile_path( force: bool = False, quiet: int = 0, legacy: bool = False, - optimize: int = ..., + optimize: int = -1, invalidation_mode: PycInvalidationMode | None = None, ) -> int: ... diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index 1bbc1cd84ba2..89d986ab3e2a 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -40,10 +40,10 @@ class Future(Generic[_T]): def running(self) -> bool: ... def done(self) -> bool: ... def add_done_callback(self, fn: Callable[[Future[_T]], object]) -> None: ... - def result(self, timeout: float | None = ...) -> _T: ... + def result(self, timeout: float | None = None) -> _T: ... def set_running_or_notify_cancel(self) -> bool: ... def set_result(self, result: _T) -> None: ... - def exception(self, timeout: float | None = ...) -> BaseException | None: ... + def exception(self, timeout: float | None = None) -> BaseException | None: ... def set_exception(self, exception: BaseException | None) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -55,7 +55,7 @@ class Executor: def submit(self, fn: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ... def map( - self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: float | None = ..., chunksize: int = ... + self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: float | None = None, chunksize: int = 1 ) -> Iterator[_T]: ... if sys.version_info >= (3, 9): def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ... @@ -84,9 +84,7 @@ class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]): @overload def __getitem__(self, __s: slice) -> DoneAndNotDoneFutures[_T]: ... -def wait( - fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = "ALL_COMPLETED" -) -> DoneAndNotDoneFutures[_T]: ... +def wait(fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = 'ALL_COMPLETED') -> DoneAndNotDoneFutures[_T]: ... class _Waiter: event: threading.Event diff --git a/stdlib/concurrent/futures/process.pyi b/stdlib/concurrent/futures/process.pyi index 4889ef43f23b..e5f12a05b529 100644 --- a/stdlib/concurrent/futures/process.pyi +++ b/stdlib/concurrent/futures/process.pyi @@ -102,7 +102,7 @@ if sys.version_info >= (3, 11): else: def _sendback_result( - result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = None, exception: Exception | None = None + result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = ..., exception: Exception | None = ... ) -> None: ... if sys.version_info >= (3, 11): diff --git a/stdlib/concurrent/futures/thread.pyi b/stdlib/concurrent/futures/thread.pyi index 387ce0d7e438..ba685723d75d 100644 --- a/stdlib/concurrent/futures/thread.pyi +++ b/stdlib/concurrent/futures/thread.pyi @@ -50,9 +50,9 @@ class ThreadPoolExecutor(Executor): _work_queue: queue.SimpleQueue[_WorkItem[Any]] def __init__( self, - max_workers: int | None = ..., - thread_name_prefix: str = ..., - initializer: Callable[..., object] | None = ..., + max_workers: int | None = None, + thread_name_prefix: str = '', + initializer: Callable[..., object] | None = None, initargs: tuple[Any, ...] = ..., ) -> None: ... def _adjust_thread_count(self) -> None: ... diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index 00a23588b602..156c47c9a3cd 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -65,32 +65,32 @@ class RawConfigParser(_Parser): @overload def __init__( self, - defaults: Mapping[str, str | None] | None = ..., + defaults: Mapping[str, str | None] | None = None, dict_type: type[Mapping[str, str]] = ..., - allow_no_value: Literal[True] = ..., + allow_no_value: Literal[True] = False, *, delimiters: Sequence[str] = ..., comment_prefixes: Sequence[str] = ..., - inline_comment_prefixes: Sequence[str] | None = ..., - strict: bool = ..., - empty_lines_in_values: bool = ..., - default_section: str = ..., + inline_comment_prefixes: Sequence[str] | None = None, + strict: bool = True, + empty_lines_in_values: bool = True, + default_section: str = 'DEFAULT', interpolation: Interpolation | None = ..., converters: _ConvertersMap = ..., ) -> None: ... @overload def __init__( self, - defaults: _Section | None = ..., + defaults: _Section | None = None, dict_type: type[Mapping[str, str]] = ..., - allow_no_value: bool = ..., + allow_no_value: bool = False, *, delimiters: Sequence[str] = ..., comment_prefixes: Sequence[str] = ..., - inline_comment_prefixes: Sequence[str] | None = ..., - strict: bool = ..., - empty_lines_in_values: bool = ..., - default_section: str = ..., + inline_comment_prefixes: Sequence[str] | None = None, + strict: bool = True, + empty_lines_in_values: bool = True, + default_section: str = 'DEFAULT', interpolation: Interpolation | None = ..., converters: _ConvertersMap = ..., ) -> None: ... @@ -106,30 +106,30 @@ class RawConfigParser(_Parser): def has_section(self, section: str) -> bool: ... def options(self, section: str) -> list[str]: ... def has_option(self, section: str, option: str) -> bool: ... - def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = ...) -> list[str]: ... - def read_file(self, f: Iterable[str], source: str | None = ...) -> None: ... - def read_string(self, string: str, source: str = ...) -> None: ... - def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = ...) -> None: ... - def readfp(self, fp: Iterable[str], filename: str | None = ...) -> None: ... + def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str]: ... + def read_file(self, f: Iterable[str], source: str | None = None) -> None: ... + def read_string(self, string: str, source: str = '') -> None: ... + def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = '') -> None: ... + def readfp(self, fp: Iterable[str], filename: str | None = None) -> None: ... # These get* methods are partially applied (with the same names) in # SectionProxy; the stubs should be kept updated together @overload - def getint(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int: ... + def getint(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> int: ... @overload def getint( - self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... + self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ... ) -> int | _T: ... @overload - def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float: ... + def getfloat(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> float: ... @overload def getfloat( - self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... + self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ... ) -> float | _T: ... @overload - def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool: ... + def getboolean(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> bool: ... @overload def getboolean( - self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... + self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ... ) -> bool | _T: ... def _get_conv( self, @@ -137,21 +137,21 @@ class RawConfigParser(_Parser): option: str, conv: Callable[[str], _T], *, - raw: bool = ..., - vars: _Section | None = ..., + raw: bool = False, + vars: _Section | None = None, fallback: _T = ..., ) -> _T: ... # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore[override] - def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str | Any: ... + def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str | Any: ... @overload - def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T | Any: ... + def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T) -> str | _T | Any: ... @overload - def items(self, *, raw: bool = ..., vars: _Section | None = ...) -> ItemsView[str, SectionProxy]: ... + def items(self, *, raw: bool = False, vars: _Section | None = None) -> ItemsView[str, SectionProxy]: ... @overload - def items(self, section: str, raw: bool = ..., vars: _Section | None = ...) -> list[tuple[str, str]]: ... - def set(self, section: str, option: str, value: str | None = ...) -> None: ... - def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = ...) -> None: ... + def items(self, section: str, raw: bool = False, vars: _Section | None = None) -> list[tuple[str, str]]: ... + def set(self, section: str, option: str, value: str | None = None) -> None: ... + def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = True) -> None: ... def remove_option(self, section: str, option: str) -> bool: ... def remove_section(self, section: str) -> bool: ... def optionxform(self, optionstr: str) -> str: ... @@ -159,9 +159,9 @@ class RawConfigParser(_Parser): class ConfigParser(RawConfigParser): # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore[override] - def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str: ... + def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str: ... @overload - def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T: ... + def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T) -> str | _T: ... if sys.version_info < (3, 12): class SafeConfigParser(ConfigParser): ... # deprecated alias @@ -181,11 +181,11 @@ class SectionProxy(MutableMapping[str, str]): def get( # type: ignore[override] self, option: str, - fallback: str | None = ..., + fallback: str | None = None, *, - raw: bool = ..., - vars: _Section | None = ..., - _impl: Any | None = ..., + raw: bool = False, + vars: _Section | None = None, + _impl: Any | None = None, **kwargs: Any, ) -> str | Any: ... # can be None in RawConfigParser's sections # These are partially-applied version of the methods with the same names in @@ -216,7 +216,7 @@ class ConverterMapping(MutableMapping[str, _ConverterCallback | None]): class Error(Exception): message: str - def __init__(self, msg: str = ...) -> None: ... + def __init__(self, msg: str = '') -> None: ... class NoSectionError(Error): section: str @@ -226,14 +226,14 @@ class DuplicateSectionError(Error): section: str source: str | None lineno: int | None - def __init__(self, section: str, source: str | None = ..., lineno: int | None = ...) -> None: ... + def __init__(self, section: str, source: str | None = None, lineno: int | None = None) -> None: ... class DuplicateOptionError(Error): section: str option: str source: str | None lineno: int | None - def __init__(self, section: str, option: str, source: str | None = ..., lineno: int | None = ...) -> None: ... + def __init__(self, section: str, option: str, source: str | None = None, lineno: int | None = None) -> None: ... class NoOptionError(Error): section: str @@ -257,7 +257,7 @@ class InterpolationSyntaxError(InterpolationError): ... class ParsingError(Error): source: str errors: list[tuple[int, str]] - def __init__(self, source: str | None = ..., filename: str | None = ...) -> None: ... + def __init__(self, source: str | None = None, filename: str | None = None) -> None: ... def append(self, lineno: int, line: str) -> None: ... class MissingSectionHeaderError(ParsingError): diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index bc32ce0ffac5..440347d99fc3 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -174,7 +174,7 @@ if sys.version_info >= (3, 10): class nullcontext(AbstractContextManager[_T], AbstractAsyncContextManager[_T]): enter_result: _T @overload - def __init__(self: nullcontext[None], enter_result: None = ...) -> None: ... + def __init__(self: nullcontext[None], enter_result: None = None) -> None: ... @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 8802d6b0a5f5..60255c2d7b1c 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -76,9 +76,9 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]): self, f: Iterable[str], fieldnames: Sequence[_T], - restkey: str | None = ..., - restval: str | None = ..., - dialect: _DialectLike = ..., + restkey: str | None = None, + restval: str | None = None, + dialect: _DialectLike = 'excel', *, delimiter: str = ..., quotechar: str | None = ..., @@ -93,10 +93,10 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]): def __init__( self: DictReader[str], f: Iterable[str], - fieldnames: Sequence[str] | None = ..., - restkey: str | None = ..., - restval: str | None = ..., - dialect: _DialectLike = ..., + fieldnames: Sequence[str] | None = None, + restkey: str | None = None, + restval: str | None = None, + dialect: _DialectLike = 'excel', *, delimiter: str = ..., quotechar: str | None = ..., @@ -121,9 +121,9 @@ class DictWriter(Generic[_T]): self, f: SupportsWrite[str], fieldnames: Collection[_T], - restval: Any | None = ..., - extrasaction: Literal["raise", "ignore"] = ..., - dialect: _DialectLike = ..., + restval: Any | None = '', + extrasaction: Literal["raise", "ignore"] = 'raise', + dialect: _DialectLike = 'excel', *, delimiter: str = ..., quotechar: str | None = ..., @@ -146,5 +146,5 @@ class DictWriter(Generic[_T]): class Sniffer: preferred: list[str] - def sniff(self, sample: str, delimiters: str | None = ...) -> type[Dialect]: ... + def sniff(self, sample: str, delimiters: str | None = None) -> type[Dialect]: ... def has_header(self, sample: str) -> bool: ... diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index b95f1d74e3c2..e1e84afb7dde 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -178,12 +178,12 @@ if sys.platform == "win32": def set_last_error(value: int) -> int: ... def sizeof(obj_or_type: _CData | type[_CData]) -> int: ... -def string_at(address: _CVoidConstPLike, size: int = ...) -> bytes: ... +def string_at(address: _CVoidConstPLike, size: int = -1) -> bytes: ... if sys.platform == "win32": def WinError(code: int | None = ..., descr: str | None = ...) -> OSError: ... -def wstring_at(address: _CVoidConstPLike, size: int = ...) -> str: ... +def wstring_at(address: _CVoidConstPLike, size: int = -1) -> str: ... class _SimpleCData(Generic[_T], _CData): value: _T diff --git a/stdlib/curses/textpad.pyi b/stdlib/curses/textpad.pyi index ad9983431fc7..4d28b4dfbcdc 100644 --- a/stdlib/curses/textpad.pyi +++ b/stdlib/curses/textpad.pyi @@ -7,7 +7,7 @@ if sys.platform != "win32": class Textbox: stripspaces: bool - def __init__(self, win: _CursesWindow, insert_mode: bool = ...) -> None: ... - def edit(self, validate: Callable[[int], int] | None = ...) -> str: ... + def __init__(self, win: _CursesWindow, insert_mode: bool = False) -> None: ... + def edit(self, validate: Callable[[int], int] | None = None) -> str: ... def do_command(self, ch: str | int) -> None: ... def gather(self) -> str: ... diff --git a/stdlib/dataclasses.pyi b/stdlib/dataclasses.pyi index b26682926416..4f50cad1f617 100644 --- a/stdlib/dataclasses.pyi +++ b/stdlib/dataclasses.pyi @@ -258,16 +258,16 @@ elif sys.version_info >= (3, 10): fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], *, bases: tuple[type, ...] = ..., - namespace: dict[str, Any] | None = None, - init: bool = True, - repr: bool = True, - eq: bool = True, - order: bool = False, - unsafe_hash: bool = False, - frozen: bool = False, - match_args: bool = True, - kw_only: bool = False, - slots: bool = False, + namespace: dict[str, Any] | None = ..., + init: bool = ..., + repr: bool = ..., + eq: bool = ..., + order: bool = ..., + unsafe_hash: bool = ..., + frozen: bool = ..., + match_args: bool = ..., + kw_only: bool = ..., + slots: bool = ..., ) -> type: ... else: @@ -276,13 +276,13 @@ else: fields: Iterable[str | tuple[str, type] | tuple[str, type, Any]], *, bases: tuple[type, ...] = ..., - namespace: dict[str, Any] | None = None, - init: bool = True, - repr: bool = True, - eq: bool = True, - order: bool = False, - unsafe_hash: bool = False, - frozen: bool = False, + namespace: dict[str, Any] | None = ..., + init: bool = ..., + repr: bool = ..., + eq: bool = ..., + order: bool = ..., + unsafe_hash: bool = ..., + frozen: bool = ..., ) -> type: ... def replace(__obj: _T, **changes: Any) -> _T: ... diff --git a/stdlib/dbm/__init__.pyi b/stdlib/dbm/__init__.pyi index 5c44553dd668..88778cf95873 100644 --- a/stdlib/dbm/__init__.pyi +++ b/stdlib/dbm/__init__.pyi @@ -92,4 +92,4 @@ class _error(Exception): ... error: tuple[type[_error], type[OSError]] def whichdb(filename: str) -> str: ... -def open(file: str, flag: _TFlags = "r", mode: int = 438) -> _Database: ... +def open(file: str, flag: _TFlags = 'r', mode: int = 438) -> _Database: ... diff --git a/stdlib/dbm/dumb.pyi b/stdlib/dbm/dumb.pyi index ae2ee1124554..598f344989c3 100644 --- a/stdlib/dbm/dumb.pyi +++ b/stdlib/dbm/dumb.pyi @@ -14,7 +14,7 @@ error = OSError # any of the three implementations of dbm (dumb, gnu, ndbm), and this # class is intended to represent the common interface supported by all three. class _Database(MutableMapping[_KeyType, bytes]): - def __init__(self, filebasename: str, mode: str, flag: str = ...) -> None: ... + def __init__(self, filebasename: str, mode: str, flag: str = 'c') -> None: ... def sync(self) -> None: ... def iterkeys(self) -> Iterator[bytes]: ... # undocumented def close(self) -> None: ... @@ -29,4 +29,4 @@ class _Database(MutableMapping[_KeyType, bytes]): self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... -def open(file: str, flag: str = "c", mode: int = 438) -> _Database: ... +def open(file: str, flag: str = 'c', mode: int = 438) -> _Database: ... diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 8063ae104f30..f26daed3e900 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -29,16 +29,16 @@ class Match(NamedTuple): class SequenceMatcher(Generic[_T]): @overload - def __init__(self, isjunk: Callable[[_T], bool] | None, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ... + def __init__(self, isjunk: Callable[[_T], bool] | None, a: Sequence[_T], b: Sequence[_T], autojunk: bool = True) -> None: ... @overload - def __init__(self, *, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ... + def __init__(self, *, a: Sequence[_T], b: Sequence[_T], autojunk: bool = True) -> None: ... @overload def __init__( self: SequenceMatcher[str], - isjunk: Callable[[str], bool] | None = ..., - a: Sequence[str] = ..., - b: Sequence[str] = ..., - autojunk: bool = ..., + isjunk: Callable[[str], bool] | None = None, + a: Sequence[str] = '', + b: Sequence[str] = '', + autojunk: bool = True, ) -> None: ... def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ... def set_seq1(self, a: Sequence[_T]) -> None: ... @@ -50,7 +50,7 @@ class SequenceMatcher(Generic[_T]): def get_matching_blocks(self) -> list[Match]: ... def get_opcodes(self) -> list[tuple[str, int, int, int, int]]: ... - def get_grouped_opcodes(self, n: int = ...) -> Iterable[list[tuple[str, int, int, int, int]]]: ... + def get_grouped_opcodes(self, n: int = 3) -> Iterable[list[tuple[str, int, int, int, int]]]: ... def ratio(self) -> float: ... def quick_ratio(self) -> float: ... def real_quick_ratio(self) -> float: ... @@ -66,65 +66,62 @@ def get_close_matches( ) -> list[Sequence[_T]]: ... class Differ: - def __init__(self, linejunk: Callable[[str], bool] | None = ..., charjunk: Callable[[str], bool] | None = ...) -> None: ... + def __init__(self, linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = None) -> None: ... def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ... def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ... # pat is undocumented -def IS_CHARACTER_JUNK(ch: str, ws: str = " \t") -> bool: ... # ws is undocumented +def IS_CHARACTER_JUNK(ch: str, ws: str = ' \t') -> bool: ... # ws is undocumented def unified_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = "", - tofile: str = "", - fromfiledate: str = "", - tofiledate: str = "", + fromfile: str = '', + tofile: str = '', + fromfiledate: str = '', + tofiledate: str = '', n: int = 3, - lineterm: str = "\n", + lineterm: str = '\n', ) -> Iterator[str]: ... def context_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = "", - tofile: str = "", - fromfiledate: str = "", - tofiledate: str = "", + fromfile: str = '', + tofile: str = '', + fromfiledate: str = '', + tofiledate: str = '', n: int = 3, - lineterm: str = "\n", + lineterm: str = '\n', ) -> Iterator[str]: ... def ndiff( - a: Sequence[str], - b: Sequence[str], - linejunk: Callable[[str], bool] | None = None, - charjunk: Callable[[str], bool] | None = ..., + a: Sequence[str], b: Sequence[str], linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = ... ) -> Iterator[str]: ... class HtmlDiff: def __init__( self, - tabsize: int = ..., - wrapcolumn: int | None = ..., - linejunk: Callable[[str], bool] | None = ..., + tabsize: int = 8, + wrapcolumn: int | None = None, + linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = ..., ) -> None: ... def make_file( self, fromlines: Sequence[str], tolines: Sequence[str], - fromdesc: str = ..., - todesc: str = ..., - context: bool = ..., - numlines: int = ..., + fromdesc: str = '', + todesc: str = '', + context: bool = False, + numlines: int = 5, *, - charset: str = ..., + charset: str = 'utf-8', ) -> str: ... def make_table( self, fromlines: Sequence[str], tolines: Sequence[str], - fromdesc: str = ..., - todesc: str = ..., - context: bool = ..., - numlines: int = ..., + fromdesc: str = '', + todesc: str = '', + context: bool = False, + numlines: int = 5, ) -> str: ... def restore(delta: Iterable[str], which: int) -> Iterator[str]: ... diff --git a/stdlib/dis.pyi b/stdlib/dis.pyi index c16fc5a9f9f4..6f88eccaf8da 100644 --- a/stdlib/dis.pyi +++ b/stdlib/dis.pyi @@ -113,15 +113,15 @@ if sys.version_info >= (3, 11): else: def dis( - x: _HaveCodeType | str | bytes | bytearray | None = None, *, file: IO[str] | None = None, depth: int | None = None + x: _HaveCodeType | str | bytes | bytearray | None = ..., *, file: IO[str] | None = ..., depth: int | None = ... ) -> None: ... if sys.version_info >= (3, 11): def disassemble( - co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False + co: _HaveCodeType, lasti: int = -1, *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False ) -> None: ... def disco( - co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False + co: _HaveCodeType, lasti: int = -1, *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False ) -> None: ... def distb( tb: types.TracebackType | None = None, *, file: IO[str] | None = None, show_caches: bool = False, adaptive: bool = False @@ -131,9 +131,9 @@ if sys.version_info >= (3, 11): ) -> Iterator[Instruction]: ... else: - def disassemble(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None) -> None: ... - def disco(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = None) -> None: ... - def distb(tb: types.TracebackType | None = None, *, file: IO[str] | None = None) -> None: ... - def get_instructions(x: _HaveCodeType, *, first_line: int | None = None) -> Iterator[Instruction]: ... + def disassemble(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... + def disco(co: _HaveCodeType, lasti: int = ..., *, file: IO[str] | None = ...) -> None: ... + def distb(tb: types.TracebackType | None = ..., *, file: IO[str] | None = ...) -> None: ... + def get_instructions(x: _HaveCodeType, *, first_line: int | None = ...) -> Iterator[Instruction]: ... def show_code(co: _HaveCodeType, *, file: IO[str] | None = None) -> None: ... diff --git a/stdlib/distutils/archive_util.pyi b/stdlib/distutils/archive_util.pyi index a8947ce35c60..d2723d60ca1b 100644 --- a/stdlib/distutils/archive_util.pyi +++ b/stdlib/distutils/archive_util.pyi @@ -11,7 +11,7 @@ def make_archive( def make_tarball( base_name: str, base_dir: str, - compress: str | None = "gzip", + compress: str | None = 'gzip', verbose: int = 0, dry_run: int = 0, owner: str | None = None, diff --git a/stdlib/distutils/ccompiler.pyi b/stdlib/distutils/ccompiler.pyi index fa6e80d2dca4..0b8864748496 100644 --- a/stdlib/distutils/ccompiler.pyi +++ b/stdlib/distutils/ccompiler.pyi @@ -25,7 +25,7 @@ class CCompiler: library_dirs: list[str] runtime_library_dirs: list[str] objects: list[str] - def __init__(self, verbose: int = ..., dry_run: int = ..., force: int = ...) -> None: ... + def __init__(self, verbose: int = 0, dry_run: int = 0, force: int = 0) -> None: ... def add_include_dir(self, dir: str) -> None: ... def set_include_dirs(self, dirs: list[str]) -> None: ... def add_library(self, libname: str) -> None: ... @@ -34,7 +34,7 @@ class CCompiler: def set_library_dirs(self, dirs: list[str]) -> None: ... def add_runtime_library_dir(self, dir: str) -> None: ... def set_runtime_library_dirs(self, dirs: list[str]) -> None: ... - def define_macro(self, name: str, value: str | None = ...) -> None: ... + def define_macro(self, name: str, value: str | None = None) -> None: ... def undefine_macro(self, name: str) -> None: ... def add_link_object(self, object: str) -> None: ... def set_link_objects(self, objects: list[str]) -> None: ... @@ -43,10 +43,10 @@ class CCompiler: def has_function( self, funcname: str, - includes: list[str] | None = ..., - include_dirs: list[str] | None = ..., - libraries: list[str] | None = ..., - library_dirs: list[str] | None = ..., + includes: list[str] | None = None, + include_dirs: list[str] | None = None, + libraries: list[str] | None = None, + library_dirs: list[str] | None = None, ) -> bool: ... def library_dir_option(self, dir: str) -> str: ... def library_option(self, lib: str) -> str: ... @@ -55,98 +55,98 @@ class CCompiler: def compile( self, sources: list[str], - output_dir: str | None = ..., - macros: _Macro | None = ..., - include_dirs: list[str] | None = ..., + output_dir: str | None = None, + macros: _Macro | None = None, + include_dirs: list[str] | None = None, debug: bool = ..., - extra_preargs: list[str] | None = ..., - extra_postargs: list[str] | None = ..., - depends: list[str] | None = ..., + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, + depends: list[str] | None = None, ) -> list[str]: ... def create_static_lib( self, objects: list[str], output_libname: str, - output_dir: str | None = ..., + output_dir: str | None = None, debug: bool = ..., - target_lang: str | None = ..., + target_lang: str | None = None, ) -> None: ... def link( self, target_desc: str, objects: list[str], output_filename: str, - output_dir: str | None = ..., - libraries: list[str] | None = ..., - library_dirs: list[str] | None = ..., - runtime_library_dirs: list[str] | None = ..., - export_symbols: list[str] | None = ..., + output_dir: str | None = None, + libraries: list[str] | None = None, + library_dirs: list[str] | None = None, + runtime_library_dirs: list[str] | None = None, + export_symbols: list[str] | None = None, debug: bool = ..., - extra_preargs: list[str] | None = ..., - extra_postargs: list[str] | None = ..., - build_temp: str | None = ..., - target_lang: str | None = ..., + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, + build_temp: str | None = None, + target_lang: str | None = None, ) -> None: ... def link_executable( self, objects: list[str], output_progname: str, - output_dir: str | None = ..., - libraries: list[str] | None = ..., - library_dirs: list[str] | None = ..., - runtime_library_dirs: list[str] | None = ..., + output_dir: str | None = None, + libraries: list[str] | None = None, + library_dirs: list[str] | None = None, + runtime_library_dirs: list[str] | None = None, debug: bool = ..., - extra_preargs: list[str] | None = ..., - extra_postargs: list[str] | None = ..., - target_lang: str | None = ..., + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, + target_lang: str | None = None, ) -> None: ... def link_shared_lib( self, objects: list[str], output_libname: str, - output_dir: str | None = ..., - libraries: list[str] | None = ..., - library_dirs: list[str] | None = ..., - runtime_library_dirs: list[str] | None = ..., - export_symbols: list[str] | None = ..., + output_dir: str | None = None, + libraries: list[str] | None = None, + library_dirs: list[str] | None = None, + runtime_library_dirs: list[str] | None = None, + export_symbols: list[str] | None = None, debug: bool = ..., - extra_preargs: list[str] | None = ..., - extra_postargs: list[str] | None = ..., - build_temp: str | None = ..., - target_lang: str | None = ..., + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, + build_temp: str | None = None, + target_lang: str | None = None, ) -> None: ... def link_shared_object( self, objects: list[str], output_filename: str, - output_dir: str | None = ..., - libraries: list[str] | None = ..., - library_dirs: list[str] | None = ..., - runtime_library_dirs: list[str] | None = ..., - export_symbols: list[str] | None = ..., + output_dir: str | None = None, + libraries: list[str] | None = None, + library_dirs: list[str] | None = None, + runtime_library_dirs: list[str] | None = None, + export_symbols: list[str] | None = None, debug: bool = ..., - extra_preargs: list[str] | None = ..., - extra_postargs: list[str] | None = ..., - build_temp: str | None = ..., - target_lang: str | None = ..., + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, + build_temp: str | None = None, + target_lang: str | None = None, ) -> None: ... def preprocess( self, source: str, - output_file: str | None = ..., - macros: list[_Macro] | None = ..., - include_dirs: list[str] | None = ..., - extra_preargs: list[str] | None = ..., - extra_postargs: list[str] | None = ..., + output_file: str | None = None, + macros: list[_Macro] | None = None, + include_dirs: list[str] | None = None, + extra_preargs: list[str] | None = None, + extra_postargs: list[str] | None = None, ) -> None: ... - def executable_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... - def library_filename(self, libname: str, lib_type: str = ..., strip_dir: int = ..., output_dir: str = ...) -> str: ... - def object_filenames(self, source_filenames: list[str], strip_dir: int = ..., output_dir: str = ...) -> list[str]: ... - def shared_object_filename(self, basename: str, strip_dir: int = ..., output_dir: str = ...) -> str: ... - def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = ..., level: int = ...) -> None: ... + def executable_filename(self, basename: str, strip_dir: int = 0, output_dir: str = '') -> str: ... + def library_filename(self, libname: str, lib_type: str = 'static', strip_dir: int = 0, output_dir: str = '') -> str: ... + def object_filenames(self, source_filenames: list[str], strip_dir: int = 0, output_dir: str = '') -> list[str]: ... + def shared_object_filename(self, basename: str, strip_dir: int = 0, output_dir: str = '') -> str: ... + def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = None, level: int = 1) -> None: ... def spawn(self, cmd: list[str]) -> None: ... - def mkpath(self, name: str, mode: int = ...) -> None: ... + def mkpath(self, name: str, mode: int = 511) -> None: ... def move_file(self, src: str, dst: str) -> str: ... - def announce(self, msg: str, level: int = ...) -> None: ... + def announce(self, msg: str, level: int = 1) -> None: ... def warn(self, msg: str) -> None: ... def debug_print(self, msg: str) -> None: ... diff --git a/stdlib/distutils/cmd.pyi b/stdlib/distutils/cmd.pyi index e706bdbc5802..b71d8b1f2ceb 100644 --- a/stdlib/distutils/cmd.pyi +++ b/stdlib/distutils/cmd.pyi @@ -12,49 +12,49 @@ class Command: def finalize_options(self) -> None: ... @abstractmethod def run(self) -> None: ... - def announce(self, msg: str, level: int = ...) -> None: ... + def announce(self, msg: str, level: int = 1) -> None: ... def debug_print(self, msg: str) -> None: ... - def ensure_string(self, option: str, default: str | None = ...) -> None: ... + def ensure_string(self, option: str, default: str | None = None) -> None: ... def ensure_string_list(self, option: str | list[str]) -> None: ... def ensure_filename(self, option: str) -> None: ... def ensure_dirname(self, option: str) -> None: ... def get_command_name(self) -> str: ... def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ... - def get_finalized_command(self, command: str, create: int = ...) -> Command: ... - def reinitialize_command(self, command: Command | str, reinit_subcommands: int = ...) -> Command: ... + def get_finalized_command(self, command: str, create: int = 1) -> Command: ... + def reinitialize_command(self, command: Command | str, reinit_subcommands: int = 0) -> Command: ... def run_command(self, command: str) -> None: ... def get_sub_commands(self) -> list[str]: ... def warn(self, msg: str) -> None: ... - def execute(self, func: Callable[..., object], args: Iterable[Any], msg: str | None = ..., level: int = ...) -> None: ... - def mkpath(self, name: str, mode: int = ...) -> None: ... + def execute(self, func: Callable[..., object], args: Iterable[Any], msg: str | None = None, level: int = 1) -> None: ... + def mkpath(self, name: str, mode: int = 511) -> None: ... def copy_file( self, infile: str, outfile: str, - preserve_mode: int = ..., - preserve_times: int = ..., - link: str | None = ..., - level: Any = ..., + preserve_mode: int = 1, + preserve_times: int = 1, + link: str | None = None, + level: Any = 1, ) -> tuple[str, bool]: ... # level is not used def copy_tree( self, infile: str, outfile: str, - preserve_mode: int = ..., - preserve_times: int = ..., - preserve_symlinks: int = ..., - level: Any = ..., + preserve_mode: int = 1, + preserve_times: int = 1, + preserve_symlinks: int = 0, + level: Any = 1, ) -> list[str]: ... # level is not used - def move_file(self, src: str, dst: str, level: Any = ...) -> str: ... # level is not used - def spawn(self, cmd: Iterable[str], search_path: int = ..., level: Any = ...) -> None: ... # level is not used + def move_file(self, src: str, dst: str, level: Any = 1) -> str: ... # level is not used + def spawn(self, cmd: Iterable[str], search_path: int = 1, level: Any = 1) -> None: ... # level is not used def make_archive( self, base_name: str, format: str, - root_dir: str | None = ..., - base_dir: str | None = ..., - owner: str | None = ..., - group: str | None = ..., + root_dir: str | None = None, + base_dir: str | None = None, + owner: str | None = None, + group: str | None = None, ) -> str: ... def make_file( self, @@ -62,7 +62,7 @@ class Command: outfile: str, func: Callable[..., object], args: list[Any], - exec_msg: str | None = ..., - skip_msg: str | None = ..., - level: Any = ..., + exec_msg: str | None = None, + skip_msg: str | None = None, + level: Any = 1, ) -> None: ... # level is not used diff --git a/stdlib/distutils/command/build_py.pyi b/stdlib/distutils/command/build_py.pyi index 3c6e022c2a10..ca4e4ed7e797 100644 --- a/stdlib/distutils/command/build_py.pyi +++ b/stdlib/distutils/command/build_py.pyi @@ -32,7 +32,7 @@ class build_py(Command): def find_all_modules(self): ... def get_source_files(self): ... def get_module_outfile(self, build_dir, package, module): ... - def get_outputs(self, include_bytecode: int = ...): ... + def get_outputs(self, include_bytecode: int = 1): ... def build_module(self, module, module_file, package): ... def build_modules(self) -> None: ... def build_packages(self) -> None: ... diff --git a/stdlib/distutils/command/config.pyi b/stdlib/distutils/command/config.pyi index 1a772f976864..1bdb3a9023aa 100644 --- a/stdlib/distutils/command/config.pyi +++ b/stdlib/distutils/command/config.pyi @@ -24,60 +24,60 @@ class config(Command): def run(self) -> None: ... def try_cpp( self, - body: str | None = ..., - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - lang: str = ..., + body: str | None = None, + headers: Sequence[str] | None = None, + include_dirs: Sequence[str] | None = None, + lang: str = 'c', ) -> bool: ... def search_cpp( self, pattern: Pattern[str] | str, - body: str | None = ..., - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - lang: str = ..., + body: str | None = None, + headers: Sequence[str] | None = None, + include_dirs: Sequence[str] | None = None, + lang: str = 'c', ) -> bool: ... def try_compile( - self, body: str, headers: Sequence[str] | None = ..., include_dirs: Sequence[str] | None = ..., lang: str = ... + self, body: str, headers: Sequence[str] | None = None, include_dirs: Sequence[str] | None = None, lang: str = 'c' ) -> bool: ... def try_link( self, body: str, - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - libraries: Sequence[str] | None = ..., - library_dirs: Sequence[str] | None = ..., - lang: str = ..., + headers: Sequence[str] | None = None, + include_dirs: Sequence[str] | None = None, + libraries: Sequence[str] | None = None, + library_dirs: Sequence[str] | None = None, + lang: str = 'c', ) -> bool: ... def try_run( self, body: str, - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - libraries: Sequence[str] | None = ..., - library_dirs: Sequence[str] | None = ..., - lang: str = ..., + headers: Sequence[str] | None = None, + include_dirs: Sequence[str] | None = None, + libraries: Sequence[str] | None = None, + library_dirs: Sequence[str] | None = None, + lang: str = 'c', ) -> bool: ... def check_func( self, func: str, - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., - libraries: Sequence[str] | None = ..., - library_dirs: Sequence[str] | None = ..., - decl: int = ..., - call: int = ..., + headers: Sequence[str] | None = None, + include_dirs: Sequence[str] | None = None, + libraries: Sequence[str] | None = None, + library_dirs: Sequence[str] | None = None, + decl: int = 0, + call: int = 0, ) -> bool: ... def check_lib( self, library: str, - library_dirs: Sequence[str] | None = ..., - headers: Sequence[str] | None = ..., - include_dirs: Sequence[str] | None = ..., + library_dirs: Sequence[str] | None = None, + headers: Sequence[str] | None = None, + include_dirs: Sequence[str] | None = None, other_libraries: list[str] = ..., ) -> bool: ... def check_header( - self, header: str, include_dirs: Sequence[str] | None = ..., library_dirs: Sequence[str] | None = ..., lang: str = ... + self, header: str, include_dirs: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, lang: str = 'c' ) -> bool: ... def dump_file(filename: str, head: Any | None = None) -> None: ... diff --git a/stdlib/distutils/command/register.pyi b/stdlib/distutils/command/register.pyi index a1a7a45fb3d7..f88b94113ff4 100644 --- a/stdlib/distutils/command/register.pyi +++ b/stdlib/distutils/command/register.pyi @@ -15,4 +15,4 @@ class register(PyPIRCCommand): def verify_metadata(self) -> None: ... def send_metadata(self) -> None: ... def build_post_data(self, action): ... - def post_to_server(self, data, auth: Any | None = ...): ... + def post_to_server(self, data, auth: Any | None = None): ... diff --git a/stdlib/distutils/core.pyi b/stdlib/distutils/core.pyi index 56081f921378..98639068f635 100644 --- a/stdlib/distutils/core.pyi +++ b/stdlib/distutils/core.pyi @@ -46,4 +46,4 @@ def setup( fullname: str = ..., **attrs: Any, ) -> None: ... -def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = "run") -> Distribution: ... +def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = 'run') -> Distribution: ... diff --git a/stdlib/distutils/dep_util.pyi b/stdlib/distutils/dep_util.pyi index 096ce19d4859..4fb898c6581b 100644 --- a/stdlib/distutils/dep_util.pyi +++ b/stdlib/distutils/dep_util.pyi @@ -1,3 +1,3 @@ def newer(source: str, target: str) -> bool: ... def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ... -def newer_group(sources: list[str], target: str, missing: str = "error") -> bool: ... +def newer_group(sources: list[str], target: str, missing: str = 'error') -> bool: ... diff --git a/stdlib/distutils/dist.pyi b/stdlib/distutils/dist.pyi index fc1bce261e57..b411324c4ce6 100644 --- a/stdlib/distutils/dist.pyi +++ b/stdlib/distutils/dist.pyi @@ -4,7 +4,7 @@ from distutils.cmd import Command from typing import IO, Any class DistributionMetadata: - def __init__(self, path: FileDescriptorOrPath | None = ...) -> None: ... + def __init__(self, path: FileDescriptorOrPath | None = None) -> None: ... name: str | None version: str | None author: str | None @@ -53,7 +53,7 @@ class DistributionMetadata: class Distribution: cmdclass: dict[str, type[Command]] metadata: DistributionMetadata - def __init__(self, attrs: Mapping[str, Any] | None = ...) -> None: ... + def __init__(self, attrs: Mapping[str, Any] | None = None) -> None: ... def get_option_dict(self, command: str) -> dict[str, tuple[str, str]]: ... - def parse_config_files(self, filenames: Iterable[str] | None = ...) -> None: ... + def parse_config_files(self, filenames: Iterable[str] | None = None) -> None: ... def get_command_obj(self, command: str, create: bool = ...) -> Command | None: ... diff --git a/stdlib/distutils/fancy_getopt.pyi b/stdlib/distutils/fancy_getopt.pyi index 6a7124bd15ad..153583be6b5d 100644 --- a/stdlib/distutils/fancy_getopt.pyi +++ b/stdlib/distutils/fancy_getopt.pyi @@ -11,14 +11,14 @@ def fancy_getopt( def wrap_text(text: str, width: int) -> list[str]: ... class FancyGetopt: - def __init__(self, option_table: list[_Option] | None = ...) -> None: ... + def __init__(self, option_table: list[_Option] | None = None) -> None: ... # TODO kinda wrong, `getopt(object=object())` is invalid @overload - def getopt(self, args: list[str] | None = ...) -> _GR: ... + def getopt(self, args: list[str] | None = None) -> _GR: ... @overload def getopt(self, args: list[str] | None, object: Any) -> list[str]: ... def get_option_order(self) -> list[tuple[str, str]]: ... - def generate_help(self, header: str | None = ...) -> list[str]: ... + def generate_help(self, header: str | None = None) -> list[str]: ... class OptionDummy: def __init__(self, options: Iterable[str] = ...) -> None: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index 0d313f151321..2dbbfef9fbaf 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -7,9 +7,9 @@ from typing_extensions import Literal class FileList: allfiles: Iterable[str] | None files: list[str] - def __init__(self, warn: None = ..., debug_print: None = ...) -> None: ... + def __init__(self, warn: None = None, debug_print: None = None) -> None: ... def set_allfiles(self, allfiles: Iterable[str]) -> None: ... - def findall(self, dir: str = ...) -> None: ... + def findall(self, dir: str = '.') -> None: ... def debug_print(self, msg: str) -> None: ... def append(self, item: str) -> None: ... def extend(self, items: Iterable[str]) -> None: ... @@ -18,26 +18,26 @@ class FileList: def process_template_line(self, line: str) -> None: ... @overload def include_pattern( - self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... + self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0 ) -> bool: ... @overload - def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... + def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = 0) -> bool: ... @overload def include_pattern( - self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0 ) -> bool: ... @overload def exclude_pattern( - self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... + self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0 ) -> bool: ... @overload - def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... + def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = 0) -> bool: ... @overload def exclude_pattern( - self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0 ) -> bool: ... -def findall(dir: str = ".") -> list[str]: ... +def findall(dir: str = '.') -> list[str]: ... def glob_to_re(pattern: str) -> str: ... @overload def translate_pattern( diff --git a/stdlib/distutils/log.pyi b/stdlib/distutils/log.pyi index 549b569e7356..14ed8d8aefa8 100644 --- a/stdlib/distutils/log.pyi +++ b/stdlib/distutils/log.pyi @@ -7,7 +7,7 @@ ERROR: int FATAL: int class Log: - def __init__(self, threshold: int = ...) -> None: ... + def __init__(self, threshold: int = 3) -> None: ... def log(self, level: int, msg: str, *args: Any) -> None: ... def debug(self, msg: str, *args: Any) -> None: ... def info(self, msg: str, *args: Any) -> None: ... diff --git a/stdlib/distutils/text_file.pyi b/stdlib/distutils/text_file.pyi index ace642e027cf..4a6cf1db77c6 100644 --- a/stdlib/distutils/text_file.pyi +++ b/stdlib/distutils/text_file.pyi @@ -3,8 +3,8 @@ from typing import IO class TextFile: def __init__( self, - filename: str | None = ..., - file: IO[str] | None = ..., + filename: str | None = None, + file: IO[str] | None = None, *, strip_comments: bool = ..., lstrip_ws: bool = ..., @@ -15,7 +15,7 @@ class TextFile: ) -> None: ... def open(self, filename: str) -> None: ... def close(self) -> None: ... - def warn(self, msg: str, line: list[int] | tuple[int, int] | int | None = ...) -> None: ... + def warn(self, msg: str, line: list[int] | tuple[int, int] | int | None = None) -> None: ... def readline(self) -> str | None: ... def readlines(self) -> list[str]: ... def unreadline(self, line: str) -> str: ... diff --git a/stdlib/distutils/version.pyi b/stdlib/distutils/version.pyi index 627d45067b5c..4f1b64a7381d 100644 --- a/stdlib/distutils/version.pyi +++ b/stdlib/distutils/version.pyi @@ -9,7 +9,7 @@ class Version: def __gt__(self: Self, other: Self | str) -> bool: ... def __ge__(self: Self, other: Self | str) -> bool: ... @abstractmethod - def __init__(self, vstring: str | None = ...) -> None: ... + def __init__(self, vstring: str | None = None) -> None: ... @abstractmethod def parse(self: Self, vstring: str) -> Self: ... @abstractmethod @@ -21,7 +21,7 @@ class StrictVersion(Version): version_re: Pattern[str] version: tuple[int, int, int] prerelease: tuple[str, int] | None - def __init__(self, vstring: str | None = ...) -> None: ... + def __init__(self, vstring: str | None = None) -> None: ... def parse(self: Self, vstring: str) -> Self: ... def __str__(self) -> str: ... # noqa: Y029 def _cmp(self: Self, other: Self | str) -> bool: ... @@ -30,7 +30,7 @@ class LooseVersion(Version): component_re: Pattern[str] vstring: str version: tuple[str | int, ...] - def __init__(self, vstring: str | None = ...) -> None: ... + def __init__(self, vstring: str | None = None) -> None: ... def parse(self: Self, vstring: str) -> Self: ... def __str__(self) -> str: ... # noqa: Y029 def _cmp(self: Self, other: Self | str) -> bool: ... diff --git a/stdlib/doctest.pyi b/stdlib/doctest.pyi index 6a81e313c236..e7f239ed3a65 100644 --- a/stdlib/doctest.pyi +++ b/stdlib/doctest.pyi @@ -80,10 +80,10 @@ class Example: self, source: str, want: str, - exc_msg: str | None = ..., - lineno: int = ..., - indent: int = ..., - options: dict[int, bool] | None = ..., + exc_msg: str | None = None, + lineno: int = 0, + indent: int = 0, + options: dict[int, bool] | None = None, ) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -107,21 +107,21 @@ class DocTest: def __eq__(self, other: object) -> bool: ... class DocTestParser: - def parse(self, string: str, name: str = ...) -> list[str | Example]: ... + def parse(self, string: str, name: str = '') -> list[str | Example]: ... def get_doctest(self, string: str, globs: dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ... - def get_examples(self, string: str, name: str = ...) -> list[Example]: ... + def get_examples(self, string: str, name: str = '') -> list[Example]: ... class DocTestFinder: def __init__( - self, verbose: bool = ..., parser: DocTestParser = ..., recurse: bool = ..., exclude_empty: bool = ... + self, verbose: bool = False, parser: DocTestParser = ..., recurse: bool = True, exclude_empty: bool = True ) -> None: ... def find( self, obj: object, - name: str | None = ..., - module: None | bool | types.ModuleType = ..., - globs: dict[str, Any] | None = ..., - extraglobs: dict[str, Any] | None = ..., + name: str | None = None, + module: None | bool | types.ModuleType = None, + globs: dict[str, Any] | None = None, + extraglobs: dict[str, Any] | None = None, ) -> list[DocTest]: ... _Out: TypeAlias = Callable[[str], object] @@ -133,15 +133,15 @@ class DocTestRunner: tries: int failures: int test: DocTest - def __init__(self, checker: OutputChecker | None = ..., verbose: bool | None = ..., optionflags: int = ...) -> None: ... + def __init__(self, checker: OutputChecker | None = None, verbose: bool | None = None, optionflags: int = 0) -> None: ... def report_start(self, out: _Out, test: DocTest, example: Example) -> None: ... def report_success(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... def report_failure(self, out: _Out, test: DocTest, example: Example, got: str) -> None: ... def report_unexpected_exception(self, out: _Out, test: DocTest, example: Example, exc_info: ExcInfo) -> None: ... def run( - self, test: DocTest, compileflags: int | None = ..., out: _Out | None = ..., clear_globs: bool = ... + self, test: DocTest, compileflags: int | None = None, out: _Out | None = None, clear_globs: bool = True ) -> TestResults: ... - def summarize(self, verbose: bool | None = ...) -> TestResults: ... + def summarize(self, verbose: bool | None = None) -> TestResults: ... def merge(self, other: DocTestRunner) -> None: ... class OutputChecker: @@ -190,12 +190,7 @@ def testfile( encoding: str | None = None, ) -> TestResults: ... def run_docstring_examples( - f: object, - globs: dict[str, Any], - verbose: bool = False, - name: str = "NoName", - compileflags: int | None = None, - optionflags: int = 0, + f: object, globs: dict[str, Any], verbose: bool = False, name: str = 'NoName', compileflags: int | None = None, optionflags: int = 0 ) -> None: ... def set_unittest_reportflags(flags: int) -> int: ... @@ -203,10 +198,10 @@ class DocTestCase(unittest.TestCase): def __init__( self, test: DocTest, - optionflags: int = ..., - setUp: Callable[[DocTest], Any] | None = ..., - tearDown: Callable[[DocTest], Any] | None = ..., - checker: OutputChecker | None = ..., + optionflags: int = 0, + setUp: Callable[[DocTest], Any] | None = None, + tearDown: Callable[[DocTest], Any] | None = None, + checker: OutputChecker | None = None, ) -> None: ... def runTest(self) -> None: ... def format_failure(self, err: str) -> str: ... diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index 28a851d2f4e7..04f51a97d4b3 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -39,8 +39,8 @@ class TokenList(list[TokenList | Terminal]): @property def comments(self) -> list[str]: ... def fold(self, *, policy: Policy) -> str: ... - def pprint(self, indent: str = ...) -> None: ... - def ppstr(self, indent: str = ...) -> str: ... + def pprint(self, indent: str = '') -> None: ... + def ppstr(self, indent: str = '') -> str: ... class WhiteSpaceTokenList(TokenList): ... diff --git a/stdlib/email/base64mime.pyi b/stdlib/email/base64mime.pyi index 563cd7f669a2..2c49ba7192ad 100644 --- a/stdlib/email/base64mime.pyi +++ b/stdlib/email/base64mime.pyi @@ -3,10 +3,10 @@ __all__ = ["body_decode", "body_encode", "decode", "decodestring", "header_encod from _typeshed import ReadableBuffer def header_length(bytearray: str | bytes | bytearray) -> int: ... -def header_encode(header_bytes: str | ReadableBuffer, charset: str = "iso-8859-1") -> str: ... +def header_encode(header_bytes: str | ReadableBuffer, charset: str = 'iso-8859-1') -> str: ... # First argument should be a buffer that supports slicing and len(). -def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = "\n") -> str: ... +def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = '\n') -> str: ... def decode(string: str | ReadableBuffer) -> bytes: ... body_decode = decode diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index f5409e817010..1dd1fa25f383 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -13,7 +13,7 @@ class Charset: output_charset: str | None input_codec: str | None output_codec: str | None - def __init__(self, input_charset: str = ...) -> None: ... + def __init__(self, input_charset: str = 'us-ascii') -> None: ... def get_body_encoding(self) -> str: ... def get_output_charset(self) -> str | None: ... def header_encode(self, string: str) -> str: ... diff --git a/stdlib/email/errors.pyi b/stdlib/email/errors.pyi index 656cbd374ac4..c54f1560c9ae 100644 --- a/stdlib/email/errors.pyi +++ b/stdlib/email/errors.pyi @@ -8,7 +8,7 @@ class MultipartConversionError(MessageError, TypeError): ... class CharsetError(MessageError): ... class MessageDefect(ValueError): - def __init__(self, line: str | None = ...) -> None: ... + def __init__(self, line: str | None = None) -> None: ... class NoBoundaryInMultipartDefect(MessageDefect): ... class StartBoundaryNotFoundDefect(MessageDefect): ... diff --git a/stdlib/email/feedparser.pyi b/stdlib/email/feedparser.pyi index 809f0b0e112b..4b7f73b9c015 100644 --- a/stdlib/email/feedparser.pyi +++ b/stdlib/email/feedparser.pyi @@ -9,7 +9,7 @@ _MessageT = TypeVar("_MessageT", bound=Message) class FeedParser(Generic[_MessageT]): @overload - def __init__(self: FeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ... + def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ... @overload def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ... def feed(self, data: str) -> None: ... @@ -17,7 +17,7 @@ class FeedParser(Generic[_MessageT]): class BytesFeedParser(Generic[_MessageT]): @overload - def __init__(self: BytesFeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ... + def __init__(self: BytesFeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ... @overload def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ... def feed(self, data: bytes | bytearray) -> None: ... diff --git a/stdlib/email/generator.pyi b/stdlib/email/generator.pyi index 5a6b6374dd4b..8362dd9c4ff6 100644 --- a/stdlib/email/generator.pyi +++ b/stdlib/email/generator.pyi @@ -10,12 +10,12 @@ class Generator: def __init__( self, outfp: SupportsWrite[str], - mangle_from_: bool | None = ..., - maxheaderlen: int | None = ..., + mangle_from_: bool | None = None, + maxheaderlen: int | None = None, *, - policy: Policy | None = ..., + policy: Policy | None = None, ) -> None: ... - def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ... + def flatten(self, msg: Message, unixfrom: bool = False, linesep: str | None = None) -> None: ... class BytesGenerator: def clone(self, fp: SupportsWrite[bytes]) -> BytesGenerator: ... @@ -23,20 +23,20 @@ class BytesGenerator: def __init__( self, outfp: SupportsWrite[bytes], - mangle_from_: bool | None = ..., - maxheaderlen: int | None = ..., + mangle_from_: bool | None = None, + maxheaderlen: int | None = None, *, - policy: Policy | None = ..., + policy: Policy | None = None, ) -> None: ... - def flatten(self, msg: Message, unixfrom: bool = ..., linesep: str | None = ...) -> None: ... + def flatten(self, msg: Message, unixfrom: bool = False, linesep: str | None = None) -> None: ... class DecodedGenerator(Generator): def __init__( self, outfp: SupportsWrite[str], - mangle_from_: bool | None = ..., - maxheaderlen: int | None = ..., - fmt: str | None = ..., + mangle_from_: bool | None = None, + maxheaderlen: int | None = None, + fmt: str | None = None, *, - policy: Policy | None = ..., + policy: Policy | None = None, ) -> None: ... diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index 8f877efa67df..7171191b3dcc 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -7,15 +7,15 @@ __all__ = ["Header", "decode_header", "make_header"] class Header: def __init__( self, - s: bytes | bytearray | str | None = ..., - charset: Charset | str | None = ..., - maxlinelen: int | None = ..., - header_name: str | None = ..., - continuation_ws: str = ..., - errors: str = ..., + s: bytes | bytearray | str | None = None, + charset: Charset | str | None = None, + maxlinelen: int | None = None, + header_name: str | None = None, + continuation_ws: str = ' ', + errors: str = 'strict', ) -> None: ... - def append(self, s: bytes | bytearray | str, charset: Charset | str | None = ..., errors: str = ...) -> None: ... - def encode(self, splitchars: str = ..., maxlinelen: int | None = ..., linesep: str = ...) -> str: ... + def append(self, s: bytes | bytearray | str, charset: Charset | str | None = None, errors: str = 'strict') -> None: ... + def encode(self, splitchars: str = ';, \t', maxlinelen: int | None = None, linesep: str = '\n') -> str: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, __other: object) -> bool: ... @@ -27,5 +27,5 @@ def make_header( decoded_seq: Iterable[tuple[bytes | bytearray | str, str | None]], maxlinelen: int | None = None, header_name: str | None = None, - continuation_ws: str = " ", + continuation_ws: str = ' ', ) -> Header: ... diff --git a/stdlib/email/headerregistry.pyi b/stdlib/email/headerregistry.pyi index b2b63c4ac72c..c0dfd2ac4176 100644 --- a/stdlib/email/headerregistry.pyi +++ b/stdlib/email/headerregistry.pyi @@ -153,7 +153,7 @@ class HeaderRegistry: base_class: type[BaseHeader] default_class: type[_HeaderParser] def __init__( - self, base_class: type[BaseHeader] = ..., default_class: type[_HeaderParser] = ..., use_default_map: bool = ... + self, base_class: type[BaseHeader] = ..., default_class: type[_HeaderParser] = ..., use_default_map: bool = True ) -> None: ... def map_to_type(self, name: str, cls: type[BaseHeader]) -> None: ... def __getitem__(self, name: str) -> type[BaseHeader]: ... @@ -169,7 +169,7 @@ class Address: @property def addr_spec(self) -> str: ... def __init__( - self, display_name: str = ..., username: str | None = ..., domain: str | None = ..., addr_spec: str | None = ... + self, display_name: str = '', username: str | None = '', domain: str | None = '', addr_spec: str | None = None ) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -178,5 +178,5 @@ class Group: def display_name(self) -> str | None: ... @property def addresses(self) -> tuple[Address, ...]: ... - def __init__(self, display_name: str | None = ..., addresses: Iterable[Address] | None = ...) -> None: ... + def __init__(self, display_name: str | None = None, addresses: Iterable[Address] | None = None) -> None: ... def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/email/iterators.pyi b/stdlib/email/iterators.pyi index d964d6843833..67e782c3d436 100644 --- a/stdlib/email/iterators.pyi +++ b/stdlib/email/iterators.pyi @@ -5,7 +5,7 @@ from email.message import Message __all__ = ["body_line_iterator", "typed_subpart_iterator", "walk"] def body_line_iterator(msg: Message, decode: bool = False) -> Iterator[str]: ... -def typed_subpart_iterator(msg: Message, maintype: str = "text", subtype: str | None = None) -> Iterator[str]: ... +def typed_subpart_iterator(msg: Message, maintype: str = 'text', subtype: str | None = None) -> Iterator[str]: ... def walk(self: Message) -> Iterator[Message]: ... # We include the seemingly private function because it is documented in the stdlib documentation. diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 58b1c1cd8f3d..ea339f67833f 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -25,8 +25,8 @@ class Message: def set_unixfrom(self, unixfrom: str) -> None: ... def get_unixfrom(self) -> str | None: ... def attach(self, payload: Message) -> None: ... - def get_payload(self, i: int | None = ..., decode: bool = ...) -> Any: ... # returns _PayloadType | None - def set_payload(self, payload: _PayloadType, charset: _CharsetType = ...) -> None: ... + def get_payload(self, i: int | None = None, decode: bool = False) -> Any: ... # returns _PayloadType | None + def set_payload(self, payload: _PayloadType, charset: _CharsetType = None) -> None: ... def set_charset(self, charset: _CharsetType) -> None: ... def get_charset(self) -> _CharsetType: ... def __len__(self) -> int: ... @@ -38,8 +38,8 @@ class Message: def keys(self) -> list[str]: ... def values(self) -> list[_HeaderType]: ... def items(self) -> list[tuple[str, _HeaderType]]: ... - def get(self, name: str, failobj: _T = ...) -> _HeaderType | _T: ... - def get_all(self, name: str, failobj: _T = ...) -> list[_HeaderType] | _T: ... + def get(self, name: str, failobj: _T = None) -> _HeaderType | _T: ... + def get_all(self, name: str, failobj: _T = None) -> list[_HeaderType] | _T: ... def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ... def replace_header(self, _name: str, _value: _HeaderType) -> None: ... def get_content_type(self) -> str: ... @@ -47,32 +47,32 @@ class Message: def get_content_subtype(self) -> str: ... def get_default_type(self) -> str: ... def set_default_type(self, ctype: str) -> None: ... - def get_params(self, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> list[tuple[str, str]] | _T: ... - def get_param(self, param: str, failobj: _T = ..., header: str = ..., unquote: bool = ...) -> _T | _ParamType: ... - def del_param(self, param: str, header: str = ..., requote: bool = ...) -> None: ... - def set_type(self, type: str, header: str = ..., requote: bool = ...) -> None: ... - def get_filename(self, failobj: _T = ...) -> _T | str: ... - def get_boundary(self, failobj: _T = ...) -> _T | str: ... + def get_params(self, failobj: _T = None, header: str = 'content-type', unquote: bool = True) -> list[tuple[str, str]] | _T: ... + def get_param(self, param: str, failobj: _T = None, header: str = 'content-type', unquote: bool = True) -> _T | _ParamType: ... + def del_param(self, param: str, header: str = 'content-type', requote: bool = True) -> None: ... + def set_type(self, type: str, header: str = 'Content-Type', requote: bool = True) -> None: ... + def get_filename(self, failobj: _T = None) -> _T | str: ... + def get_boundary(self, failobj: _T = None) -> _T | str: ... def set_boundary(self, boundary: str) -> None: ... @overload def get_content_charset(self) -> str | None: ... @overload def get_content_charset(self, failobj: _T) -> str | _T: ... - def get_charsets(self, failobj: _T = ...) -> _T | list[str]: ... + def get_charsets(self, failobj: _T = None) -> _T | list[str]: ... def walk(self: Self) -> Generator[Self, None, None]: ... def get_content_disposition(self) -> str | None: ... - def as_string(self, unixfrom: bool = ..., maxheaderlen: int = ..., policy: Policy | None = ...) -> str: ... - def as_bytes(self, unixfrom: bool = ..., policy: Policy | None = ...) -> bytes: ... + def as_string(self, unixfrom: bool = False, maxheaderlen: int = 0, policy: Policy | None = None) -> str: ... + def as_bytes(self, unixfrom: bool = False, policy: Policy | None = None) -> bytes: ... def __bytes__(self) -> bytes: ... def set_param( self, param: str, value: str, - header: str = ..., - requote: bool = ..., - charset: str | None = ..., - language: str = ..., - replace: bool = ..., + header: str = 'Content-Type', + requote: bool = True, + charset: str | None = None, + language: str = '', + replace: bool = False, ) -> None: ... def __init__(self, policy: Policy = ...) -> None: ... # The following two methods are undocumented, but a source code comment states that they are public API @@ -80,21 +80,21 @@ class Message: def raw_items(self) -> Iterator[tuple[str, _HeaderType]]: ... class MIMEPart(Message): - def __init__(self, policy: Policy | None = ...) -> None: ... + def __init__(self, policy: Policy | None = None) -> None: ... def get_body(self, preferencelist: Sequence[str] = ...) -> Message | None: ... def iter_attachments(self) -> Iterator[Message]: ... def iter_parts(self) -> Iterator[Message]: ... - def get_content(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> Any: ... - def set_content(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ... - def make_related(self, boundary: str | None = ...) -> None: ... - def make_alternative(self, boundary: str | None = ...) -> None: ... - def make_mixed(self, boundary: str | None = ...) -> None: ... + def get_content(self, *args: Any, content_manager: ContentManager | None = None, **kw: Any) -> Any: ... + def set_content(self, *args: Any, content_manager: ContentManager | None = None, **kw: Any) -> None: ... + def make_related(self, boundary: str | None = None) -> None: ... + def make_alternative(self, boundary: str | None = None) -> None: ... + def make_mixed(self, boundary: str | None = None) -> None: ... def add_related(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ... def add_alternative(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ... def add_attachment(self, *args: Any, content_manager: ContentManager | None = ..., **kw: Any) -> None: ... def clear(self) -> None: ... def clear_content(self) -> None: ... - def as_string(self, unixfrom: bool = ..., maxheaderlen: int | None = ..., policy: Policy | None = ...) -> str: ... + def as_string(self, unixfrom: bool = False, maxheaderlen: int | None = None, policy: Policy | None = None) -> str: ... def is_attachment(self) -> bool: ... class EmailMessage(MIMEPart): ... diff --git a/stdlib/email/mime/application.pyi b/stdlib/email/mime/application.pyi index 5ff60bff6ad2..9266687f218b 100644 --- a/stdlib/email/mime/application.pyi +++ b/stdlib/email/mime/application.pyi @@ -9,9 +9,9 @@ class MIMEApplication(MIMENonMultipart): def __init__( self, _data: str | bytes | bytearray, - _subtype: str = ..., + _subtype: str = 'octet-stream', _encoder: Callable[[MIMEApplication], object] = ..., *, - policy: Policy | None = ..., + policy: Policy | None = None, **_params: _ParamsType, ) -> None: ... diff --git a/stdlib/email/mime/audio.pyi b/stdlib/email/mime/audio.pyi index 05e173f5c4a1..090dfb960db6 100644 --- a/stdlib/email/mime/audio.pyi +++ b/stdlib/email/mime/audio.pyi @@ -9,9 +9,9 @@ class MIMEAudio(MIMENonMultipart): def __init__( self, _audiodata: str | bytes | bytearray, - _subtype: str | None = ..., + _subtype: str | None = None, _encoder: Callable[[MIMEAudio], object] = ..., *, - policy: Policy | None = ..., + policy: Policy | None = None, **_params: _ParamsType, ) -> None: ... diff --git a/stdlib/email/mime/base.pyi b/stdlib/email/mime/base.pyi index c8f2fe6db79d..b733709f1b5a 100644 --- a/stdlib/email/mime/base.pyi +++ b/stdlib/email/mime/base.pyi @@ -5,4 +5,4 @@ from email.policy import Policy __all__ = ["MIMEBase"] class MIMEBase(email.message.Message): - def __init__(self, _maintype: str, _subtype: str, *, policy: Policy | None = ..., **_params: _ParamsType) -> None: ... + def __init__(self, _maintype: str, _subtype: str, *, policy: Policy | None = None, **_params: _ParamsType) -> None: ... diff --git a/stdlib/email/mime/image.pyi b/stdlib/email/mime/image.pyi index 7e46b835b541..b47afa6ce592 100644 --- a/stdlib/email/mime/image.pyi +++ b/stdlib/email/mime/image.pyi @@ -9,9 +9,9 @@ class MIMEImage(MIMENonMultipart): def __init__( self, _imagedata: str | bytes | bytearray, - _subtype: str | None = ..., + _subtype: str | None = None, _encoder: Callable[[MIMEImage], object] = ..., *, - policy: Policy | None = ..., + policy: Policy | None = None, **_params: _ParamsType, ) -> None: ... diff --git a/stdlib/email/mime/message.pyi b/stdlib/email/mime/message.pyi index 9e7cd04b6e77..4e21fbae7934 100644 --- a/stdlib/email/mime/message.pyi +++ b/stdlib/email/mime/message.pyi @@ -5,4 +5,4 @@ from email.policy import Policy __all__ = ["MIMEMessage"] class MIMEMessage(MIMENonMultipart): - def __init__(self, _msg: Message, _subtype: str = ..., *, policy: Policy | None = ...) -> None: ... + def __init__(self, _msg: Message, _subtype: str = 'rfc822', *, policy: Policy | None = None) -> None: ... diff --git a/stdlib/email/mime/multipart.pyi b/stdlib/email/mime/multipart.pyi index 6cd480ccf0a4..7beffbf61c3b 100644 --- a/stdlib/email/mime/multipart.pyi +++ b/stdlib/email/mime/multipart.pyi @@ -9,10 +9,10 @@ __all__ = ["MIMEMultipart"] class MIMEMultipart(MIMEBase): def __init__( self, - _subtype: str = ..., - boundary: str | None = ..., - _subparts: Sequence[Message] | None = ..., + _subtype: str = 'mixed', + boundary: str | None = None, + _subparts: Sequence[Message] | None = None, *, - policy: Policy | None = ..., + policy: Policy | None = None, **_params: _ParamsType, ) -> None: ... diff --git a/stdlib/email/mime/text.pyi b/stdlib/email/mime/text.pyi index 9672c3b717b2..13308597c293 100644 --- a/stdlib/email/mime/text.pyi +++ b/stdlib/email/mime/text.pyi @@ -4,4 +4,4 @@ from email.policy import Policy __all__ = ["MIMEText"] class MIMEText(MIMENonMultipart): - def __init__(self, _text: str, _subtype: str = ..., _charset: str | None = ..., *, policy: Policy | None = ...) -> None: ... + def __init__(self, _text: str, _subtype: str = 'plain', _charset: str | None = None, *, policy: Policy | None = None) -> None: ... diff --git a/stdlib/email/parser.pyi b/stdlib/email/parser.pyi index 1afd8940f4ef..6224624c8b17 100644 --- a/stdlib/email/parser.pyi +++ b/stdlib/email/parser.pyi @@ -7,15 +7,15 @@ from typing import BinaryIO, TextIO __all__ = ["Parser", "HeaderParser", "BytesParser", "BytesHeaderParser", "FeedParser", "BytesFeedParser"] class Parser: - def __init__(self, _class: Callable[[], Message] | None = ..., *, policy: Policy = ...) -> None: ... - def parse(self, fp: TextIO, headersonly: bool = ...) -> Message: ... - def parsestr(self, text: str, headersonly: bool = ...) -> Message: ... + def __init__(self, _class: Callable[[], Message] | None = None, *, policy: Policy = ...) -> None: ... + def parse(self, fp: TextIO, headersonly: bool = False) -> Message: ... + def parsestr(self, text: str, headersonly: bool = False) -> Message: ... class HeaderParser(Parser): ... class BytesParser: def __init__(self, _class: Callable[[], Message] = ..., *, policy: Policy = ...) -> None: ... - def parse(self, fp: BinaryIO, headersonly: bool = ...) -> Message: ... - def parsebytes(self, text: bytes | bytearray, headersonly: bool = ...) -> Message: ... + def parse(self, fp: BinaryIO, headersonly: bool = False) -> Message: ... + def parsebytes(self, text: bytes | bytearray, headersonly: bool = False) -> Message: ... class BytesHeaderParser(BytesParser): ... diff --git a/stdlib/email/quoprimime.pyi b/stdlib/email/quoprimime.pyi index 87d08eecc70c..2e38d8313a87 100644 --- a/stdlib/email/quoprimime.pyi +++ b/stdlib/email/quoprimime.pyi @@ -19,9 +19,9 @@ def header_length(bytearray: Iterable[int]) -> int: ... def body_length(bytearray: Iterable[int]) -> int: ... def unquote(s: str | bytes | bytearray) -> str: ... def quote(c: str | bytes | bytearray) -> str: ... -def header_encode(header_bytes: bytes | bytearray, charset: str = "iso-8859-1") -> str: ... -def body_encode(body: str, maxlinelen: int = 76, eol: str = "\n") -> str: ... -def decode(encoded: str, eol: str = "\n") -> str: ... +def header_encode(header_bytes: bytes | bytearray, charset: str = 'iso-8859-1') -> str: ... +def body_encode(body: str, maxlinelen: int = 76, eol: str = '\n') -> str: ... +def decode(encoded: str, eol: str = '\n') -> str: ... def header_decode(s: str) -> str: ... body_decode = decode diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index 97838343b1c5..e30673472efc 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -28,7 +28,7 @@ _PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None def quote(str: str) -> str: ... def unquote(str: str) -> str: ... def parseaddr(addr: str | None) -> tuple[str, str]: ... -def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") -> str: ... +def formataddr(pair: tuple[str | None, str], charset: str | Charset = 'utf-8') -> str: ... def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... @overload def parsedate(data: None) -> None: ... @@ -51,9 +51,9 @@ else: def mktime_tz(data: _PDTZ) -> int: ... def formatdate(timeval: float | None = None, localtime: bool = False, usegmt: bool = False) -> str: ... def format_datetime(dt: datetime.datetime, usegmt: bool = False) -> str: ... -def localtime(dt: datetime.datetime | None = None, isdst: int = ...) -> datetime.datetime: ... +def localtime(dt: datetime.datetime | None = None, isdst: int = -1) -> datetime.datetime: ... def make_msgid(idstring: str | None = None, domain: str | None = None) -> str: ... def decode_rfc2231(s: str) -> tuple[str | None, str | None, str]: ... def encode_rfc2231(s: str, charset: str | None = None, language: str | None = None) -> str: ... -def collapse_rfc2231_value(value: _ParamType, errors: str = "replace", fallback_charset: str = "us-ascii") -> str: ... +def collapse_rfc2231_value(value: _ParamType, errors: str = 'replace', fallback_charset: str = 'us-ascii') -> str: ... def decode_params(params: list[tuple[str, str]]) -> list[tuple[str, _ParamType]]: ... diff --git a/stdlib/encodings/utf_8.pyi b/stdlib/encodings/utf_8.pyi index 6b2168688b80..82503e0aa4f7 100644 --- a/stdlib/encodings/utf_8.pyi +++ b/stdlib/encodings/utf_8.pyi @@ -2,7 +2,7 @@ import codecs from _typeshed import ReadableBuffer class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input: str, final: bool = ...) -> bytes: ... + def encode(self, input: str, final: bool = False) -> bytes: ... class IncrementalDecoder(codecs.BufferedIncrementalDecoder): @staticmethod @@ -18,4 +18,4 @@ class StreamReader(codecs.StreamReader): def getregentry() -> codecs.CodecInfo: ... def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... +def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... diff --git a/stdlib/encodings/utf_8_sig.pyi b/stdlib/encodings/utf_8_sig.pyi index 8b1c38f18a1c..9db6334de1b4 100644 --- a/stdlib/encodings/utf_8_sig.pyi +++ b/stdlib/encodings/utf_8_sig.pyi @@ -2,21 +2,21 @@ import codecs from _typeshed import ReadableBuffer class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors: str = ...) -> None: ... - def encode(self, input: str, final: bool = ...) -> bytes: ... + def __init__(self, errors: str = 'strict') -> None: ... + def encode(self, input: str, final: bool = False) -> bytes: ... def getstate(self) -> int: ... # type: ignore[override] def setstate(self, state: int) -> None: ... # type: ignore[override] class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def __init__(self, errors: str = ...) -> None: ... + def __init__(self, errors: str = 'strict') -> None: ... def _buffer_decode(self, input: ReadableBuffer, errors: str | None, final: bool) -> tuple[str, int]: ... class StreamWriter(codecs.StreamWriter): - def encode(self, input: str, errors: str | None = ...) -> tuple[bytes, int]: ... + def encode(self, input: str, errors: str | None = 'strict') -> tuple[bytes, int]: ... class StreamReader(codecs.StreamReader): - def decode(self, input: ReadableBuffer, errors: str | None = ...) -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... def getregentry() -> codecs.CodecInfo: ... -def encode(input: str, errors: str | None = "strict") -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... +def encode(input: str, errors: str | None = 'strict') -> tuple[bytes, int]: ... +def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 24d370bb2ba3..c7b6060739b0 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -112,7 +112,7 @@ class EnumMeta(ABCMeta): def __dir__(self) -> list[str]: ... # Simple value lookup @overload # type: ignore[override] - def __call__(cls: type[_EnumMemberT], value: Any, names: None = ...) -> _EnumMemberT: ... + def __call__(cls: type[_EnumMemberT], value: Any, names: None = None) -> _EnumMemberT: ... # Functional Enum API if sys.version_info >= (3, 11): @overload diff --git a/stdlib/filecmp.pyi b/stdlib/filecmp.pyi index 1555b2b8921a..008d7a44e6c4 100644 --- a/stdlib/filecmp.pyi +++ b/stdlib/filecmp.pyi @@ -22,8 +22,8 @@ class dircmp(Generic[AnyStr]): self, a: GenericPath[AnyStr], b: GenericPath[AnyStr], - ignore: Sequence[AnyStr] | None = ..., - hide: Sequence[AnyStr] | None = ..., + ignore: Sequence[AnyStr] | None = None, + hide: Sequence[AnyStr] | None = None, ) -> None: ... left: AnyStr right: AnyStr diff --git a/stdlib/fractions.pyi b/stdlib/fractions.pyi index e05f59e3d191..95e4aad0f9ca 100644 --- a/stdlib/fractions.pyi +++ b/stdlib/fractions.pyi @@ -24,15 +24,15 @@ else: class Fraction(Rational): @overload def __new__( - cls: type[Self], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ... + cls: type[Self], numerator: int | Rational = 0, denominator: int | Rational | None = None, *, _normalize: bool = True ) -> Self: ... @overload - def __new__(cls: type[Self], __value: float | Decimal | str, *, _normalize: bool = ...) -> Self: ... + def __new__(cls: type[Self], __value: float | Decimal | str, *, _normalize: bool = True) -> Self: ... @classmethod def from_float(cls: type[Self], f: float) -> Self: ... @classmethod def from_decimal(cls: type[Self], dec: Decimal) -> Self: ... - def limit_denominator(self, max_denominator: int = ...) -> Fraction: ... + def limit_denominator(self, max_denominator: int = 1000000) -> Fraction: ... if sys.version_info >= (3, 8): def as_integer_ratio(self) -> tuple[int, int]: ... @@ -129,7 +129,7 @@ class Fraction(Rational): def __floor__(a) -> int: ... def __ceil__(a) -> int: ... @overload - def __round__(self, ndigits: None = ...) -> int: ... + def __round__(self, ndigits: None = None) -> int: ... @overload def __round__(self, ndigits: int) -> Fraction: ... def __hash__(self) -> int: ... diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 2aaf6cb2c173..495938c75b48 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -65,7 +65,7 @@ class FTP: ) -> None: ... def connect( - self, host: str = ..., port: int = ..., timeout: float = ..., source_address: tuple[str, int] | None = ... + self, host: str = '', port: int = 0, timeout: float = -999, source_address: tuple[str, int] | None = None ) -> str: ... def getwelcome(self) -> str: ... def set_debuglevel(self, level: int) -> None: ... @@ -85,28 +85,28 @@ class FTP: def sendeprt(self, host: str, port: int) -> str: ... def makeport(self) -> socket: ... def makepasv(self) -> tuple[str, int]: ... - def login(self, user: str = ..., passwd: str = ..., acct: str = ...) -> str: ... + def login(self, user: str = '', passwd: str = '', acct: str = '') -> str: ... # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers. - def ntransfercmd(self, cmd: str, rest: int | str | None = ...) -> tuple[socket, int]: ... - def transfercmd(self, cmd: str, rest: int | str | None = ...) -> socket: ... + def ntransfercmd(self, cmd: str, rest: int | str | None = None) -> tuple[socket, int]: ... + def transfercmd(self, cmd: str, rest: int | str | None = None) -> socket: ... def retrbinary( - self, cmd: str, callback: Callable[[bytes], object], blocksize: int = ..., rest: int | str | None = ... + self, cmd: str, callback: Callable[[bytes], object], blocksize: int = 8192, rest: int | str | None = None ) -> str: ... def storbinary( self, cmd: str, fp: SupportsRead[bytes], - blocksize: int = ..., - callback: Callable[[bytes], object] | None = ..., - rest: int | str | None = ..., + blocksize: int = 8192, + callback: Callable[[bytes], object] | None = None, + rest: int | str | None = None, ) -> str: ... - def retrlines(self, cmd: str, callback: Callable[[str], object] | None = ...) -> str: ... - def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], object] | None = ...) -> str: ... + def retrlines(self, cmd: str, callback: Callable[[str], object] | None = None) -> str: ... + def storlines(self, cmd: str, fp: SupportsReadline[bytes], callback: Callable[[bytes], object] | None = None) -> str: ... def acct(self, password: str) -> str: ... def nlst(self, *args: str) -> list[str]: ... # Technically only the last arg can be a Callable but ... def dir(self, *args: str | Callable[[str], object]) -> None: ... - def mlsd(self, path: str = ..., facts: Iterable[str] = ...) -> Iterator[tuple[str, dict[str, str]]]: ... + def mlsd(self, path: str = '', facts: Iterable[str] = ...) -> Iterator[tuple[str, dict[str, str]]]: ... def rename(self, fromname: str, toname: str) -> str: ... def delete(self, filename: str) -> str: ... def cwd(self, dirname: str) -> str: ... @@ -150,7 +150,7 @@ class FTP_TLS(FTP): keyfile: str | None certfile: str | None context: SSLContext - def login(self, user: str = ..., passwd: str = ..., acct: str = ..., secure: bool = ...) -> str: ... + def login(self, user: str = '', passwd: str = '', acct: str = '', secure: bool = True) -> str: ... def auth(self) -> str: ... def prot_p(self) -> str: ... def prot_c(self) -> str: ... @@ -161,5 +161,5 @@ def parse227(resp: str) -> tuple[str, int]: ... # undocumented def parse229(resp: str, peer: Any) -> tuple[str, int]: ... # undocumented def parse257(resp: str) -> str: ... # undocumented def ftpcp( - source: FTP, sourcename: str, target: FTP, targetname: str = "", type: Literal["A", "I"] = "I" + source: FTP, sourcename: str, target: FTP, targetname: str = '', type: Literal["A", "I"] = 'I' ) -> None: ... # undocumented diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index d317fa208b1c..033aacd03990 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -60,7 +60,7 @@ if sys.version_info >= (3, 8): def lru_cache(maxsize: Callable[..., _T], typed: bool = ...) -> _lru_cache_wrapper[_T]: ... else: - def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ... + def lru_cache(maxsize: int | None = ..., typed: bool = ...) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ... WRAPPER_ASSIGNMENTS: tuple[ Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"], @@ -132,21 +132,21 @@ if sys.version_info >= (3, 8): @property def __isabstractmethod__(self) -> bool: ... @overload - def register(self, cls: type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + def register(self, cls: type[Any], method: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... @overload - def register(self, cls: Callable[..., _T], method: None = ...) -> Callable[..., _T]: ... + def register(self, cls: Callable[..., _T], method: None = None) -> Callable[..., _T]: ... @overload def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ... - def __get__(self, obj: _S, cls: type[_S] | None = ...) -> Callable[..., _T]: ... + def __get__(self, obj: _S, cls: type[_S] | None = None) -> Callable[..., _T]: ... class cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: type[Any] | None = ...) -> cached_property[_T]: ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> cached_property[_T]: ... @overload - def __get__(self, instance: object, owner: type[Any] | None = ...) -> _T: ... + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... def __set_name__(self, owner: type[Any], name: str) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... diff --git a/stdlib/getopt.pyi b/stdlib/getopt.pyi index 42ddb1cb7020..6b7c6a33f017 100644 --- a/stdlib/getopt.pyi +++ b/stdlib/getopt.pyi @@ -6,6 +6,6 @@ def gnu_getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tu class GetoptError(Exception): msg: str opt: str - def __init__(self, msg: str, opt: str = ...) -> None: ... + def __init__(self, msg: str, opt: str = '') -> None: ... error = GetoptError diff --git a/stdlib/getpass.pyi b/stdlib/getpass.pyi index 6104e0dedfee..bfa48bdcab18 100644 --- a/stdlib/getpass.pyi +++ b/stdlib/getpass.pyi @@ -2,7 +2,7 @@ from typing import TextIO __all__ = ["getpass", "getuser", "GetPassWarning"] -def getpass(prompt: str = "Password: ", stream: TextIO | None = None) -> str: ... +def getpass(prompt: str = 'Password: ', stream: TextIO | None = None) -> str: ... def getuser() -> str: ... class GetPassWarning(UserWarning): ... diff --git a/stdlib/gettext.pyi b/stdlib/gettext.pyi index 21f8e7747604..83cf65dcb61c 100644 --- a/stdlib/gettext.pyi +++ b/stdlib/gettext.pyi @@ -32,7 +32,7 @@ class _TranslationsReader(Protocol): # name: str class NullTranslations: - def __init__(self, fp: _TranslationsReader | None = ...) -> None: ... + def __init__(self, fp: _TranslationsReader | None = None) -> None: ... def _parse(self, fp: _TranslationsReader) -> None: ... def add_fallback(self, fallback: NullTranslations) -> None: ... def gettext(self, message: str) -> str: ... @@ -49,7 +49,7 @@ class NullTranslations: def lgettext(self, message: str) -> str: ... def lngettext(self, msgid1: str, msgid2: str, n: int) -> str: ... - def install(self, names: Container[str] | None = ...) -> None: ... + def install(self, names: Container[str] | None = None) -> None: ... class GNUTranslations(NullTranslations): LE_MAGIC: Final[int] @@ -145,7 +145,7 @@ else: codeset: str | None = ..., ) -> NullTranslations: ... def install( - domain: str, localedir: StrPath | None = None, codeset: str | None = ..., names: Container[str] | None = None + domain: str, localedir: StrPath | None = ..., codeset: str | None = ..., names: Container[str] | None = ... ) -> None: ... def textdomain(domain: str | None = None) -> str: ... diff --git a/stdlib/glob.pyi b/stdlib/glob.pyi index 914ccc12ef1e..d6c885d70792 100644 --- a/stdlib/glob.pyi +++ b/stdlib/glob.pyi @@ -28,15 +28,15 @@ if sys.version_info >= (3, 11): elif sys.version_info >= (3, 10): def glob( - pathname: AnyStr, *, root_dir: StrOrBytesPath | None = None, dir_fd: int | None = None, recursive: bool = False + pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ... ) -> list[AnyStr]: ... def iglob( - pathname: AnyStr, *, root_dir: StrOrBytesPath | None = None, dir_fd: int | None = None, recursive: bool = False + pathname: AnyStr, *, root_dir: StrOrBytesPath | None = ..., dir_fd: int | None = ..., recursive: bool = ... ) -> Iterator[AnyStr]: ... else: - def glob(pathname: AnyStr, *, recursive: bool = False) -> list[AnyStr]: ... - def iglob(pathname: AnyStr, *, recursive: bool = False) -> Iterator[AnyStr]: ... + def glob(pathname: AnyStr, *, recursive: bool = ...) -> list[AnyStr]: ... + def iglob(pathname: AnyStr, *, recursive: bool = ...) -> Iterator[AnyStr]: ... def escape(pathname: AnyStr) -> AnyStr: ... def has_magic(s: str | bytes) -> bool: ... # undocumented diff --git a/stdlib/graphlib.pyi b/stdlib/graphlib.pyi index 4c6959decc4b..c02d447ad501 100644 --- a/stdlib/graphlib.pyi +++ b/stdlib/graphlib.pyi @@ -12,7 +12,7 @@ if sys.version_info >= (3, 11): class TopologicalSorter(Generic[_T]): @overload - def __init__(self, graph: None = ...) -> None: ... + def __init__(self, graph: None = None) -> None: ... @overload def __init__(self, graph: SupportsItems[_T, Iterable[_T]]) -> None: ... def add(self, node: _T, *predecessors: _T) -> None: ... diff --git a/stdlib/gzip.pyi b/stdlib/gzip.pyi index 3553f0a77239..aaa3b79cd35b 100644 --- a/stdlib/gzip.pyi +++ b/stdlib/gzip.pyi @@ -99,45 +99,45 @@ class GzipFile(_compression.BaseStream): self, filename: StrOrBytesPath | None, mode: _ReadBinaryMode, - compresslevel: int = ..., - fileobj: _ReadableFileobj | None = ..., - mtime: float | None = ..., + compresslevel: int = 9, + fileobj: _ReadableFileobj | None = None, + mtime: float | None = None, ) -> None: ... @overload def __init__( self, *, mode: _ReadBinaryMode, - compresslevel: int = ..., - fileobj: _ReadableFileobj | None = ..., - mtime: float | None = ..., + compresslevel: int = 9, + fileobj: _ReadableFileobj | None = None, + mtime: float | None = None, ) -> None: ... @overload def __init__( self, filename: StrOrBytesPath | None, mode: _WriteBinaryMode, - compresslevel: int = ..., - fileobj: _WritableFileobj | None = ..., - mtime: float | None = ..., + compresslevel: int = 9, + fileobj: _WritableFileobj | None = None, + mtime: float | None = None, ) -> None: ... @overload def __init__( self, *, mode: _WriteBinaryMode, - compresslevel: int = ..., - fileobj: _WritableFileobj | None = ..., - mtime: float | None = ..., + compresslevel: int = 9, + fileobj: _WritableFileobj | None = None, + mtime: float | None = None, ) -> None: ... @overload def __init__( self, - filename: StrOrBytesPath | None = ..., - mode: str | None = ..., - compresslevel: int = ..., - fileobj: _ReadableFileobj | _WritableFileobj | None = ..., - mtime: float | None = ..., + filename: StrOrBytesPath | None = None, + mode: str | None = None, + compresslevel: int = 9, + fileobj: _ReadableFileobj | _WritableFileobj | None = None, + mtime: float | None = None, ) -> None: ... @property def filename(self) -> str: ... @@ -145,15 +145,15 @@ class GzipFile(_compression.BaseStream): def mtime(self) -> int | None: ... crc: int def write(self, data: ReadableBuffer) -> int: ... - def read(self, size: int | None = ...) -> bytes: ... - def read1(self, size: int = ...) -> bytes: ... + def read(self, size: int | None = -1) -> bytes: ... + def read1(self, size: int = -1) -> bytes: ... def peek(self, n: int) -> bytes: ... def close(self) -> None: ... - def flush(self, zlib_mode: int = ...) -> None: ... + def flush(self, zlib_mode: int = 2) -> None: ... def fileno(self) -> int: ... def rewind(self) -> None: ... - def seek(self, offset: int, whence: int = ...) -> int: ... - def readline(self, size: int | None = ...) -> bytes: ... + def seek(self, offset: int, whence: int = 0) -> int: ... + def readline(self, size: int | None = -1) -> bytes: ... class _GzipReader(_compression.DecompressReader): def __init__(self, fp: _ReadableFileobj) -> None: ... @@ -162,6 +162,6 @@ if sys.version_info >= (3, 8): def compress(data: _BufferWithLen, compresslevel: int = 9, *, mtime: float | None = None) -> bytes: ... else: - def compress(data: _BufferWithLen, compresslevel: int = 9) -> bytes: ... + def compress(data: _BufferWithLen, compresslevel: int = ...) -> bytes: ... def decompress(data: ReadableBuffer) -> bytes: ... diff --git a/stdlib/hmac.pyi b/stdlib/hmac.pyi index 68ea0d60280b..cbb13e844e55 100644 --- a/stdlib/hmac.pyi +++ b/stdlib/hmac.pyi @@ -23,14 +23,14 @@ if sys.version_info >= (3, 8): def new(key: bytes | bytearray, *, digestmod: _DigestMod) -> HMAC: ... else: - def new(key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod | None = ...) -> HMAC: ... + def new(key: bytes | bytearray, msg: ReadableBuffer | None = ..., digestmod: _DigestMod | None = ...) -> HMAC: ... class HMAC: digest_size: int block_size: int @property def name(self) -> str: ... - def __init__(self, key: bytes | bytearray, msg: ReadableBuffer | None = ..., digestmod: _DigestMod = ...) -> None: ... + def __init__(self, key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod = '') -> None: ... def update(self, msg: ReadableBuffer) -> None: ... def digest(self) -> bytes: ... def hexdigest(self) -> str: ... diff --git a/stdlib/html/parser.pyi b/stdlib/html/parser.pyi index 6dde9f705978..d322ade965d9 100644 --- a/stdlib/html/parser.pyi +++ b/stdlib/html/parser.pyi @@ -4,7 +4,7 @@ from re import Pattern __all__ = ["HTMLParser"] class HTMLParser(ParserBase): - def __init__(self, *, convert_charrefs: bool = ...) -> None: ... + def __init__(self, *, convert_charrefs: bool = True) -> None: ... def feed(self, data: str) -> None: ... def close(self) -> None: ... def get_starttag_text(self) -> str | None: ... diff --git a/stdlib/http/client.pyi b/stdlib/http/client.pyi index 53cefc0a33d1..bb641875e55b 100644 --- a/stdlib/http/client.pyi +++ b/stdlib/http/client.pyi @@ -114,12 +114,12 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): chunk_left: int | None length: int | None will_close: bool - def __init__(self, sock: socket, debuglevel: int = ..., method: str | None = ..., url: str | None = ...) -> None: ... - def peek(self, n: int = ...) -> bytes: ... - def read(self, amt: int | None = ...) -> bytes: ... - def read1(self, n: int = ...) -> bytes: ... + def __init__(self, sock: socket, debuglevel: int = 0, method: str | None = None, url: str | None = None) -> None: ... + def peek(self, n: int = -1) -> bytes: ... + def read(self, amt: int | None = None) -> bytes: ... + def read1(self, n: int = -1) -> bytes: ... def readinto(self, b: WriteableBuffer) -> int: ... - def readline(self, limit: int = ...) -> bytes: ... # type: ignore[override] + def readline(self, limit: int = -1) -> bytes: ... # type: ignore[override] @overload def getheader(self, name: str) -> str | None: ... @overload @@ -148,28 +148,28 @@ class HTTPConnection: def __init__( self, host: str, - port: int | None = ..., + port: int | None = None, timeout: float | None = ..., - source_address: tuple[str, int] | None = ..., - blocksize: int = ..., + source_address: tuple[str, int] | None = None, + blocksize: int = 8192, ) -> None: ... def request( self, method: str, url: str, - body: _DataType | str | None = ..., + body: _DataType | str | None = None, headers: Mapping[str, str] = ..., *, - encode_chunked: bool = ..., + encode_chunked: bool = False, ) -> None: ... def getresponse(self) -> HTTPResponse: ... def set_debuglevel(self, level: int) -> None: ... - def set_tunnel(self, host: str, port: int | None = ..., headers: Mapping[str, str] | None = ...) -> None: ... + def set_tunnel(self, host: str, port: int | None = None, headers: Mapping[str, str] | None = None) -> None: ... def connect(self) -> None: ... def close(self) -> None: ... - def putrequest(self, method: str, url: str, skip_host: bool = ..., skip_accept_encoding: bool = ...) -> None: ... + def putrequest(self, method: str, url: str, skip_host: bool = False, skip_accept_encoding: bool = False) -> None: ... def putheader(self, header: str, *argument: str) -> None: ... - def endheaders(self, message_body: _DataType | None = ..., *, encode_chunked: bool = ...) -> None: ... + def endheaders(self, message_body: _DataType | None = None, *, encode_chunked: bool = False) -> None: ... def send(self, data: _DataType | str) -> None: ... class HTTPSConnection(HTTPConnection): @@ -178,15 +178,15 @@ class HTTPSConnection(HTTPConnection): def __init__( self, host: str, - port: int | None = ..., - key_file: str | None = ..., - cert_file: str | None = ..., + port: int | None = None, + key_file: str | None = None, + cert_file: str | None = None, timeout: float | None = ..., - source_address: tuple[str, int] | None = ..., + source_address: tuple[str, int] | None = None, *, - context: ssl.SSLContext | None = ..., - check_hostname: bool | None = ..., - blocksize: int = ..., + context: ssl.SSLContext | None = None, + check_hostname: bool | None = None, + blocksize: int = 8192, ) -> None: ... class HTTPException(Exception): ... @@ -203,7 +203,7 @@ class UnknownTransferEncoding(HTTPException): ... class UnimplementedFileMode(HTTPException): ... class IncompleteRead(HTTPException): - def __init__(self, partial: bytes, expected: int | None = ...) -> None: ... + def __init__(self, partial: bytes, expected: int | None = None) -> None: ... partial: bytes expected: int | None diff --git a/stdlib/http/cookiejar.pyi b/stdlib/http/cookiejar.pyi index dc3c0e17d336..9196c4ef0570 100644 --- a/stdlib/http/cookiejar.pyi +++ b/stdlib/http/cookiejar.pyi @@ -28,14 +28,14 @@ class CookieJar(Iterable[Cookie]): domain_re: ClassVar[Pattern[str]] # undocumented dots_re: ClassVar[Pattern[str]] # undocumented magic_re: ClassVar[Pattern[str]] # undocumented - def __init__(self, policy: CookiePolicy | None = ...) -> None: ... + def __init__(self, policy: CookiePolicy | None = None) -> None: ... def add_cookie_header(self, request: Request) -> None: ... def extract_cookies(self, response: HTTPResponse, request: Request) -> None: ... def set_policy(self, policy: CookiePolicy) -> None: ... def make_cookies(self, response: HTTPResponse, request: Request) -> Sequence[Cookie]: ... def set_cookie(self, cookie: Cookie) -> None: ... def set_cookie_if_ok(self, cookie: Cookie, request: Request) -> None: ... - def clear(self, domain: str | None = ..., path: str | None = ..., name: str | None = ...) -> None: ... + def clear(self, domain: str | None = None, path: str | None = None, name: str | None = None) -> None: ... def clear_session_cookies(self) -> None: ... def clear_expired_cookies(self) -> None: ... # undocumented def __iter__(self) -> Iterator[Cookie]: ... @@ -49,16 +49,16 @@ class FileCookieJar(CookieJar): else: def __init__(self, filename: str | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ... - def save(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... - def load(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... - def revert(self, filename: str | None = ..., ignore_discard: bool = ..., ignore_expires: bool = ...) -> None: ... + def save(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ... + def load(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ... + def revert(self, filename: str | None = None, ignore_discard: bool = False, ignore_expires: bool = False) -> None: ... class MozillaCookieJar(FileCookieJar): if sys.version_info < (3, 10): header: ClassVar[str] # undocumented class LWPCookieJar(FileCookieJar): - def as_lwp_str(self, ignore_discard: bool = ..., ignore_expires: bool = ...) -> str: ... # undocumented + def as_lwp_str(self, ignore_discard: bool = True, ignore_expires: bool = True) -> str: ... # undocumented class CookiePolicy: netscape: bool @@ -170,7 +170,7 @@ class Cookie: comment: str | None, comment_url: str | None, rest: dict[str, str], - rfc2109: bool = ..., + rfc2109: bool = False, ) -> None: ... def has_nonstandard_attr(self, name: str) -> bool: ... @overload @@ -178,4 +178,4 @@ class Cookie: @overload def get_nonstandard_attr(self, name: str, default: _T) -> str | _T: ... def set_nonstandard_attr(self, name: str, value: str) -> None: ... - def is_expired(self, now: int | None = ...) -> bool: ... + def is_expired(self, now: int | None = None) -> bool: ... diff --git a/stdlib/http/cookies.pyi b/stdlib/http/cookies.pyi index e2fe44d305ef..2a9dd61fb35a 100644 --- a/stdlib/http/cookies.pyi +++ b/stdlib/http/cookies.pyi @@ -31,29 +31,29 @@ class Morsel(dict[str, Any], Generic[_T]): def key(self) -> str: ... def __init__(self) -> None: ... def set(self, key: str, val: str, coded_val: _T) -> None: ... - def setdefault(self, key: str, val: str | None = ...) -> str: ... + def setdefault(self, key: str, val: str | None = None) -> str: ... # The dict update can also get a keywords argument so this is incompatible @overload # type: ignore[override] def update(self, values: Mapping[str, str]) -> None: ... @overload def update(self, values: Iterable[tuple[str, str]]) -> None: ... def isReservedKey(self, K: str) -> bool: ... - def output(self, attrs: list[str] | None = ..., header: str = ...) -> str: ... + def output(self, attrs: list[str] | None = None, header: str = 'Set-Cookie:') -> str: ... __str__ = output - def js_output(self, attrs: list[str] | None = ...) -> str: ... - def OutputString(self, attrs: list[str] | None = ...) -> str: ... + def js_output(self, attrs: list[str] | None = None) -> str: ... + def OutputString(self, attrs: list[str] | None = None) -> str: ... def __eq__(self, morsel: object) -> bool: ... def __setitem__(self, K: str, V: Any) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... class BaseCookie(dict[str, Morsel[_T]], Generic[_T]): - def __init__(self, input: _DataType | None = ...) -> None: ... + def __init__(self, input: _DataType | None = None) -> None: ... def value_decode(self, val: str) -> _T: ... def value_encode(self, val: _T) -> str: ... - def output(self, attrs: list[str] | None = ..., header: str = ..., sep: str = ...) -> str: ... + def output(self, attrs: list[str] | None = None, header: str = 'Set-Cookie:', sep: str = '\r\n') -> str: ... __str__ = output - def js_output(self, attrs: list[str] | None = ...) -> str: ... + def js_output(self, attrs: list[str] | None = None) -> str: ... def load(self, rawdata: _DataType) -> None: ... def __setitem__(self, key: str, value: str | Morsel[_T]) -> None: ... diff --git a/stdlib/http/server.pyi b/stdlib/http/server.pyi index 04ac28c3278e..9d6f526235d5 100644 --- a/stdlib/http/server.pyi +++ b/stdlib/http/server.pyi @@ -35,17 +35,17 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): monthname: ClassVar[Sequence[str | None]] # undocumented def handle_one_request(self) -> None: ... def handle_expect_100(self) -> bool: ... - def send_error(self, code: int, message: str | None = ..., explain: str | None = ...) -> None: ... - def send_response(self, code: int, message: str | None = ...) -> None: ... + def send_error(self, code: int, message: str | None = None, explain: str | None = None) -> None: ... + def send_response(self, code: int, message: str | None = None) -> None: ... def send_header(self, keyword: str, value: str) -> None: ... - def send_response_only(self, code: int, message: str | None = ...) -> None: ... + def send_response_only(self, code: int, message: str | None = None) -> None: ... def end_headers(self) -> None: ... def flush_headers(self) -> None: ... - def log_request(self, code: int | str = ..., size: int | str = ...) -> None: ... + def log_request(self, code: int | str = '-', size: int | str = '-') -> None: ... def log_error(self, format: str, *args: Any) -> None: ... def log_message(self, format: str, *args: Any) -> None: ... def version_string(self) -> str: ... - def date_time_string(self, timestamp: int | None = ...) -> str: ... + def date_time_string(self, timestamp: int | None = None) -> str: ... def log_date_time_string(self) -> str: ... def address_string(self) -> str: ... def parse_request(self) -> bool: ... # undocumented @@ -60,7 +60,7 @@ class SimpleHTTPRequestHandler(BaseHTTPRequestHandler): client_address: _socket._RetAddress, server: socketserver.BaseServer, *, - directory: str | None = ..., + directory: str | None = None, ) -> None: ... def do_GET(self) -> None: ... def do_HEAD(self) -> None: ... diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index f13e1c9b656c..035b4c32306f 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -77,11 +77,11 @@ class IMAP4: def getannotation(self, mailbox: str, entry: str, attribute: str) -> _CommandResults: ... def getquota(self, root: str) -> _CommandResults: ... def getquotaroot(self, mailbox: str) -> _CommandResults: ... - def list(self, directory: str = ..., pattern: str = ...) -> tuple[str, _AnyResponseData]: ... + def list(self, directory: str = '""', pattern: str = '*') -> tuple[str, _AnyResponseData]: ... def login(self, user: str, password: str) -> tuple[Literal["OK"], _list[bytes]]: ... def login_cram_md5(self, user: str, password: str) -> _CommandResults: ... def logout(self) -> tuple[str, _AnyResponseData]: ... - def lsub(self, directory: str = ..., pattern: str = ...) -> _CommandResults: ... + def lsub(self, directory: str = '""', pattern: str = '*') -> _CommandResults: ... def myrights(self, mailbox: str) -> _CommandResults: ... def namespace(self) -> _CommandResults: ... def noop(self) -> tuple[str, _list[bytes]]: ... @@ -89,12 +89,12 @@ class IMAP4: def proxyauth(self, user: str) -> _CommandResults: ... def rename(self, oldmailbox: str, newmailbox: str) -> _CommandResults: ... def search(self, charset: str | None, *criteria: str) -> _CommandResults: ... - def select(self, mailbox: str = ..., readonly: bool = ...) -> tuple[str, _list[bytes | None]]: ... + def select(self, mailbox: str = 'INBOX', readonly: bool = False) -> tuple[str, _list[bytes | None]]: ... def setacl(self, mailbox: str, who: str, what: str) -> _CommandResults: ... def setannotation(self, *args: str) -> _CommandResults: ... def setquota(self, root: str, limits: str) -> _CommandResults: ... def sort(self, sort_criteria: str, charset: str, *search_criteria: str) -> _CommandResults: ... - def starttls(self, ssl_context: Any | None = ...) -> tuple[Literal["OK"], _list[None]]: ... + def starttls(self, ssl_context: Any | None = None) -> tuple[Literal["OK"], _list[None]]: ... def status(self, mailbox: str, names: str) -> _CommandResults: ... def store(self, message_set: str, command: str, flags: str) -> _CommandResults: ... def subscribe(self, mailbox: str) -> _CommandResults: ... diff --git a/stdlib/importlib/abc.pyi b/stdlib/importlib/abc.pyi index c961fb2e1f9e..e9136c948511 100644 --- a/stdlib/importlib/abc.pyi +++ b/stdlib/importlib/abc.pyi @@ -52,7 +52,7 @@ class InspectLoader(Loader): def get_source(self, fullname: str) -> str | None: ... def exec_module(self, module: types.ModuleType) -> None: ... @staticmethod - def source_to_code(data: ReadableBuffer | str, path: str = ...) -> types.CodeType: ... + def source_to_code(data: ReadableBuffer | str, path: str = '') -> types.CodeType: ... class ExecutionLoader(InspectLoader): @abstractmethod @@ -85,8 +85,8 @@ class FileLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta): path: str def __init__(self, fullname: str, path: str) -> None: ... def get_data(self, path: str) -> bytes: ... - def get_filename(self, name: str | None = ...) -> str: ... - def load_module(self, name: str | None = ...) -> types.ModuleType: ... + def get_filename(self, name: str | None = None) -> str: ... + def load_module(self, name: str | None = None) -> types.ModuleType: ... class ResourceReader(metaclass=ABCMeta): @abstractmethod @@ -123,7 +123,7 @@ if sys.version_info >= (3, 9): @abstractmethod def open( self, - mode: OpenTextMode = ..., + mode: OpenTextMode = 'r', buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., @@ -186,7 +186,7 @@ if sys.version_info >= (3, 9): @abstractmethod def read_bytes(self) -> bytes: ... @abstractmethod - def read_text(self, encoding: str | None = ...) -> str: ... + def read_text(self, encoding: str | None = None) -> str: ... class TraversableResources(ResourceReader): @abstractmethod diff --git a/stdlib/importlib/machinery.pyi b/stdlib/importlib/machinery.pyi index 6e253521bc0f..f79f54db4bc5 100644 --- a/stdlib/importlib/machinery.pyi +++ b/stdlib/importlib/machinery.pyi @@ -14,9 +14,9 @@ class ModuleSpec: name: str, loader: importlib.abc.Loader | None, *, - origin: str | None = ..., - loader_state: Any = ..., - is_package: bool | None = ..., + origin: str | None = None, + loader_state: Any = None, + is_package: bool | None = None, ) -> None: ... name: str loader: importlib.abc.Loader | None @@ -32,10 +32,10 @@ class ModuleSpec: class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder @classmethod - def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ... @classmethod def find_spec( - cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = None, target: types.ModuleType | None = None ) -> ModuleSpec | None: ... # InspectLoader @classmethod @@ -63,10 +63,10 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader) class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder @classmethod - def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ... @classmethod def find_spec( - cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = None, target: types.ModuleType | None = None ) -> ModuleSpec | None: ... # InspectLoader @classmethod @@ -92,10 +92,10 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): class WindowsRegistryFinder(importlib.abc.MetaPathFinder): @classmethod - def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ... @classmethod def find_spec( - cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = None, target: types.ModuleType | None = None ) -> ModuleSpec | None: ... class PathFinder: @@ -114,10 +114,10 @@ class PathFinder: @classmethod def find_spec( - cls, fullname: str, path: Sequence[str] | None = ..., target: types.ModuleType | None = ... + cls, fullname: str, path: Sequence[str] | None = None, target: types.ModuleType | None = None ) -> ModuleSpec | None: ... @classmethod - def find_module(cls, fullname: str, path: Sequence[str] | None = ...) -> importlib.abc.Loader | None: ... + def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ... SOURCE_SUFFIXES: list[str] DEBUG_BYTECODE_SUFFIXES: list[str] @@ -136,13 +136,13 @@ class FileFinder(importlib.abc.PathEntryFinder): ) -> Callable[[str], importlib.abc.PathEntryFinder]: ... class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): - def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = ...) -> None: ... + def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = 438) -> None: ... class SourcelessFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ... class ExtensionFileLoader(importlib.abc.ExecutionLoader): def __init__(self, name: str, path: str) -> None: ... - def get_filename(self, name: str | None = ...) -> str: ... + def get_filename(self, name: str | None = None) -> str: ... def get_source(self, fullname: str) -> None: ... def create_module(self, spec: ModuleSpec) -> types.ModuleType: ... def exec_module(self, module: types.ModuleType) -> None: ... diff --git a/stdlib/importlib/metadata/__init__.pyi b/stdlib/importlib/metadata/__init__.pyi index 01e35db5815e..8c4a747c5813 100644 --- a/stdlib/importlib/metadata/__init__.pyi +++ b/stdlib/importlib/metadata/__init__.pyi @@ -106,7 +106,7 @@ if sys.version_info >= (3, 10): ) -> EntryPoints: ... class PackagePath(pathlib.PurePosixPath): - def read_text(self, encoding: str = ...) -> str: ... + def read_text(self, encoding: str = 'utf-8') -> str: ... def read_binary(self) -> bytes: ... def locate(self) -> PathLike[str]: ... # The following attributes are not defined on PackagePath, but are dynamically added by Distribution.files: diff --git a/stdlib/importlib/resources.pyi b/stdlib/importlib/resources.pyi index ba3d9b087754..999bd65cd7bf 100644 --- a/stdlib/importlib/resources.pyi +++ b/stdlib/importlib/resources.pyi @@ -23,9 +23,9 @@ else: Resource: TypeAlias = str | os.PathLike[Any] def open_binary(package: Package, resource: Resource) -> BinaryIO: ... -def open_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> TextIO: ... +def open_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> TextIO: ... def read_binary(package: Package, resource: Resource) -> bytes: ... -def read_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> str: ... +def read_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... def path(package: Package, resource: Resource) -> AbstractContextManager[Path]: ... def is_resource(package: Package, name: str) -> bool: ... def contents(package: Package) -> Iterator[str]: ... diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index 588480026c42..955331be0261 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -297,14 +297,14 @@ if sys.version_info >= (3, 10): ) -> Signature: ... else: - def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Signature: ... + def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = ...) -> Signature: ... class _void: ... class _empty: ... class Signature: def __init__( - self, parameters: Sequence[Parameter] | None = ..., *, return_annotation: Any = ..., __validate_parameters__: bool = ... + self, parameters: Sequence[Parameter] | None = None, *, return_annotation: Any = ..., __validate_parameters__: bool = True ) -> None: ... empty = _empty @property @@ -500,7 +500,7 @@ if sys.version_info >= (3, 11): code_context: list[str] | None, index: int | None, *, - positions: dis.Positions | None = ..., + positions: dis.Positions | None = None, ) -> Self: ... class _FrameInfo(NamedTuple): @@ -522,7 +522,7 @@ if sys.version_info >= (3, 11): code_context: list[str] | None, index: int | None, *, - positions: dis.Positions | None = ..., + positions: dis.Positions | None = None, ) -> Self: ... else: diff --git a/stdlib/io.pyi b/stdlib/io.pyi index c1889300f981..49634fcc3b68 100644 --- a/stdlib/io.pyi +++ b/stdlib/io.pyi @@ -165,11 +165,11 @@ class TextIOWrapper(TextIOBase, TextIO): def reconfigure( self, *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., - line_buffering: bool | None = ..., - write_through: bool | None = ..., + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, + line_buffering: bool | None = None, + write_through: bool | None = None, ) -> None: ... # These are inherited from TextIOBase, but must exist in the stub to satisfy mypy. def __enter__(self: Self) -> Self: ... @@ -190,7 +190,7 @@ class StringIO(TextIOWrapper): class IncrementalNewlineDecoder(codecs.IncrementalDecoder): def __init__(self, decoder: codecs.IncrementalDecoder | None, translate: bool, errors: str = ...) -> None: ... - def decode(self, input: ReadableBuffer | str, final: bool = ...) -> str: ... + def decode(self, input: ReadableBuffer | str, final: bool = False) -> str: ... @property def newlines(self) -> str | tuple[str, ...] | None: ... def setstate(self, __state: tuple[bytes, int]) -> None: ... diff --git a/stdlib/ipaddress.pyi b/stdlib/ipaddress.pyi index e7142db36b70..1de945db5d30 100644 --- a/stdlib/ipaddress.pyi +++ b/stdlib/ipaddress.pyi @@ -114,8 +114,8 @@ class _BaseNetwork(_IPAddressBase, Container[_A], Iterable[_A], Generic[_A]): def prefixlen(self) -> int: ... def subnet_of(self: Self, other: Self) -> bool: ... def supernet_of(self: Self, other: Self) -> bool: ... - def subnets(self: Self, prefixlen_diff: int = ..., new_prefix: int | None = ...) -> Iterator[Self]: ... - def supernet(self: Self, prefixlen_diff: int = ..., new_prefix: int | None = ...) -> Self: ... + def subnets(self: Self, prefixlen_diff: int = 1, new_prefix: int | None = None) -> Iterator[Self]: ... + def supernet(self: Self, prefixlen_diff: int = 1, new_prefix: int | None = None) -> Self: ... @property def with_hostmask(self) -> str: ... @property diff --git a/stdlib/json/decoder.pyi b/stdlib/json/decoder.pyi index 2060cf17dd05..8debfe6cd65a 100644 --- a/stdlib/json/decoder.pyi +++ b/stdlib/json/decoder.pyi @@ -21,12 +21,12 @@ class JSONDecoder: def __init__( self, *, - object_hook: Callable[[dict[str, Any]], Any] | None = ..., - parse_float: Callable[[str], Any] | None = ..., - parse_int: Callable[[str], Any] | None = ..., - parse_constant: Callable[[str], Any] | None = ..., - strict: bool = ..., - object_pairs_hook: Callable[[list[tuple[str, Any]]], Any] | None = ..., + object_hook: Callable[[dict[str, Any]], Any] | None = None, + parse_float: Callable[[str], Any] | None = None, + parse_int: Callable[[str], Any] | None = None, + parse_constant: Callable[[str], Any] | None = None, + strict: bool = True, + object_pairs_hook: Callable[[list[tuple[str, Any]]], Any] | None = None, ) -> None: ... def decode(self, s: str, _w: Callable[..., Any] = ...) -> Any: ... # _w is undocumented - def raw_decode(self, s: str, idx: int = ...) -> tuple[Any, int]: ... + def raw_decode(self, s: str, idx: int = 0) -> tuple[Any, int]: ... diff --git a/stdlib/json/encoder.pyi b/stdlib/json/encoder.pyi index 0444ae477a96..0c0d366eb7a2 100644 --- a/stdlib/json/encoder.pyi +++ b/stdlib/json/encoder.pyi @@ -24,15 +24,15 @@ class JSONEncoder: def __init__( self, *, - skipkeys: bool = ..., - ensure_ascii: bool = ..., - check_circular: bool = ..., - allow_nan: bool = ..., - sort_keys: bool = ..., - indent: int | str | None = ..., - separators: tuple[str, str] | None = ..., - default: Callable[..., Any] | None = ..., + skipkeys: bool = False, + ensure_ascii: bool = True, + check_circular: bool = True, + allow_nan: bool = True, + sort_keys: bool = False, + indent: int | str | None = None, + separators: tuple[str, str] | None = None, + default: Callable[..., Any] | None = None, ) -> None: ... def default(self, o: Any) -> Any: ... def encode(self, o: Any) -> str: ... - def iterencode(self, o: Any, _one_shot: bool = ...) -> Iterator[str]: ... + def iterencode(self, o: Any, _one_shot: bool = False) -> Iterator[str]: ... diff --git a/stdlib/lib2to3/pgen2/driver.pyi b/stdlib/lib2to3/pgen2/driver.pyi index 6d7cf5c91f94..95b7eeb74d3c 100644 --- a/stdlib/lib2to3/pgen2/driver.pyi +++ b/stdlib/lib2to3/pgen2/driver.pyi @@ -12,13 +12,13 @@ class Driver: grammar: Grammar logger: Logger convert: _Convert - def __init__(self, grammar: Grammar, convert: _Convert | None = ..., logger: Logger | None = ...) -> None: ... - def parse_tokens(self, tokens: Iterable[Any], debug: bool = ...) -> _NL: ... - def parse_stream_raw(self, stream: IO[str], debug: bool = ...) -> _NL: ... - def parse_stream(self, stream: IO[str], debug: bool = ...) -> _NL: ... - def parse_file(self, filename: StrPath, encoding: str | None = ..., debug: bool = ...) -> _NL: ... - def parse_string(self, text: str, debug: bool = ...) -> _NL: ... + def __init__(self, grammar: Grammar, convert: _Convert | None = None, logger: Logger | None = None) -> None: ... + def parse_tokens(self, tokens: Iterable[Any], debug: bool = False) -> _NL: ... + def parse_stream_raw(self, stream: IO[str], debug: bool = False) -> _NL: ... + def parse_stream(self, stream: IO[str], debug: bool = False) -> _NL: ... + def parse_file(self, filename: StrPath, encoding: str | None = None, debug: bool = False) -> _NL: ... + def parse_string(self, text: str, debug: bool = False) -> _NL: ... def load_grammar( - gt: str = "Grammar.txt", gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None + gt: str = 'Grammar.txt', gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None ) -> Grammar: ... diff --git a/stdlib/lib2to3/pgen2/parse.pyi b/stdlib/lib2to3/pgen2/parse.pyi index 6a07c4a4ad48..51eb671f4236 100644 --- a/stdlib/lib2to3/pgen2/parse.pyi +++ b/stdlib/lib2to3/pgen2/parse.pyi @@ -20,8 +20,8 @@ class Parser: stack: list[tuple[_DFAS, int, _RawNode]] rootnode: _NL | None used_names: set[str] - def __init__(self, grammar: Grammar, convert: _Convert | None = ...) -> None: ... - def setup(self, start: int | None = ...) -> None: ... + def __init__(self, grammar: Grammar, convert: _Convert | None = None) -> None: ... + def setup(self, start: int | None = None) -> None: ... def addtoken(self, type: int, value: str | None, context: _Context) -> bool: ... def classify(self, type: int, value: str | None, context: _Context) -> int: ... def shift(self, type: int, value: str | None, newstate: int, context: _Context) -> None: ... diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 70c96ba66c26..7ac72abe96ee 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -11,7 +11,7 @@ class ParserGenerator: stream: IO[str] generator: Iterator[_TokenInfo] first: dict[str, dict[str, int]] - def __init__(self, filename: StrPath, stream: IO[str] | None = ...) -> None: ... + def __init__(self, filename: StrPath, stream: IO[str] | None = None) -> None: ... def make_grammar(self) -> PgenGrammar: ... def make_first(self, c: PgenGrammar, name: str) -> dict[int, int]: ... def make_label(self, c: PgenGrammar, label: str) -> int: ... @@ -26,13 +26,13 @@ class ParserGenerator: def parse_alt(self) -> tuple[NFAState, NFAState]: ... def parse_item(self) -> tuple[NFAState, NFAState]: ... def parse_atom(self) -> tuple[NFAState, NFAState]: ... - def expect(self, type: int, value: Any | None = ...) -> str: ... + def expect(self, type: int, value: Any | None = None) -> str: ... def gettoken(self) -> None: ... def raise_error(self, msg: str, *args: Any) -> NoReturn: ... class NFAState: arcs: list[tuple[str | None, NFAState]] - def addarc(self, next: NFAState, label: str | None = ...) -> None: ... + def addarc(self, next: NFAState, label: str | None = None) -> None: ... class DFAState: nfaset: dict[NFAState, Any] @@ -43,4 +43,4 @@ class DFAState: def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override] -def generate_grammar(filename: StrPath = "Grammar.txt") -> PgenGrammar: ... +def generate_grammar(filename: StrPath = 'Grammar.txt') -> PgenGrammar: ... diff --git a/stdlib/lib2to3/pytree.pyi b/stdlib/lib2to3/pytree.pyi index 4db9ab99ba44..cb56d20f6c36 100644 --- a/stdlib/lib2to3/pytree.pyi +++ b/stdlib/lib2to3/pytree.pyi @@ -43,9 +43,9 @@ class Node(Base): self, type: int, children: list[_NL], - context: Any | None = ..., - prefix: str | None = ..., - fixers_applied: list[Any] | None = ..., + context: Any | None = None, + prefix: str | None = None, + fixers_applied: list[Any] | None = None, ) -> None: ... def set_child(self, i: int, child: _NL) -> None: ... def insert_child(self, i: int, child: _NL) -> None: ... @@ -58,7 +58,7 @@ class Leaf(Base): value: str fixers_applied: list[Any] def __init__( - self, type: int, value: str, context: _Context | None = ..., prefix: str | None = ..., fixers_applied: list[Any] = ... + self, type: int, value: str, context: _Context | None = None, prefix: str | None = None, fixers_applied: list[Any] = ... ) -> None: ... def __unicode__(self) -> str: ... @@ -69,23 +69,23 @@ class BasePattern: content: str | None name: str | None def optimize(self) -> BasePattern: ... # sic, subclasses are free to optimize themselves into different patterns - def match(self, node: _NL, results: _Results | None = ...) -> bool: ... - def match_seq(self, nodes: list[_NL], results: _Results | None = ...) -> bool: ... + def match(self, node: _NL, results: _Results | None = None) -> bool: ... + def match_seq(self, nodes: list[_NL], results: _Results | None = None) -> bool: ... def generate_matches(self, nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ... class LeafPattern(BasePattern): - def __init__(self, type: int | None = ..., content: str | None = ..., name: str | None = ...) -> None: ... + def __init__(self, type: int | None = None, content: str | None = None, name: str | None = None) -> None: ... class NodePattern(BasePattern): wildcards: bool - def __init__(self, type: int | None = ..., content: str | None = ..., name: str | None = ...) -> None: ... + def __init__(self, type: int | None = None, content: str | None = None, name: str | None = None) -> None: ... class WildcardPattern(BasePattern): min: int max: int - def __init__(self, content: str | None = ..., min: int = ..., max: int = ..., name: str | None = ...) -> None: ... + def __init__(self, content: str | None = None, min: int = 0, max: int = 2147483647, name: str | None = None) -> None: ... class NegatedPattern(BasePattern): - def __init__(self, content: str | None = ...) -> None: ... + def __init__(self, content: str | None = None) -> None: ... def generate_matches(patterns: list[BasePattern], nodes: list[_NL]) -> Iterator[tuple[int, _Results]]: ... diff --git a/stdlib/lib2to3/refactor.pyi b/stdlib/lib2to3/refactor.pyi index ef4c7387037e..a14ccaec8476 100644 --- a/stdlib/lib2to3/refactor.pyi +++ b/stdlib/lib2to3/refactor.pyi @@ -33,25 +33,25 @@ class RefactoringTool: bmi_pre_order: list[Any] bmi_post_order: list[Any] def __init__( - self, fixer_names: Iterable[str], options: Mapping[str, Any] | None = ..., explicit: Container[str] | None = ... + self, fixer_names: Iterable[str], options: Mapping[str, Any] | None = None, explicit: Container[str] | None = None ) -> None: ... def get_fixers(self) -> tuple[list[Any], list[Any]]: ... def log_error(self, msg: str, *args: Any, **kwds: Any) -> NoReturn: ... def log_message(self, msg: str, *args: Any) -> None: ... def log_debug(self, msg: str, *args: Any) -> None: ... def print_output(self, old_text: str, new_text: str, filename: str, equal): ... - def refactor(self, items: Iterable[str], write: bool = ..., doctests_only: bool = ...) -> None: ... - def refactor_dir(self, dir_name: str, write: bool = ..., doctests_only: bool = ...) -> None: ... + def refactor(self, items: Iterable[str], write: bool = False, doctests_only: bool = False) -> None: ... + def refactor_dir(self, dir_name: str, write: bool = False, doctests_only: bool = False) -> None: ... def _read_python_source(self, filename: str) -> tuple[str, str]: ... - def refactor_file(self, filename: str, write: bool = ..., doctests_only: bool = ...) -> None: ... + def refactor_file(self, filename: str, write: bool = False, doctests_only: bool = False) -> None: ... def refactor_string(self, data: str, name: str): ... - def refactor_stdin(self, doctests_only: bool = ...) -> None: ... + def refactor_stdin(self, doctests_only: bool = False) -> None: ... def refactor_tree(self, tree, name: str) -> bool: ... def traverse_by(self, fixers, traversal) -> None: ... def processed_file( - self, new_text: str, filename: str, old_text: str | None = ..., write: bool = ..., encoding: str | None = ... + self, new_text: str, filename: str, old_text: str | None = None, write: bool = False, encoding: str | None = None ) -> None: ... - def write_file(self, new_text: str, filename: str, old_text: str, encoding: str | None = ...) -> None: ... + def write_file(self, new_text: str, filename: str, old_text: str, encoding: str | None = None) -> None: ... PS1: ClassVar[str] PS2: ClassVar[str] def refactor_docstring(self, input: str, filename: str) -> str: ... @@ -68,4 +68,4 @@ class MultiprocessingUnsupported(Exception): ... class MultiprocessRefactoringTool(RefactoringTool): queue: Any | None output_lock: Any | None - def refactor(self, items: Iterable[str], write: bool = ..., doctests_only: bool = ..., num_processes: int = ...) -> None: ... + def refactor(self, items: Iterable[str], write: bool = False, doctests_only: bool = False, num_processes: int = 1) -> None: ... diff --git a/stdlib/locale.pyi b/stdlib/locale.pyi index 0b0dd9456e52..99b78b50adff 100644 --- a/stdlib/locale.pyi +++ b/stdlib/locale.pyi @@ -115,10 +115,10 @@ def setlocale(category: int, locale: _str | Iterable[_str | None] | None = None) def localeconv() -> Mapping[_str, int | _str | list[int]]: ... def nl_langinfo(__key: int) -> _str: ... def getdefaultlocale(envvars: tuple[_str, ...] = ...) -> tuple[_str | None, _str | None]: ... -def getlocale(category: int = ...) -> tuple[_str | None, _str | None]: ... +def getlocale(category: int = 2) -> tuple[_str | None, _str | None]: ... def getpreferredencoding(do_setlocale: bool = True) -> _str: ... def normalize(localename: _str) -> _str: ... -def resetlocale(category: int = ...) -> None: ... +def resetlocale(category: int = 0) -> None: ... def strcoll(__os1: _str, __os2: _str) -> int: ... def strxfrm(__string: _str) -> _str: ... def format(percent: _str, value: float | Decimal, grouping: bool = False, monetary: bool = False, *additional: Any) -> _str: ... diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index fba26657cf07..3f924fac76d4 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -106,7 +106,7 @@ class Logger(Filterer): disabled: bool # undocumented root: ClassVar[RootLogger] # undocumented manager: Manager # undocumented - def __init__(self, name: str, level: _Level = ...) -> None: ... + def __init__(self, name: str, level: _Level = 0) -> None: ... def setLevel(self, level: _Level) -> None: ... def isEnabledFor(self, level: int) -> bool: ... def getEffectiveLevel(self) -> int: ... @@ -288,9 +288,9 @@ class Logger(Filterer): msg: object, args: _ArgsType, exc_info: _SysExcInfoType | None, - func: str | None = ..., - extra: Mapping[str, object] | None = ..., - sinfo: str | None = ..., + func: str | None = None, + extra: Mapping[str, object] | None = None, + sinfo: str | None = None, ) -> LogRecord: ... def hasHandlers(self) -> bool: ... def callHandlers(self, record: LogRecord) -> None: ... # undocumented @@ -309,7 +309,7 @@ class Handler(Filterer): formatter: Formatter | None # undocumented lock: threading.Lock | None # undocumented name: str | None # undocumented - def __init__(self, level: _Level = ...) -> None: ... + def __init__(self, level: _Level = 0) -> None: ... def get_name(self) -> str: ... # undocumented def set_name(self, name: str) -> None: ... # undocumented def createLock(self) -> None: ... @@ -353,7 +353,7 @@ class Formatter: def __init__(self, fmt: str | None = ..., datefmt: str | None = ..., style: _FormatStyle = ...) -> None: ... def format(self, record: LogRecord) -> str: ... - def formatTime(self, record: LogRecord, datefmt: str | None = ...) -> str: ... + def formatTime(self, record: LogRecord, datefmt: str | None = None) -> str: ... def formatException(self, ei: _SysExcInfoType) -> str: ... def formatMessage(self, record: LogRecord) -> str: ... # undocumented def formatStack(self, stack_info: str) -> str: ... @@ -361,7 +361,7 @@ class Formatter: class BufferingFormatter: linefmt: Formatter - def __init__(self, linefmt: Formatter | None = ...) -> None: ... + def __init__(self, linefmt: Formatter | None = None) -> None: ... def formatHeader(self, records: Sequence[LogRecord]) -> str: ... def formatFooter(self, records: Sequence[LogRecord]) -> str: ... def format(self, records: Sequence[LogRecord]) -> str: ... @@ -369,7 +369,7 @@ class BufferingFormatter: class Filter: name: str # undocumented nlen: int # undocumented - def __init__(self, name: str = ...) -> None: ... + def __init__(self, name: str = '') -> None: ... def filter(self, record: LogRecord) -> bool: ... class LogRecord: @@ -407,8 +407,8 @@ class LogRecord: msg: object, args: _ArgsType | None, exc_info: _SysExcInfoType | None, - func: str | None = ..., - sinfo: str | None = ..., + func: str | None = None, + sinfo: str | None = None, ) -> None: ... def getMessage(self) -> str: ... # Allows setting contextual information on LogRecord objects as per the docs, see #7833 @@ -593,9 +593,9 @@ class LoggerAdapter(Generic[_L]): level: int, msg: object, args: _ArgsType, - exc_info: _ExcInfoType | None = ..., - extra: Mapping[str, object] | None = ..., - stack_info: bool = ..., + exc_info: _ExcInfoType | None = None, + extra: Mapping[str, object] | None = None, + stack_info: bool = False, ) -> None: ... # undocumented @property def name(self) -> str: ... # undocumented @@ -693,11 +693,7 @@ else: msg: object, *args: object, exc_info: _ExcInfoType = ..., stack_info: bool = ..., extra: Mapping[str, object] | None = ... ) -> None: ... def exception( - msg: object, - *args: object, - exc_info: _ExcInfoType = True, - stack_info: bool = ..., - extra: Mapping[str, object] | None = ..., + msg: object, *args: object, exc_info: _ExcInfoType = ..., stack_info: bool = ..., extra: Mapping[str, object] | None = ... ) -> None: ... def log( level: int, @@ -775,7 +771,7 @@ class StreamHandler(Handler, Generic[_StreamT]): stream: _StreamT # undocumented terminator: str @overload - def __init__(self: StreamHandler[TextIO], stream: None = ...) -> None: ... + def __init__(self: StreamHandler[TextIO], stream: None = None) -> None: ... @overload def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ... def setStream(self, stream: _StreamT) -> _StreamT | None: ... diff --git a/stdlib/logging/config.pyi b/stdlib/logging/config.pyi index f76f655a6196..529dd65ff7cf 100644 --- a/stdlib/logging/config.pyi +++ b/stdlib/logging/config.pyi @@ -57,8 +57,8 @@ if sys.version_info >= (3, 10): else: def fileConfig( fname: StrOrBytesPath | IO[str] | RawConfigParser, - defaults: dict[str, str] | None = None, - disable_existing_loggers: bool = True, + defaults: dict[str, str] | None = ..., + disable_existing_loggers: bool = ..., ) -> None: ... def valid_ident(s: str) -> Literal[True]: ... # undocumented diff --git a/stdlib/logging/handlers.pyi b/stdlib/logging/handlers.pyi index f01c67d13fe9..adb6a1262123 100644 --- a/stdlib/logging/handlers.pyi +++ b/stdlib/logging/handlers.pyi @@ -123,7 +123,7 @@ class SocketHandler(Handler): retryFactor: float # undocumented retryMax: float # undocumented def __init__(self, host: str, port: int | None) -> None: ... - def makeSocket(self, timeout: float = ...) -> socket: ... # timeout is undocumented + def makeSocket(self, timeout: float = 1) -> socket: ... # timeout is undocumented def makePickle(self, record: LogRecord) -> bytes: ... def send(self, s: ReadableBuffer) -> None: ... def createSocket(self) -> None: ... @@ -177,7 +177,7 @@ class SysLogHandler(Handler): priority_names: ClassVar[dict[str, int]] # undocumented facility_names: ClassVar[dict[str, int]] # undocumented priority_map: ClassVar[dict[str, str]] # undocumented - def __init__(self, address: tuple[str, int] | str = ..., facility: int = ..., socktype: SocketKind | None = ...) -> None: ... + def __init__(self, address: tuple[str, int] | str = ..., facility: int = 1, socktype: SocketKind | None = None) -> None: ... if sys.version_info >= (3, 11): def createSocket(self) -> None: ... @@ -185,7 +185,7 @@ class SysLogHandler(Handler): def mapPriority(self, levelName: str) -> str: ... class NTEventLogHandler(Handler): - def __init__(self, appname: str, dllname: str | None = ..., logtype: str = ...) -> None: ... + def __init__(self, appname: str, dllname: str | None = None, logtype: str = 'Application') -> None: ... def getEventCategory(self, record: LogRecord) -> int: ... # TODO correct return value? def getEventType(self, record: LogRecord) -> int: ... @@ -208,8 +208,8 @@ class SMTPHandler(Handler): fromaddr: str, toaddrs: str | list[str], subject: str, - credentials: tuple[str, str] | None = ..., - secure: tuple[()] | tuple[str] | tuple[str, str] | None = ..., + credentials: tuple[str, str] | None = None, + secure: tuple[()] | tuple[str] | tuple[str, str] | None = None, timeout: float = ..., ) -> None: ... def getSubject(self, record: LogRecord) -> str: ... @@ -224,7 +224,7 @@ class MemoryHandler(BufferingHandler): flushLevel: int # undocumented target: Handler | None # undocumented flushOnClose: bool # undocumented - def __init__(self, capacity: int, flushLevel: int = ..., target: Handler | None = ..., flushOnClose: bool = ...) -> None: ... + def __init__(self, capacity: int, flushLevel: int = 40, target: Handler | None = None, flushOnClose: bool = True) -> None: ... def setTarget(self, target: Handler | None) -> None: ... class HTTPHandler(Handler): @@ -238,10 +238,10 @@ class HTTPHandler(Handler): self, host: str, url: str, - method: str = ..., - secure: bool = ..., - credentials: tuple[str, str] | None = ..., - context: ssl.SSLContext | None = ..., + method: str = 'GET', + secure: bool = False, + credentials: tuple[str, str] | None = None, + context: ssl.SSLContext | None = None, ) -> None: ... def mapLogRecord(self, record: LogRecord) -> dict[str, Any]: ... if sys.version_info >= (3, 9): @@ -257,7 +257,7 @@ class QueueListener: handlers: tuple[Handler, ...] # undocumented respect_handler_level: bool # undocumented queue: SimpleQueue[Any] | Queue[Any] # undocumented - def __init__(self, queue: SimpleQueue[Any] | Queue[Any], *handlers: Handler, respect_handler_level: bool = ...) -> None: ... + def __init__(self, queue: SimpleQueue[Any] | Queue[Any], *handlers: Handler, respect_handler_level: bool = False) -> None: ... def dequeue(self, block: bool) -> LogRecord: ... def prepare(self, record: LogRecord) -> Any: ... def start(self) -> None: ... diff --git a/stdlib/lzma.pyi b/stdlib/lzma.pyi index f6459689f191..2e10074de85d 100644 --- a/stdlib/lzma.pyi +++ b/stdlib/lzma.pyi @@ -83,7 +83,7 @@ PRESET_EXTREME: int # v big number @final class LZMADecompressor: def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ... - def decompress(self, data: ReadableBuffer, max_length: int = ...) -> bytes: ... + def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ... @property def check(self) -> int: ... @property @@ -107,21 +107,21 @@ class LZMAError(Exception): ... class LZMAFile(io.BufferedIOBase, IO[bytes]): def __init__( self, - filename: _PathOrFile | None = ..., - mode: str = ..., + filename: _PathOrFile | None = None, + mode: str = 'r', *, - format: int | None = ..., - check: int = ..., - preset: int | None = ..., - filters: _FilterChain | None = ..., + format: int | None = None, + check: int = -1, + preset: int | None = None, + filters: _FilterChain | None = None, ) -> None: ... def __enter__(self: Self) -> Self: ... - def peek(self, size: int = ...) -> bytes: ... - def read(self, size: int | None = ...) -> bytes: ... - def read1(self, size: int = ...) -> bytes: ... - def readline(self, size: int | None = ...) -> bytes: ... + def peek(self, size: int = -1) -> bytes: ... + def read(self, size: int | None = -1) -> bytes: ... + def read1(self, size: int = -1) -> bytes: ... + def readline(self, size: int | None = -1) -> bytes: ... def write(self, data: ReadableBuffer) -> int: ... - def seek(self, offset: int, whence: int = ...) -> int: ... + def seek(self, offset: int, whence: int = 0) -> int: ... @overload def open( @@ -189,7 +189,7 @@ def open( newline: str | None = ..., ) -> LZMAFile | TextIO: ... def compress( - data: ReadableBuffer, format: int = 1, check: int = ..., preset: int | None = None, filters: _FilterChain | None = None + data: ReadableBuffer, format: int = 1, check: int = -1, preset: int | None = None, filters: _FilterChain | None = None ) -> bytes: ... def decompress( data: ReadableBuffer, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None diff --git a/stdlib/mailbox.pyi b/stdlib/mailbox.pyi index 29cea5cadbb0..7af718d4191d 100644 --- a/stdlib/mailbox.pyi +++ b/stdlib/mailbox.pyi @@ -50,9 +50,9 @@ class Mailbox(Generic[_MessageT]): _path: str # undocumented _factory: Callable[[IO[Any]], _MessageT] | None # undocumented @overload - def __init__(self, path: StrPath, factory: Callable[[IO[Any]], _MessageT], create: bool = ...) -> None: ... + def __init__(self, path: StrPath, factory: Callable[[IO[Any]], _MessageT], create: bool = True) -> None: ... @overload - def __init__(self, path: StrPath, factory: None = ..., create: bool = ...) -> None: ... + def __init__(self, path: StrPath, factory: None = None, create: bool = True) -> None: ... @abstractmethod def add(self, message: _MessageData) -> str: ... @abstractmethod @@ -62,7 +62,7 @@ class Mailbox(Generic[_MessageT]): @abstractmethod def __setitem__(self, key: str, message: _MessageData) -> None: ... @overload - def get(self, key: str, default: None = ...) -> _MessageT | None: ... + def get(self, key: str, default: None = None) -> _MessageT | None: ... @overload def get(self, key: str, default: _T) -> _MessageT | _T: ... def __getitem__(self, key: str) -> _MessageT: ... @@ -88,11 +88,11 @@ class Mailbox(Generic[_MessageT]): def __len__(self) -> int: ... def clear(self) -> None: ... @overload - def pop(self, key: str, default: None = ...) -> _MessageT | None: ... + def pop(self, key: str, default: None = None) -> _MessageT | None: ... @overload - def pop(self, key: str, default: _T = ...) -> _MessageT | _T: ... + def pop(self, key: str, default: _T = None) -> _MessageT | _T: ... def popitem(self) -> tuple[str, _MessageT]: ... - def update(self, arg: _HasIteritems | _HasItems | Iterable[tuple[str, _MessageData]] | None = ...) -> None: ... + def update(self, arg: _HasIteritems | _HasItems | Iterable[tuple[str, _MessageData]] | None = None) -> None: ... @abstractmethod def flush(self) -> None: ... @abstractmethod @@ -108,7 +108,7 @@ class Maildir(Mailbox[MaildirMessage]): colon: str def __init__( - self, dirname: StrPath, factory: Callable[[IO[Any]], MaildirMessage] | None = ..., create: bool = ... + self, dirname: StrPath, factory: Callable[[IO[Any]], MaildirMessage] | None = None, create: bool = True ) -> None: ... def add(self, message: _MessageData) -> str: ... def remove(self, key: str) -> None: ... @@ -144,18 +144,18 @@ class _singlefileMailbox(Mailbox[_MessageT], metaclass=ABCMeta): class _mboxMMDF(_singlefileMailbox[_MessageT]): def get_message(self, key: str) -> _MessageT: ... - def get_file(self, key: str, from_: bool = ...) -> _PartialFile[bytes]: ... - def get_bytes(self, key: str, from_: bool = ...) -> bytes: ... - def get_string(self, key: str, from_: bool = ...) -> str: ... + def get_file(self, key: str, from_: bool = False) -> _PartialFile[bytes]: ... + def get_bytes(self, key: str, from_: bool = False) -> bytes: ... + def get_string(self, key: str, from_: bool = False) -> str: ... class mbox(_mboxMMDF[mboxMessage]): - def __init__(self, path: StrPath, factory: Callable[[IO[Any]], mboxMessage] | None = ..., create: bool = ...) -> None: ... + def __init__(self, path: StrPath, factory: Callable[[IO[Any]], mboxMessage] | None = None, create: bool = True) -> None: ... class MMDF(_mboxMMDF[MMDFMessage]): - def __init__(self, path: StrPath, factory: Callable[[IO[Any]], MMDFMessage] | None = ..., create: bool = ...) -> None: ... + def __init__(self, path: StrPath, factory: Callable[[IO[Any]], MMDFMessage] | None = None, create: bool = True) -> None: ... class MH(Mailbox[MHMessage]): - def __init__(self, path: StrPath, factory: Callable[[IO[Any]], MHMessage] | None = ..., create: bool = ...) -> None: ... + def __init__(self, path: StrPath, factory: Callable[[IO[Any]], MHMessage] | None = None, create: bool = True) -> None: ... def add(self, message: _MessageData) -> str: ... def remove(self, key: str) -> None: ... def __setitem__(self, key: str, message: _MessageData) -> None: ... @@ -178,14 +178,14 @@ class MH(Mailbox[MHMessage]): def pack(self) -> None: ... class Babyl(_singlefileMailbox[BabylMessage]): - def __init__(self, path: StrPath, factory: Callable[[IO[Any]], BabylMessage] | None = ..., create: bool = ...) -> None: ... + def __init__(self, path: StrPath, factory: Callable[[IO[Any]], BabylMessage] | None = None, create: bool = True) -> None: ... def get_message(self, key: str) -> BabylMessage: ... def get_bytes(self, key: str) -> bytes: ... def get_file(self, key: str) -> IO[bytes]: ... def get_labels(self) -> list[str]: ... class Message(email.message.Message): - def __init__(self, message: _MessageData | None = ...) -> None: ... + def __init__(self, message: _MessageData | None = None) -> None: ... class MaildirMessage(Message): def get_subdir(self) -> str: ... @@ -201,7 +201,7 @@ class MaildirMessage(Message): class _mboxMMDFMessage(Message): def get_from(self) -> str: ... - def set_from(self, from_: str, time_: bool | tuple[int, int, int, int, int, int, int, int, int] | None = ...) -> None: ... + def set_from(self, from_: str, time_: bool | tuple[int, int, int, int, int, int, int, int, int] | None = None) -> None: ... def get_flags(self) -> str: ... def set_flags(self, flags: Iterable[str]) -> None: ... def add_flag(self, flag: str) -> None: ... @@ -227,14 +227,14 @@ class BabylMessage(Message): class MMDFMessage(_mboxMMDFMessage): ... class _ProxyFile(Generic[AnyStr]): - def __init__(self, f: IO[AnyStr], pos: int | None = ...) -> None: ... - def read(self, size: int | None = ...) -> AnyStr: ... - def read1(self, size: int | None = ...) -> AnyStr: ... - def readline(self, size: int | None = ...) -> AnyStr: ... - def readlines(self, sizehint: int | None = ...) -> list[AnyStr]: ... + def __init__(self, f: IO[AnyStr], pos: int | None = None) -> None: ... + def read(self, size: int | None = None) -> AnyStr: ... + def read1(self, size: int | None = None) -> AnyStr: ... + def readline(self, size: int | None = None) -> AnyStr: ... + def readlines(self, sizehint: int | None = None) -> list[AnyStr]: ... def __iter__(self) -> Iterator[AnyStr]: ... def tell(self) -> int: ... - def seek(self, offset: int, whence: int = ...) -> None: ... + def seek(self, offset: int, whence: int = 0) -> None: ... def close(self) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ... @@ -248,7 +248,7 @@ class _ProxyFile(Generic[AnyStr]): def __class_getitem__(cls, item: Any) -> GenericAlias: ... class _PartialFile(_ProxyFile[AnyStr]): - def __init__(self, f: IO[AnyStr], start: int | None = ..., stop: int | None = ...) -> None: ... + def __init__(self, f: IO[AnyStr], start: int | None = None, stop: int | None = None) -> None: ... class Error(Exception): ... class NoSuchMailboxError(Error): ... diff --git a/stdlib/mailcap.pyi b/stdlib/mailcap.pyi index 5905f5826bf7..0acf924e674b 100644 --- a/stdlib/mailcap.pyi +++ b/stdlib/mailcap.pyi @@ -6,6 +6,6 @@ _Cap: TypeAlias = dict[str, str | int] __all__ = ["getcaps", "findmatch"] def findmatch( - caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = "view", filename: str = "/dev/null", plist: Sequence[str] = ... + caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = 'view', filename: str = '/dev/null', plist: Sequence[str] = ... ) -> tuple[str | None, _Cap | None]: ... def getcaps() -> dict[str, list[_Cap]]: ... diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index 3b778b23ba2c..6aa2db067edd 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -23,7 +23,7 @@ if sys.version_info >= (3, 8): def guess_type(url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ... else: - def guess_type(url: str, strict: bool = True) -> tuple[str | None, str | None]: ... + def guess_type(url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... def guess_all_extensions(type: str, strict: bool = True) -> list[str]: ... def guess_extension(type: str, strict: bool = True) -> str | None: ... @@ -43,15 +43,15 @@ class MimeTypes: encodings_map: dict[str, str] types_map: tuple[dict[str, str], dict[str, str]] types_map_inv: tuple[dict[str, str], dict[str, str]] - def __init__(self, filenames: tuple[str, ...] = ..., strict: bool = ...) -> None: ... - def guess_extension(self, type: str, strict: bool = ...) -> str | None: ... + def __init__(self, filenames: tuple[str, ...] = ..., strict: bool = True) -> None: ... + def guess_extension(self, type: str, strict: bool = True) -> str | None: ... if sys.version_info >= (3, 8): def guess_type(self, url: StrPath, strict: bool = ...) -> tuple[str | None, str | None]: ... else: def guess_type(self, url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... - def guess_all_extensions(self, type: str, strict: bool = ...) -> list[str]: ... - def read(self, filename: str, strict: bool = ...) -> None: ... - def readfp(self, fp: IO[str], strict: bool = ...) -> None: ... + def guess_all_extensions(self, type: str, strict: bool = True) -> list[str]: ... + def read(self, filename: str, strict: bool = True) -> None: ... + def readfp(self, fp: IO[str], strict: bool = True) -> None: ... if sys.platform == "win32": def read_windows_registry(self, strict: bool = ...) -> None: ... diff --git a/stdlib/modulefinder.pyi b/stdlib/modulefinder.pyi index caed7efadccc..aab07fa7bd6a 100644 --- a/stdlib/modulefinder.pyi +++ b/stdlib/modulefinder.pyi @@ -20,7 +20,7 @@ replacePackageMap: dict[str, str] # undocumented def ReplacePackage(oldname: str, newname: str) -> None: ... class Module: # undocumented - def __init__(self, name: str, file: str | None = ..., path: str | None = ...) -> None: ... + def __init__(self, name: str, file: str | None = None, path: str | None = None) -> None: ... class ModuleFinder: @@ -55,12 +55,12 @@ class ModuleFinder: def run_script(self, pathname: str) -> None: ... def load_file(self, pathname: str) -> None: ... # undocumented def import_hook( - self, name: str, caller: Module | None = ..., fromlist: list[str] | None = ..., level: int = ... + self, name: str, caller: Module | None = None, fromlist: list[str] | None = None, level: int = -1 ) -> Module | None: ... # undocumented - def determine_parent(self, caller: Module | None, level: int = ...) -> Module | None: ... # undocumented + def determine_parent(self, caller: Module | None, level: int = -1) -> Module | None: ... # undocumented def find_head_package(self, parent: Module, name: str) -> tuple[Module, str]: ... # undocumented def load_tail(self, q: Module, tail: str) -> Module: ... # undocumented - def ensure_fromlist(self, m: Module, fromlist: Iterable[str], recursive: int = ...) -> None: ... # undocumented + def ensure_fromlist(self, m: Module, fromlist: Iterable[str], recursive: int = 0) -> None: ... # undocumented def find_all_submodules(self, m: Module) -> Iterable[str]: ... # undocumented def import_module(self, partname: str, fqname: str, parent: Module) -> Module | None: ... # undocumented def load_module(self, fqname: str, fp: IO[str], pathname: str, file_info: tuple[str, str, str]) -> Module: ... # undocumented @@ -69,7 +69,7 @@ class ModuleFinder: def load_package(self, fqname: str, pathname: str) -> Module: ... # undocumented def add_module(self, fqname: str) -> Module: ... # undocumented def find_module( - self, name: str, path: str | None, parent: Module | None = ... + self, name: str, path: str | None, parent: Module | None = None ) -> tuple[IO[Any] | None, str | None, tuple[str, str, int]]: ... # undocumented def report(self) -> None: ... def any_missing(self) -> list[str]: ... # undocumented diff --git a/stdlib/multiprocessing/connection.pyi b/stdlib/multiprocessing/connection.pyi index b6bff2e6698b..ef1aad05e5a9 100644 --- a/stdlib/multiprocessing/connection.pyi +++ b/stdlib/multiprocessing/connection.pyi @@ -12,7 +12,7 @@ __all__ = ["Client", "Listener", "Pipe", "wait"] _Address: TypeAlias = Union[str, tuple[str, int]] class _ConnectionBase: - def __init__(self, handle: SupportsIndex, readable: bool = ..., writable: bool = ...) -> None: ... + def __init__(self, handle: SupportsIndex, readable: bool = True, writable: bool = True) -> None: ... @property def closed(self) -> bool: ... # undocumented @property @@ -21,10 +21,10 @@ class _ConnectionBase: def writable(self) -> bool: ... # undocumented def fileno(self) -> int: ... def close(self) -> None: ... - def send_bytes(self, buf: ReadableBuffer, offset: int = ..., size: int | None = ...) -> None: ... + def send_bytes(self, buf: ReadableBuffer, offset: int = 0, size: int | None = None) -> None: ... def send(self, obj: Any) -> None: ... - def recv_bytes(self, maxlength: int | None = ...) -> bytes: ... - def recv_bytes_into(self, buf: Any, offset: int = ...) -> int: ... + def recv_bytes(self, maxlength: int | None = None) -> bytes: ... + def recv_bytes_into(self, buf: Any, offset: int = 0) -> int: ... def recv(self) -> Any: ... def poll(self, timeout: float | None = ...) -> bool: ... def __enter__(self: Self) -> Self: ... @@ -39,7 +39,7 @@ if sys.platform == "win32": class Listener: def __init__( - self, address: _Address | None = ..., family: str | None = ..., backlog: int = ..., authkey: bytes | None = ... + self, address: _Address | None = None, family: str | None = None, backlog: int = 1, authkey: bytes | None = None ) -> None: ... def accept(self) -> Connection: ... def close(self) -> None: ... diff --git a/stdlib/multiprocessing/context.pyi b/stdlib/multiprocessing/context.pyi index 6622dca19ade..f4e01ea34c9d 100644 --- a/stdlib/multiprocessing/context.pyi +++ b/stdlib/multiprocessing/context.pyi @@ -57,23 +57,23 @@ class BaseContext: def Pipe(self, duplex: bool = ...) -> tuple[PipeConnection, PipeConnection]: ... def Barrier( - self, parties: int, action: Callable[..., object] | None = ..., timeout: float | None = ... + self, parties: int, action: Callable[..., object] | None = None, timeout: float | None = None ) -> synchronize.Barrier: ... - def BoundedSemaphore(self, value: int = ...) -> synchronize.BoundedSemaphore: ... - def Condition(self, lock: _LockLike | None = ...) -> synchronize.Condition: ... + def BoundedSemaphore(self, value: int = 1) -> synchronize.BoundedSemaphore: ... + def Condition(self, lock: _LockLike | None = None) -> synchronize.Condition: ... def Event(self) -> synchronize.Event: ... def Lock(self) -> synchronize.Lock: ... def RLock(self) -> synchronize.RLock: ... - def Semaphore(self, value: int = ...) -> synchronize.Semaphore: ... - def Queue(self, maxsize: int = ...) -> queues.Queue[Any]: ... - def JoinableQueue(self, maxsize: int = ...) -> queues.JoinableQueue[Any]: ... + def Semaphore(self, value: int = 1) -> synchronize.Semaphore: ... + def Queue(self, maxsize: int = 0) -> queues.Queue[Any]: ... + def JoinableQueue(self, maxsize: int = 0) -> queues.JoinableQueue[Any]: ... def SimpleQueue(self) -> queues.SimpleQueue[Any]: ... def Pool( self, - processes: int | None = ..., - initializer: Callable[..., object] | None = ..., + processes: int | None = None, + initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ..., - maxtasksperchild: int | None = ..., + maxtasksperchild: int | None = None, ) -> _Pool: ... @overload def RawValue(self, typecode_or_type: type[_CT], *args: Any) -> _CT: ... @@ -86,28 +86,28 @@ class BaseContext: @overload def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[False]) -> _CT: ... @overload - def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[_CT]: ... + def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = True) -> SynchronizedBase[_CT]: ... @overload - def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[Any]: ... + def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = True) -> SynchronizedBase[Any]: ... @overload - def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ... + def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True) -> Any: ... @overload def Array(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ... @overload def Array( - self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ... + self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True ) -> SynchronizedArray[_CT]: ... @overload def Array( - self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ... + self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True ) -> SynchronizedArray[Any]: ... @overload def Array( - self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ... + self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = True ) -> Any: ... def freeze_support(self) -> None: ... def get_logger(self) -> Logger: ... - def log_to_stderr(self, level: _LoggingLevel | None = ...) -> Logger: ... + def log_to_stderr(self, level: _LoggingLevel | None = None) -> Logger: ... def allow_connection_pickling(self) -> None: ... def set_executable(self, executable: str) -> None: ... def set_forkserver_preload(self, module_names: list[str]) -> None: ... @@ -131,10 +131,10 @@ class BaseContext: def get_context(self, method: str) -> BaseContext: ... @overload - def get_start_method(self, allow_none: Literal[False] = ...) -> str: ... + def get_start_method(self, allow_none: Literal[False] = False) -> str: ... @overload def get_start_method(self, allow_none: bool) -> str | None: ... - def set_start_method(self, method: str | None, force: bool = ...) -> None: ... + def set_start_method(self, method: str | None, force: bool = False) -> None: ... @property def reducer(self) -> str: ... @reducer.setter @@ -149,7 +149,7 @@ class Process(BaseProcess): class DefaultContext(BaseContext): Process: ClassVar[type[Process]] def __init__(self, context: BaseContext) -> None: ... - def get_start_method(self, allow_none: bool = ...) -> str: ... + def get_start_method(self, allow_none: bool = False) -> str: ... def get_all_start_methods(self) -> list[str]: ... if sys.version_info < (3, 8): __all__: ClassVar[list[str]] diff --git a/stdlib/multiprocessing/dummy/__init__.pyi b/stdlib/multiprocessing/dummy/__init__.pyi index 2dddaa4f2063..43529c706349 100644 --- a/stdlib/multiprocessing/dummy/__init__.pyi +++ b/stdlib/multiprocessing/dummy/__init__.pyi @@ -47,9 +47,9 @@ class DummyProcess(threading.Thread): def exitcode(self) -> Literal[0] | None: ... def __init__( self, - group: Any = ..., - target: Callable[..., object] | None = ..., - name: str | None = ..., + group: Any = None, + target: Callable[..., object] | None = None, + name: str | None = None, args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ..., ) -> None: ... @@ -65,13 +65,11 @@ class Value: _typecode: Any _value: Any value: Any - def __init__(self, typecode: Any, value: Any, lock: Any = ...) -> None: ... + def __init__(self, typecode: Any, value: Any, lock: Any = True) -> None: ... def Array(typecode: Any, sequence: Sequence[Any], lock: Any = True) -> array.array[Any]: ... def Manager() -> Any: ... -def Pool( - processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ... -) -> Any: ... +def Pool(processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ...) -> Any: ... def active_children() -> list[Any]: ... current_process = threading.current_thread diff --git a/stdlib/multiprocessing/dummy/connection.pyi b/stdlib/multiprocessing/dummy/connection.pyi index 258ae695b915..690b9d258f3c 100644 --- a/stdlib/multiprocessing/dummy/connection.pyi +++ b/stdlib/multiprocessing/dummy/connection.pyi @@ -33,7 +33,7 @@ class Listener: def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None ) -> None: ... - def __init__(self, address: _Address | None = ..., family: int | None = ..., backlog: int = ...) -> None: ... + def __init__(self, address: _Address | None = None, family: int | None = None, backlog: int = 1) -> None: ... def accept(self) -> Connection: ... def close(self) -> None: ... diff --git a/stdlib/multiprocessing/heap.pyi b/stdlib/multiprocessing/heap.pyi index 9c8f55604a64..87284f0e12a4 100644 --- a/stdlib/multiprocessing/heap.pyi +++ b/stdlib/multiprocessing/heap.pyi @@ -27,7 +27,7 @@ if sys.platform != "win32": def rebuild_arena(size: int, dupfd: _SupportsDetach) -> Arena: ... class Heap: - def __init__(self, size: int = ...) -> None: ... + def __init__(self, size: int = 16384) -> None: ... def free(self, block: _Block) -> None: ... def malloc(self, size: int) -> _Block: ... diff --git a/stdlib/multiprocessing/managers.pyi b/stdlib/multiprocessing/managers.pyi index 2630e5864520..be0b5863d034 100644 --- a/stdlib/multiprocessing/managers.pyi +++ b/stdlib/multiprocessing/managers.pyi @@ -47,11 +47,11 @@ class BaseProxy: self, token: Any, serializer: str, - manager: Any = ..., - authkey: AnyStr | None = ..., - exposed: Any = ..., - incref: bool = ..., - manager_owned: bool = ..., + manager: Any = None, + authkey: AnyStr | None = None, + exposed: Any = None, + incref: bool = True, + manager_owned: bool = False, ) -> None: ... def __deepcopy__(self, memo: Any | None) -> Any: ... def _callmethod(self, methodname: str, args: tuple[Any, ...] = ..., kwds: dict[Any, Any] = ...) -> None: ... @@ -146,20 +146,20 @@ class BaseManager: def get_server(self) -> Server: ... def connect(self) -> None: ... - def start(self, initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ...) -> None: ... + def start(self, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ...) -> None: ... def shutdown(self) -> None: ... # only available after start() was called - def join(self, timeout: float | None = ...) -> None: ... # undocumented + def join(self, timeout: float | None = None) -> None: ... # undocumented @property def address(self) -> Any: ... @classmethod def register( cls, typeid: str, - callable: Callable[..., object] | None = ..., - proxytype: Any = ..., - exposed: Sequence[str] | None = ..., - method_to_typeid: Mapping[str, str] | None = ..., - create_method: bool = ..., + callable: Callable[..., object] | None = None, + proxytype: Any = None, + exposed: Sequence[str] | None = None, + method_to_typeid: Mapping[str, str] | None = None, + create_method: bool = True, ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( diff --git a/stdlib/multiprocessing/pool.pyi b/stdlib/multiprocessing/pool.pyi index 2b97e16f0525..0f109993f0bb 100644 --- a/stdlib/multiprocessing/pool.pyi +++ b/stdlib/multiprocessing/pool.pyi @@ -26,8 +26,8 @@ class ApplyResult(Generic[_T]): error_callback: Callable[[BaseException], object] | None, ) -> None: ... - def get(self, timeout: float | None = ...) -> _T: ... - def wait(self, timeout: float | None = ...) -> None: ... + def get(self, timeout: float | None = None) -> _T: ... + def wait(self, timeout: float | None = None) -> None: ... def ready(self) -> bool: ... def successful(self) -> bool: ... if sys.version_info >= (3, 9): @@ -63,19 +63,19 @@ class IMapIterator(Iterator[_T]): def __init__(self, cache: dict[int, IMapIterator[Any]]) -> None: ... def __iter__(self: Self) -> Self: ... - def next(self, timeout: float | None = ...) -> _T: ... - def __next__(self, timeout: float | None = ...) -> _T: ... + def next(self, timeout: float | None = None) -> _T: ... + def __next__(self, timeout: float | None = None) -> _T: ... class IMapUnorderedIterator(IMapIterator[_T]): ... class Pool: def __init__( self, - processes: int | None = ..., - initializer: Callable[..., object] | None = ..., + processes: int | None = None, + initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ..., - maxtasksperchild: int | None = ..., - context: Any | None = ..., + maxtasksperchild: int | None = None, + context: Any | None = None, ) -> None: ... def apply(self, func: Callable[..., _T], args: Iterable[Any] = ..., kwds: Mapping[str, Any] = ...) -> _T: ... def apply_async( @@ -83,30 +83,30 @@ class Pool: func: Callable[..., _T], args: Iterable[Any] = ..., kwds: Mapping[str, Any] = ..., - callback: Callable[[_T], object] | None = ..., - error_callback: Callable[[BaseException], object] | None = ..., + callback: Callable[[_T], object] | None = None, + error_callback: Callable[[BaseException], object] | None = None, ) -> AsyncResult[_T]: ... - def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> list[_T]: ... + def map(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = None) -> list[_T]: ... def map_async( self, func: Callable[[_S], _T], iterable: Iterable[_S], - chunksize: int | None = ..., - callback: Callable[[_T], object] | None = ..., - error_callback: Callable[[BaseException], object] | None = ..., + chunksize: int | None = None, + callback: Callable[[_T], object] | None = None, + error_callback: Callable[[BaseException], object] | None = None, ) -> MapResult[_T]: ... - def imap(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ...) -> IMapIterator[_T]: ... + def imap(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = 1) -> IMapIterator[_T]: ... def imap_unordered( - self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = ... + self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = 1 ) -> IMapIterator[_T]: ... - def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = ...) -> list[_T]: ... + def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = None) -> list[_T]: ... def starmap_async( self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], - chunksize: int | None = ..., - callback: Callable[[_T], object] | None = ..., - error_callback: Callable[[BaseException], object] | None = ..., + chunksize: int | None = None, + callback: Callable[[_T], object] | None = None, + error_callback: Callable[[BaseException], object] | None = None, ) -> AsyncResult[list[_T]]: ... def close(self) -> None: ... def terminate(self) -> None: ... @@ -118,7 +118,7 @@ class Pool: class ThreadPool(Pool): def __init__( - self, processes: int | None = ..., initializer: Callable[..., object] | None = ..., initargs: Iterable[Any] = ... + self, processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ... ) -> None: ... # undocumented diff --git a/stdlib/multiprocessing/popen_fork.pyi b/stdlib/multiprocessing/popen_fork.pyi index 3db6a84394b9..4fcbfd99a8d0 100644 --- a/stdlib/multiprocessing/popen_fork.pyi +++ b/stdlib/multiprocessing/popen_fork.pyi @@ -16,8 +16,8 @@ if sys.platform != "win32": def __init__(self, process_obj: BaseProcess) -> None: ... def duplicate_for_child(self, fd: int) -> int: ... - def poll(self, flag: int = ...) -> int | None: ... - def wait(self, timeout: float | None = ...) -> int | None: ... + def poll(self, flag: int = 1) -> int | None: ... + def wait(self, timeout: float | None = None) -> int | None: ... def terminate(self) -> None: ... def kill(self) -> None: ... def close(self) -> None: ... diff --git a/stdlib/multiprocessing/process.pyi b/stdlib/multiprocessing/process.pyi index 7c8422e391c2..ef1b4b596d33 100644 --- a/stdlib/multiprocessing/process.pyi +++ b/stdlib/multiprocessing/process.pyi @@ -14,20 +14,20 @@ class BaseProcess: _identity: tuple[int, ...] # undocumented def __init__( self, - group: None = ..., - target: Callable[..., object] | None = ..., - name: str | None = ..., + group: None = None, + target: Callable[..., object] | None = None, + name: str | None = None, args: Iterable[Any] = ..., kwargs: Mapping[str, Any] = ..., *, - daemon: bool | None = ..., + daemon: bool | None = None, ) -> None: ... def run(self) -> None: ... def start(self) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... def close(self) -> None: ... - def join(self, timeout: float | None = ...) -> None: ... + def join(self, timeout: float | None = None) -> None: ... def is_alive(self) -> bool: ... @property def exitcode(self) -> int | None: ... diff --git a/stdlib/multiprocessing/queues.pyi b/stdlib/multiprocessing/queues.pyi index 02a67216c72b..7ba17dcfbe05 100644 --- a/stdlib/multiprocessing/queues.pyi +++ b/stdlib/multiprocessing/queues.pyi @@ -12,9 +12,9 @@ _T = TypeVar("_T") class Queue(queue.Queue[_T]): # FIXME: `ctx` is a circular dependency and it's not actually optional. # It's marked as such to be able to use the generic Queue in __init__.pyi. - def __init__(self, maxsize: int = ..., *, ctx: Any = ...) -> None: ... - def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... - def put(self, obj: _T, block: bool = ..., timeout: float | None = ...) -> None: ... + def __init__(self, maxsize: int = 0, *, ctx: Any = ...) -> None: ... + def get(self, block: bool = True, timeout: float | None = None) -> _T: ... + def put(self, obj: _T, block: bool = True, timeout: float | None = None) -> None: ... def put_nowait(self, item: _T) -> None: ... def get_nowait(self) -> _T: ... def close(self) -> None: ... diff --git a/stdlib/multiprocessing/reduction.pyi b/stdlib/multiprocessing/reduction.pyi index a55af3f5e796..578b68d81b45 100644 --- a/stdlib/multiprocessing/reduction.pyi +++ b/stdlib/multiprocessing/reduction.pyi @@ -24,7 +24,7 @@ class ForkingPickler(pickle.Pickler): @classmethod def register(cls, type: Type, reduce: Callable[[Any], _ReducedType]) -> None: ... @classmethod - def dumps(cls, obj: Any, protocol: int | None = ...) -> memoryview: ... + def dumps(cls, obj: Any, protocol: int | None = None) -> memoryview: ... loads = pickle.loads register = ForkingPickler.register diff --git a/stdlib/multiprocessing/shared_memory.pyi b/stdlib/multiprocessing/shared_memory.pyi index 3ce0ca3863cc..841c947360e8 100644 --- a/stdlib/multiprocessing/shared_memory.pyi +++ b/stdlib/multiprocessing/shared_memory.pyi @@ -11,7 +11,7 @@ __all__ = ["SharedMemory", "ShareableList"] _SLT = TypeVar("_SLT", int, float, bool, str, bytes, None) class SharedMemory: - def __init__(self, name: str | None = ..., create: bool = ..., size: int = ...) -> None: ... + def __init__(self, name: str | None = None, create: bool = False, size: int = 0) -> None: ... @property def buf(self) -> memoryview: ... @property @@ -24,9 +24,9 @@ class SharedMemory: class ShareableList(Generic[_SLT]): shm: SharedMemory @overload - def __init__(self, sequence: None = ..., *, name: str | None = ...) -> None: ... + def __init__(self, sequence: None = None, *, name: str | None = None) -> None: ... @overload - def __init__(self, sequence: Iterable[_SLT], *, name: str | None = ...) -> None: ... + def __init__(self, sequence: Iterable[_SLT], *, name: str | None = None) -> None: ... def __getitem__(self, position: int) -> _SLT: ... def __setitem__(self, position: int, value: _SLT) -> None: ... def __reduce__(self: Self) -> tuple[Self, tuple[_SLT, ...]]: ... diff --git a/stdlib/multiprocessing/sharedctypes.pyi b/stdlib/multiprocessing/sharedctypes.pyi index e988cda322f4..f0a1f500c71f 100644 --- a/stdlib/multiprocessing/sharedctypes.pyi +++ b/stdlib/multiprocessing/sharedctypes.pyi @@ -78,7 +78,7 @@ class _AcquireFunc(Protocol): class SynchronizedBase(Generic[_CT]): acquire: _AcquireFunc release: Callable[[], None] - def __init__(self, obj: Any, lock: _LockLike | None = ..., ctx: Any | None = ...) -> None: ... + def __init__(self, obj: Any, lock: _LockLike | None = None, ctx: Any | None = None) -> None: ... def __reduce__(self) -> tuple[Callable[[Any, _LockLike], SynchronizedBase[Any]], tuple[Any, _LockLike]]: ... def get_obj(self) -> _CT: ... def get_lock(self) -> _LockLike: ... diff --git a/stdlib/multiprocessing/synchronize.pyi b/stdlib/multiprocessing/synchronize.pyi index c89142f2cd3b..7043759078a2 100644 --- a/stdlib/multiprocessing/synchronize.pyi +++ b/stdlib/multiprocessing/synchronize.pyi @@ -11,18 +11,18 @@ _LockLike: TypeAlias = Lock | RLock class Barrier(threading.Barrier): def __init__( - self, parties: int, action: Callable[[], object] | None = ..., timeout: float | None = ..., *ctx: BaseContext + self, parties: int, action: Callable[[], object] | None = None, timeout: float | None = None, *ctx: BaseContext ) -> None: ... class BoundedSemaphore(Semaphore): - def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ... + def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ... class Condition(AbstractContextManager[bool]): - def __init__(self, lock: _LockLike | None = ..., *, ctx: BaseContext) -> None: ... - def notify(self, n: int = ...) -> None: ... + def __init__(self, lock: _LockLike | None = None, *, ctx: BaseContext) -> None: ... + def notify(self, n: int = 1) -> None: ... def notify_all(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... - def wait_for(self, predicate: Callable[[], bool], timeout: float | None = ...) -> bool: ... + def wait(self, timeout: float | None = None) -> bool: ... + def wait_for(self, predicate: Callable[[], bool], timeout: float | None = None) -> bool: ... def acquire(self, block: bool = ..., timeout: float | None = ...) -> bool: ... def release(self) -> None: ... def __exit__( @@ -34,7 +34,7 @@ class Event: def is_set(self) -> bool: ... def set(self) -> None: ... def clear(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... + def wait(self, timeout: float | None = None) -> bool: ... class Lock(SemLock): def __init__(self, *, ctx: BaseContext) -> None: ... @@ -43,7 +43,7 @@ class RLock(SemLock): def __init__(self, *, ctx: BaseContext) -> None: ... class Semaphore(SemLock): - def __init__(self, value: int = ..., *, ctx: BaseContext) -> None: ... + def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ... # Not part of public API class SemLock(AbstractContextManager[bool]): diff --git a/stdlib/multiprocessing/util.pyi b/stdlib/multiprocessing/util.pyi index 2a9eef8d7104..006ec3a9f6ce 100644 --- a/stdlib/multiprocessing/util.pyi +++ b/stdlib/multiprocessing/util.pyi @@ -51,12 +51,12 @@ class Finalize: obj: Incomplete | None, callback: Callable[..., Incomplete], args: Sequence[Any] = ..., - kwargs: Mapping[str, Any] | None = ..., - exitpriority: int | None = ..., + kwargs: Mapping[str, Any] | None = None, + exitpriority: int | None = None, ) -> None: ... def __call__( self, - wr: Unused = ..., + wr: Unused = None, _finalizer_registry: MutableMapping[Incomplete, Incomplete] = ..., sub_debug: Callable[..., object] = ..., getpid: Callable[[], int] = ..., diff --git a/stdlib/netrc.pyi b/stdlib/netrc.pyi index 217c0eb542d0..480f55a46d64 100644 --- a/stdlib/netrc.pyi +++ b/stdlib/netrc.pyi @@ -8,7 +8,7 @@ class NetrcParseError(Exception): filename: str | None lineno: int | None msg: str - def __init__(self, msg: str, filename: StrOrBytesPath | None = ..., lineno: int | None = ...) -> None: ... + def __init__(self, msg: str, filename: StrOrBytesPath | None = None, lineno: int | None = None) -> None: ... # (login, account, password) tuple if sys.version_info >= (3, 11): @@ -19,5 +19,5 @@ else: class netrc: hosts: dict[str, _NetrcTuple] macros: dict[str, list[str]] - def __init__(self, file: StrOrBytesPath | None = ...) -> None: ... + def __init__(self, file: StrOrBytesPath | None = None) -> None: ... def authenticators(self, host: str) -> _NetrcTuple | None: ... diff --git a/stdlib/nntplib.pyi b/stdlib/nntplib.pyi index 8244be149996..12d105a68150 100644 --- a/stdlib/nntplib.pyi +++ b/stdlib/nntplib.pyi @@ -65,11 +65,11 @@ class NNTP: def __init__( self, host: str, - port: int = ..., - user: str | None = ..., - password: str | None = ..., - readermode: bool | None = ..., - usenetrc: bool = ..., + port: int = 119, + user: str | None = None, + password: str | None = None, + readermode: bool | None = None, + usenetrc: bool = False, timeout: float = ..., ) -> None: ... def __enter__(self: Self) -> Self: ... @@ -79,24 +79,24 @@ class NNTP: def set_debuglevel(self, level: int) -> None: ... def debug(self, level: int) -> None: ... def capabilities(self) -> tuple[str, dict[str, _list[str]]]: ... - def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = ...) -> tuple[str, _list[str]]: ... - def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = ...) -> tuple[str, _list[str]]: ... - def list(self, group_pattern: str | None = ..., *, file: _File = ...) -> tuple[str, _list[str]]: ... + def newgroups(self, date: datetime.date | datetime.datetime, *, file: _File = None) -> tuple[str, _list[str]]: ... + def newnews(self, group: str, date: datetime.date | datetime.datetime, *, file: _File = None) -> tuple[str, _list[str]]: ... + def list(self, group_pattern: str | None = None, *, file: _File = None) -> tuple[str, _list[str]]: ... def description(self, group: str) -> str: ... def descriptions(self, group_pattern: str) -> tuple[str, dict[str, str]]: ... def group(self, name: str) -> tuple[str, int, int, int, str]: ... - def help(self, *, file: _File = ...) -> tuple[str, _list[str]]: ... - def stat(self, message_spec: Any = ...) -> tuple[str, int, str]: ... + def help(self, *, file: _File = None) -> tuple[str, _list[str]]: ... + def stat(self, message_spec: Any = None) -> tuple[str, int, str]: ... def next(self) -> tuple[str, int, str]: ... def last(self) -> tuple[str, int, str]: ... - def head(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... - def body(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... - def article(self, message_spec: Any = ..., *, file: _File = ...) -> tuple[str, ArticleInfo]: ... + def head(self, message_spec: Any = None, *, file: _File = None) -> tuple[str, ArticleInfo]: ... + def body(self, message_spec: Any = None, *, file: _File = None) -> tuple[str, ArticleInfo]: ... + def article(self, message_spec: Any = None, *, file: _File = None) -> tuple[str, ArticleInfo]: ... def slave(self) -> str: ... - def xhdr(self, hdr: str, str: Any, *, file: _File = ...) -> tuple[str, _list[str]]: ... - def xover(self, start: int, end: int, *, file: _File = ...) -> tuple[str, _list[tuple[int, dict[str, str]]]]: ... + def xhdr(self, hdr: str, str: Any, *, file: _File = None) -> tuple[str, _list[str]]: ... + def xover(self, start: int, end: int, *, file: _File = None) -> tuple[str, _list[tuple[int, dict[str, str]]]]: ... def over( - self, message_spec: None | str | _list[Any] | tuple[Any, ...], *, file: _File = ... + self, message_spec: None | str | _list[Any] | tuple[Any, ...], *, file: _File = None ) -> tuple[str, _list[tuple[int, dict[str, str]]]]: ... if sys.version_info < (3, 9): def xgtitle(self, group: str, *, file: _File = ...) -> tuple[str, _list[tuple[str, str]]]: ... @@ -106,8 +106,8 @@ class NNTP: def post(self, data: bytes | Iterable[bytes]) -> str: ... def ihave(self, message_id: Any, data: bytes | Iterable[bytes]) -> str: ... def quit(self) -> str: ... - def login(self, user: str | None = ..., password: str | None = ..., usenetrc: bool = ...) -> None: ... - def starttls(self, context: ssl.SSLContext | None = ...) -> None: ... + def login(self, user: str | None = None, password: str | None = None, usenetrc: bool = True) -> None: ... + def starttls(self, context: ssl.SSLContext | None = None) -> None: ... class NNTP_SSL(NNTP): ssl_context: ssl.SSLContext | None @@ -115,11 +115,11 @@ class NNTP_SSL(NNTP): def __init__( self, host: str, - port: int = ..., - user: str | None = ..., - password: str | None = ..., - ssl_context: ssl.SSLContext | None = ..., - readermode: bool | None = ..., - usenetrc: bool = ..., + port: int = 563, + user: str | None = None, + password: str | None = None, + ssl_context: ssl.SSLContext | None = None, + readermode: bool | None = None, + usenetrc: bool = False, timeout: float = ..., ) -> None: ... diff --git a/stdlib/numbers.pyi b/stdlib/numbers.pyi index d94ae7faf890..55f21041ae44 100644 --- a/stdlib/numbers.pyi +++ b/stdlib/numbers.pyi @@ -60,7 +60,7 @@ class Real(Complex, SupportsFloat): def __ceil__(self) -> int: ... @abstractmethod @overload - def __round__(self, ndigits: None = ...) -> int: ... + def __round__(self, ndigits: None = None) -> int: ... @abstractmethod @overload def __round__(self, ndigits: int) -> Any: ... @@ -99,7 +99,7 @@ class Integral(Rational): def __int__(self) -> int: ... def __index__(self) -> int: ... @abstractmethod - def __pow__(self, exponent: Any, modulus: Any | None = ...) -> Any: ... + def __pow__(self, exponent: Any, modulus: Any | None = None) -> Any: ... @abstractmethod def __lshift__(self, other: Any) -> Any: ... @abstractmethod diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 5cff39717a7b..14f74ca7fe02 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -82,14 +82,14 @@ class HelpFormatter: class IndentedHelpFormatter(HelpFormatter): def __init__( - self, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ..., short_first: int = ... + self, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, short_first: int = 1 ) -> None: ... def format_heading(self, heading: str) -> str: ... def format_usage(self, usage: str) -> str: ... class TitledHelpFormatter(HelpFormatter): def __init__( - self, indent_increment: int = ..., max_help_position: int = ..., width: int | None = ..., short_first: int = ... + self, indent_increment: int = 0, max_help_position: int = 24, width: int | None = None, short_first: int = 0 ) -> None: ... def format_heading(self, heading: str) -> str: ... def format_usage(self, usage: str) -> str: ... @@ -167,18 +167,18 @@ class OptionGroup(OptionContainer): option_list: list[Option] parser: OptionParser title: str - def __init__(self, parser: OptionParser, title: str, description: str | None = ...) -> None: ... + def __init__(self, parser: OptionParser, title: str, description: str | None = None) -> None: ... def _create_option_list(self) -> None: ... def set_title(self, title: str) -> None: ... class Values: - def __init__(self, defaults: Mapping[str, Any] | None = ...) -> None: ... + def __init__(self, defaults: Mapping[str, Any] | None = None) -> None: ... def _update(self, dict: Mapping[str, Any], mode: Any) -> None: ... def _update_careful(self, dict: Mapping[str, Any]) -> None: ... def _update_loose(self, dict: Mapping[str, Any]) -> None: ... def ensure_value(self, attr: str, value: Any) -> Any: ... - def read_file(self, filename: str, mode: str = ...) -> None: ... - def read_module(self, modname: str, mode: str = ...) -> None: ... + def read_file(self, filename: str, mode: str = 'careful') -> None: ... + def read_module(self, modname: str, mode: str = 'careful') -> None: ... def __getattr__(self, name: str) -> Any: ... def __setattr__(self, __name: str, __value: Any) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -199,16 +199,16 @@ class OptionParser(OptionContainer): version: str def __init__( self, - usage: str | None = ..., - option_list: Iterable[Option] | None = ..., + usage: str | None = None, + option_list: Iterable[Option] | None = None, option_class: type[Option] = ..., - version: str | None = ..., - conflict_handler: str = ..., - description: str | None = ..., - formatter: HelpFormatter | None = ..., - add_help_option: bool = ..., - prog: str | None = ..., - epilog: str | None = ..., + version: str | None = None, + conflict_handler: str = 'error', + description: str | None = None, + formatter: HelpFormatter | None = None, + add_help_option: bool = True, + prog: str | None = None, + epilog: str | None = None, ) -> None: ... def _add_help_option(self) -> None: ... def _add_version_option(self) -> None: ... @@ -217,7 +217,7 @@ class OptionParser(OptionContainer): def _get_args(self, args: Iterable[Any]) -> list[Any]: ... def _init_parsing_state(self) -> None: ... def _match_long_opt(self, opt: str) -> str: ... - def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = ...) -> None: ... + def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = True) -> None: ... def _process_args(self, largs: list[Any], rargs: list[Any], values: Values) -> None: ... def _process_long_opt(self, rargs: list[Any], values: Any) -> None: ... def _process_short_opts(self, rargs: list[Any], values: Any) -> None: ... @@ -229,23 +229,23 @@ class OptionParser(OptionContainer): def disable_interspersed_args(self) -> None: ... def enable_interspersed_args(self) -> None: ... def error(self, msg: str) -> None: ... - def exit(self, status: int = ..., msg: str | None = ...) -> None: ... + def exit(self, status: int = 0, msg: str | None = None) -> None: ... def expand_prog_name(self, s: str | None) -> Any: ... def format_epilog(self, formatter: HelpFormatter) -> Any: ... - def format_help(self, formatter: HelpFormatter | None = ...) -> str: ... - def format_option_help(self, formatter: HelpFormatter | None = ...) -> str: ... + def format_help(self, formatter: HelpFormatter | None = None) -> str: ... + def format_option_help(self, formatter: HelpFormatter | None = None) -> str: ... def get_default_values(self) -> Values: ... def get_option_group(self, opt_str: str) -> Any: ... def get_prog_name(self) -> str: ... def get_usage(self) -> str: ... def get_version(self) -> str: ... @overload - def parse_args(self, args: None = ..., values: Values | None = ...) -> tuple[Values, list[str]]: ... + def parse_args(self, args: None = None, values: Values | None = None) -> tuple[Values, list[str]]: ... @overload - def parse_args(self, args: Sequence[AnyStr], values: Values | None = ...) -> tuple[Values, list[AnyStr]]: ... - def print_usage(self, file: IO[str] | None = ...) -> None: ... - def print_help(self, file: IO[str] | None = ...) -> None: ... - def print_version(self, file: IO[str] | None = ...) -> None: ... + def parse_args(self, args: Sequence[AnyStr], values: Values | None = None) -> tuple[Values, list[AnyStr]]: ... + def print_usage(self, file: IO[str] | None = None) -> None: ... + def print_help(self, file: IO[str] | None = None) -> None: ... + def print_version(self, file: IO[str] | None = None) -> None: ... def set_default(self, dest: Any, value: Any) -> None: ... def set_defaults(self, **kwargs: Any) -> None: ... def set_process_default_values(self, process: Any) -> None: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index d7c6908fbd8f..f3f49b9e8338 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -382,10 +382,10 @@ class DirEntry(Generic[AnyStr]): @property def path(self) -> AnyStr: ... def inode(self) -> int: ... - def is_dir(self, *, follow_symlinks: bool = ...) -> bool: ... - def is_file(self, *, follow_symlinks: bool = ...) -> bool: ... + def is_dir(self, *, follow_symlinks: bool = True) -> bool: ... + def is_file(self, *, follow_symlinks: bool = True) -> bool: ... def is_symlink(self) -> bool: ... - def stat(self, *, follow_symlinks: bool = ...) -> stat_result: ... + def stat(self, *, follow_symlinks: bool = True) -> stat_result: ... def __fspath__(self) -> AnyStr: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... @@ -684,7 +684,7 @@ if sys.platform != "win32": def getcwd() -> str: ... def getcwdb() -> bytes: ... -def chmod(path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> None: ... +def chmod(path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> None: ... if sys.platform != "win32" and sys.platform != "linux": def chflags(path: StrOrBytesPath, flags: int, follow_symlinks: bool = True) -> None: ... # some flavors of Unix @@ -694,7 +694,7 @@ if sys.platform != "win32" and sys.platform != "linux": if sys.platform != "win32": def chroot(path: StrOrBytesPath) -> None: ... def chown( - path: FileDescriptorOrPath, uid: int, gid: int, *, dir_fd: int | None = ..., follow_symlinks: bool = ... + path: FileDescriptorOrPath, uid: int, gid: int, *, dir_fd: int | None = None, follow_symlinks: bool = True ) -> None: ... def lchown(path: StrOrBytesPath, uid: int, gid: int) -> None: ... @@ -726,9 +726,7 @@ def remove(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... def removedirs(name: StrOrBytesPath) -> None: ... def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: ... -def replace( - src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None -) -> None: ... +def replace(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr]]): @@ -742,20 +740,18 @@ def scandir(path: None = ...) -> _ScandirIterator[str]: ... def scandir(path: int) -> _ScandirIterator[str]: ... @overload def scandir(path: GenericPath[AnyStr]) -> _ScandirIterator[AnyStr]: ... -def stat(path: FileDescriptorOrPath, *, dir_fd: int | None = ..., follow_symlinks: bool = ...) -> stat_result: ... +def stat(path: FileDescriptorOrPath, *, dir_fd: int | None = None, follow_symlinks: bool = True) -> stat_result: ... if sys.platform != "win32": def statvfs(path: FileDescriptorOrPath) -> statvfs_result: ... # Unix only -def symlink( - src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None -) -> None: ... +def symlink(src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None) -> None: ... if sys.platform != "win32": def sync() -> None: ... # Unix only def truncate(path: FileDescriptorOrPath, length: int) -> None: ... # Unix only up to version 3.4 -def unlink(path: StrOrBytesPath, *, dir_fd: int | None = ...) -> None: ... +def unlink(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... def utime( path: FileDescriptorOrPath, times: tuple[int, int] | tuple[float, float] | None = ..., @@ -854,7 +850,7 @@ class _wrap_close(_TextIOWrapper): def __init__(self, stream: _TextIOWrapper, proc: Popen[str]) -> None: ... def close(self) -> int | None: ... # type: ignore[override] -def popen(cmd: str, mode: str = "r", buffering: int = ...) -> _wrap_close: ... +def popen(cmd: str, mode: str = 'r', buffering: int = -1) -> _wrap_close: ... def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index 79c2352a0f85..de434f56285a 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -99,61 +99,61 @@ class Path(PurePath): def iterdir(self: Self) -> Generator[Self, None, None]: ... def lchmod(self, mode: int) -> None: ... def lstat(self) -> stat_result: ... - def mkdir(self, mode: int = ..., parents: bool = ..., exist_ok: bool = ...) -> None: ... + def mkdir(self, mode: int = 511, parents: bool = False, exist_ok: bool = False) -> None: ... # Adapted from builtins.open # Text mode: always returns a TextIOWrapper # The Traversable .open in stdlib/importlib/abc.pyi should be kept in sync with this. @overload def open( self, - mode: OpenTextMode = ..., - buffering: int = ..., - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., + mode: OpenTextMode = 'r', + buffering: int = -1, + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, ) -> TextIOWrapper: ... # Unbuffered binary mode: returns a FileIO @overload def open( - self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ... + self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = None, errors: None = None, newline: None = None ) -> FileIO: ... # Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter @overload def open( self, mode: OpenBinaryModeUpdating, - buffering: Literal[-1, 1] = ..., - encoding: None = ..., - errors: None = ..., - newline: None = ..., + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, ) -> BufferedRandom: ... @overload def open( self, mode: OpenBinaryModeWriting, - buffering: Literal[-1, 1] = ..., - encoding: None = ..., - errors: None = ..., - newline: None = ..., + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, ) -> BufferedWriter: ... @overload def open( self, mode: OpenBinaryModeReading, - buffering: Literal[-1, 1] = ..., - encoding: None = ..., - errors: None = ..., - newline: None = ..., + buffering: Literal[-1, 1] = -1, + encoding: None = None, + errors: None = None, + newline: None = None, ) -> BufferedReader: ... # Buffering cannot be determined: fall back to BinaryIO @overload def open( - self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ... + self, mode: OpenBinaryMode, buffering: int = -1, encoding: None = None, errors: None = None, newline: None = None ) -> BinaryIO: ... # Fallback if mode is not specified @overload def open( - self, mode: str, buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., newline: str | None = ... + self, mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None ) -> IO[Any]: ... if sys.platform != "win32": # These methods do "exist" on Windows, but they always raise NotImplementedError, @@ -171,14 +171,14 @@ class Path(PurePath): def rename(self, target: str | PurePath) -> None: ... def replace(self, target: str | PurePath) -> None: ... - def resolve(self: Self, strict: bool = ...) -> Self: ... + def resolve(self: Self, strict: bool = False) -> Self: ... def rglob(self: Self, pattern: str) -> Generator[Self, None, None]: ... def rmdir(self) -> None: ... - def symlink_to(self, target: str | Path, target_is_directory: bool = ...) -> None: ... + def symlink_to(self, target: str | Path, target_is_directory: bool = False) -> None: ... if sys.version_info >= (3, 10): def hardlink_to(self, target: str | Path) -> None: ... - def touch(self, mode: int = ..., exist_ok: bool = ...) -> None: ... + def touch(self, mode: int = 438, exist_ok: bool = True) -> None: ... if sys.version_info >= (3, 8): def unlink(self, missing_ok: bool = ...) -> None: ... else: @@ -189,7 +189,7 @@ class Path(PurePath): def absolute(self: Self) -> Self: ... def expanduser(self: Self) -> Self: ... def read_bytes(self) -> bytes: ... - def read_text(self, encoding: str | None = ..., errors: str | None = ...) -> str: ... + def read_text(self, encoding: str | None = None, errors: str | None = None) -> str: ... def samefile(self, other_path: StrPath) -> bool: ... def write_bytes(self, data: ReadableBuffer) -> int: ... if sys.version_info >= (3, 10): diff --git a/stdlib/pdb.pyi b/stdlib/pdb.pyi index bcdd66539074..36b81ccbc988 100644 --- a/stdlib/pdb.pyi +++ b/stdlib/pdb.pyi @@ -47,12 +47,12 @@ class Pdb(Bdb, Cmd): curframe_locals: Mapping[str, Any] def __init__( self, - completekey: str = ..., - stdin: IO[str] | None = ..., - stdout: IO[str] | None = ..., - skip: Iterable[str] | None = ..., - nosigint: bool = ..., - readrc: bool = ..., + completekey: str = 'tab', + stdin: IO[str] | None = None, + stdout: IO[str] | None = None, + skip: Iterable[str] | None = None, + nosigint: bool = False, + readrc: bool = True, ) -> None: ... def forget(self) -> None: ... def setup(self, f: FrameType | None, tb: TracebackType | None) -> None: ... @@ -66,7 +66,7 @@ class Pdb(Bdb, Cmd): def checkline(self, filename: str, lineno: int) -> int: ... def _getval(self, arg: str) -> object: ... def print_stack_trace(self) -> None: ... - def print_stack_entry(self, frame_lineno: tuple[FrameType, int], prompt_prefix: str = ...) -> None: ... + def print_stack_entry(self, frame_lineno: tuple[FrameType, int], prompt_prefix: str = '\n-> ') -> None: ... def lookupmodule(self, filename: str) -> str | None: ... if sys.version_info < (3, 11): def _runscript(self, filename: str) -> None: ... @@ -127,9 +127,9 @@ class Pdb(Bdb, Cmd): def message(self, msg: str) -> None: ... def error(self, msg: str) -> None: ... def _select_frame(self, number: int) -> None: ... - def _getval_except(self, arg: str, frame: FrameType | None = ...) -> object: ... + def _getval_except(self, arg: str, frame: FrameType | None = None) -> object: ... def _print_lines( - self, lines: Sequence[str], start: int, breaks: Sequence[int] = ..., frame: FrameType | None = ... + self, lines: Sequence[str], start: int, breaks: Sequence[int] = ..., frame: FrameType | None = None ) -> None: ... def _cmdloop(self) -> None: ... def do_display(self, arg: str) -> bool | None: ... diff --git a/stdlib/pickle.pyi b/stdlib/pickle.pyi index dc098cae97b7..7e005012321b 100644 --- a/stdlib/pickle.pyi +++ b/stdlib/pickle.pyi @@ -119,24 +119,24 @@ if sys.version_info >= (3, 8): file: _ReadableFileobj, *, fix_imports: bool = True, - encoding: str = "ASCII", - errors: str = "strict", + encoding: str = 'ASCII', + errors: str = 'strict', buffers: Iterable[Any] | None = ..., ) -> Any: ... def loads( __data: ReadableBuffer, *, fix_imports: bool = True, - encoding: str = "ASCII", - errors: str = "strict", + encoding: str = 'ASCII', + errors: str = 'strict', buffers: Iterable[Any] | None = ..., ) -> Any: ... else: - def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = None, *, fix_imports: bool = True) -> None: ... - def dumps(obj: Any, protocol: int | None = None, *, fix_imports: bool = True) -> bytes: ... - def load(file: _ReadableFileobj, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ... - def loads(data: ReadableBuffer, *, fix_imports: bool = True, encoding: str = "ASCII", errors: str = "strict") -> Any: ... + def dump(obj: Any, file: SupportsWrite[bytes], protocol: int | None = ..., *, fix_imports: bool = ...) -> None: ... + def dumps(obj: Any, protocol: int | None = ..., *, fix_imports: bool = ...) -> bytes: ... + def load(file: _ReadableFileobj, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... + def loads(data: ReadableBuffer, *, fix_imports: bool = ..., encoding: str = ..., errors: str = ...) -> Any: ... class PickleError(Exception): ... class PicklingError(PickleError): ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index 16f6a696808b..cb4da81679f2 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -29,7 +29,7 @@ class ModuleInfo(NamedTuple): def extend_path(path: _PathT, name: str) -> _PathT: ... class ImpImporter: - def __init__(self, path: str | None = ...) -> None: ... + def __init__(self, path: str | None = None) -> None: ... class ImpLoader: def __init__(self, fullname: str, file: IO[str], filename: str, etc: tuple[str, str, int]) -> None: ... @@ -37,11 +37,11 @@ class ImpLoader: def find_loader(fullname: str) -> Loader | None: ... def get_importer(path_item: str) -> PathEntryFinder | None: ... def get_loader(module_or_name: str) -> Loader | None: ... -def iter_importers(fullname: str = "") -> Iterator[MetaPathFinder | PathEntryFinder]: ... -def iter_modules(path: Iterable[str] | None = None, prefix: str = "") -> Iterator[ModuleInfo]: ... +def iter_importers(fullname: str = '') -> Iterator[MetaPathFinder | PathEntryFinder]: ... +def iter_modules(path: Iterable[str] | None = None, prefix: str = '') -> Iterator[ModuleInfo]: ... def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented def walk_packages( - path: Iterable[str] | None = None, prefix: str = "", onerror: Callable[[str], object] | None = None + path: Iterable[str] | None = None, prefix: str = '', onerror: Callable[[str], object] | None = None ) -> Iterator[ModuleInfo]: ... def get_data(package: str, resource: str) -> bytes | None: ... diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index 937b8be60810..f8fa5ea5c603 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -7,10 +7,10 @@ if sys.version_info < (3, 8): from typing import NamedTuple if sys.version_info >= (3, 8): - def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... + def libc_ver(executable: str | None = None, lib: str = '', version: str = '', chunksize: int = 16384) -> tuple[str, str]: ... else: - def libc_ver(executable: str = ..., lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... + def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> tuple[str, str]: ... if sys.version_info < (3, 8): def linux_distribution( @@ -24,20 +24,20 @@ if sys.version_info < (3, 8): distname: str = ..., version: str = ..., id: str = ..., supported_dists: tuple[str, ...] = ... ) -> tuple[str, str, str]: ... -def win32_ver(release: str = "", version: str = "", csd: str = "", ptype: str = "") -> tuple[str, str, str, str]: ... +def win32_ver(release: str = '', version: str = '', csd: str = '', ptype: str = '') -> tuple[str, str, str, str]: ... if sys.version_info >= (3, 8): def win32_edition() -> str: ... def win32_is_iot() -> bool: ... def mac_ver( - release: str = "", versioninfo: tuple[str, str, str] = ..., machine: str = "" + release: str = '', versioninfo: tuple[str, str, str] = ..., machine: str = '' ) -> tuple[str, tuple[str, str, str], str]: ... def java_ver( - release: str = "", vendor: str = "", vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... + release: str = '', vendor: str = '', vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... ) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... -def architecture(executable: str = ..., bits: str = "", linkage: str = "") -> tuple[str, str]: ... +def architecture(executable: str = '/Users/jelle/py/venvs/py311/bin/python', bits: str = '', linkage: str = '') -> tuple[str, str]: ... class uname_result(NamedTuple): system: str diff --git a/stdlib/plistlib.pyi b/stdlib/plistlib.pyi index 9ba83b41cf3a..576dcfb7cf30 100644 --- a/stdlib/plistlib.pyi +++ b/stdlib/plistlib.pyi @@ -56,14 +56,14 @@ else: def load( fp: IO[bytes], *, - fmt: PlistFormat | None = None, + fmt: PlistFormat | None = ..., use_builtin_types: bool = ..., dict_type: type[MutableMapping[str, Any]] = ..., ) -> Any: ... def loads( value: ReadableBuffer, *, - fmt: PlistFormat | None = None, + fmt: PlistFormat | None = ..., use_builtin_types: bool = ..., dict_type: type[MutableMapping[str, Any]] = ..., ) -> Any: ... @@ -104,4 +104,4 @@ if sys.version_info >= (3, 8): def __eq__(self, other: object) -> bool: ... class InvalidFileException(ValueError): - def __init__(self, message: str = ...) -> None: ... + def __init__(self, message: str = 'Invalid file') -> None: ... diff --git a/stdlib/poplib.pyi b/stdlib/poplib.pyi index fd7afedaad05..c64e47e8ef72 100644 --- a/stdlib/poplib.pyi +++ b/stdlib/poplib.pyi @@ -25,13 +25,13 @@ class POP3: sock: socket.socket file: BinaryIO welcome: bytes - def __init__(self, host: str, port: int = ..., timeout: float = ...) -> None: ... + def __init__(self, host: str, port: int = 110, timeout: float = ...) -> None: ... def getwelcome(self) -> bytes: ... def set_debuglevel(self, level: int) -> None: ... def user(self, user: str) -> bytes: ... def pass_(self, pswd: str) -> bytes: ... def stat(self) -> tuple[int, int]: ... - def list(self, which: Any | None = ...) -> _LongResp: ... + def list(self, which: Any | None = None) -> _LongResp: ... def retr(self, which: Any) -> _LongResp: ... def dele(self, which: Any) -> bytes: ... def noop(self) -> bytes: ... @@ -48,17 +48,17 @@ class POP3: def uidl(self, which: Any) -> bytes: ... def utf8(self) -> bytes: ... def capa(self) -> dict[str, _list[str]]: ... - def stls(self, context: ssl.SSLContext | None = ...) -> bytes: ... + def stls(self, context: ssl.SSLContext | None = None) -> bytes: ... class POP3_SSL(POP3): def __init__( self, host: str, - port: int = ..., - keyfile: str | None = ..., - certfile: str | None = ..., + port: int = 995, + keyfile: str | None = None, + certfile: str | None = None, timeout: float = ..., - context: ssl.SSLContext | None = ..., + context: ssl.SSLContext | None = None, ) -> None: ... # "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored - def stls(self, context: Any = ..., keyfile: Any = ..., certfile: Any = ...) -> NoReturn: ... + def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ... diff --git a/stdlib/pprint.pyi b/stdlib/pprint.pyi index 98f474f12a0a..d29a24f2382f 100644 --- a/stdlib/pprint.pyi +++ b/stdlib/pprint.pyi @@ -21,16 +21,16 @@ if sys.version_info >= (3, 10): elif sys.version_info >= (3, 8): def pformat( object: object, - indent: int = 1, - width: int = 80, - depth: int | None = None, + indent: int = ..., + width: int = ..., + depth: int | None = ..., *, - compact: bool = False, - sort_dicts: bool = True, + compact: bool = ..., + sort_dicts: bool = ..., ) -> str: ... else: - def pformat(object: object, indent: int = 1, width: int = 80, depth: int | None = None, *, compact: bool = False) -> str: ... + def pformat(object: object, indent: int = ..., width: int = ..., depth: int | None = ..., *, compact: bool = ...) -> str: ... if sys.version_info >= (3, 10): def pp( @@ -54,7 +54,7 @@ elif sys.version_info >= (3, 8): depth: int | None = ..., *, compact: bool = ..., - sort_dicts: bool = False, + sort_dicts: bool = ..., ) -> None: ... if sys.version_info >= (3, 10): @@ -73,24 +73,24 @@ if sys.version_info >= (3, 10): elif sys.version_info >= (3, 8): def pprint( object: object, - stream: IO[str] | None = None, - indent: int = 1, - width: int = 80, - depth: int | None = None, + stream: IO[str] | None = ..., + indent: int = ..., + width: int = ..., + depth: int | None = ..., *, - compact: bool = False, - sort_dicts: bool = True, + compact: bool = ..., + sort_dicts: bool = ..., ) -> None: ... else: def pprint( object: object, - stream: IO[str] | None = None, - indent: int = 1, - width: int = 80, - depth: int | None = None, + stream: IO[str] | None = ..., + indent: int = ..., + width: int = ..., + depth: int | None = ..., *, - compact: bool = False, + compact: bool = ..., ) -> None: ... def isreadable(object: object) -> bool: ... diff --git a/stdlib/profile.pyi b/stdlib/profile.pyi index bca5a3edc2b8..8d6e9b220587 100644 --- a/stdlib/profile.pyi +++ b/stdlib/profile.pyi @@ -5,9 +5,9 @@ from typing_extensions import ParamSpec, TypeAlias __all__ = ["run", "runctx", "Profile"] -def run(statement: str, filename: str | None = None, sort: str | int = ...) -> None: ... +def run(statement: str, filename: str | None = None, sort: str | int = -1) -> None: ... def runctx( - statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = None, sort: str | int = ... + statement: str, globals: dict[str, Any], locals: dict[str, Any], filename: str | None = None, sort: str | int = -1 ) -> None: ... _T = TypeVar("_T") @@ -17,15 +17,15 @@ _Label: TypeAlias = tuple[str, int, str] class Profile: bias: int stats: dict[_Label, tuple[int, int, int, int, dict[_Label, tuple[int, int, int, int]]]] # undocumented - def __init__(self, timer: Callable[[], float] | None = ..., bias: int | None = ...) -> None: ... + def __init__(self, timer: Callable[[], float] | None = None, bias: int | None = None) -> None: ... def set_cmd(self, cmd: str) -> None: ... def simulate_call(self, name: str) -> None: ... def simulate_cmd_complete(self) -> None: ... - def print_stats(self, sort: str | int = ...) -> None: ... + def print_stats(self, sort: str | int = -1) -> None: ... def dump_stats(self, file: StrOrBytesPath) -> None: ... def create_stats(self) -> None: ... def snapshot_stats(self) -> None: ... def run(self: Self, cmd: str) -> Self: ... def runctx(self: Self, cmd: str, globals: dict[str, Any], locals: dict[str, Any]) -> Self: ... def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... - def calibrate(self, m: int, verbose: int = ...) -> float: ... + def calibrate(self, m: int, verbose: int = 0) -> float: ... diff --git a/stdlib/pstats.pyi b/stdlib/pstats.pyi index 10d817b59630..60d7a40623c2 100644 --- a/stdlib/pstats.pyi +++ b/stdlib/pstats.pyi @@ -50,7 +50,7 @@ class Stats: self: Self, __arg: None | str | Profile | _cProfile = ..., *args: None | str | Profile | _cProfile | Self, - stream: IO[Any] | None = ..., + stream: IO[Any] | None = None, ) -> None: ... def init(self, arg: None | str | Profile | _cProfile) -> None: ... def load_stats(self, arg: None | str | Profile | _cProfile) -> None: ... @@ -74,6 +74,6 @@ class Stats: def print_callees(self: Self, *amount: _Selector) -> Self: ... def print_callers(self: Self, *amount: _Selector) -> Self: ... def print_call_heading(self, name_size: int, column_title: str) -> None: ... - def print_call_line(self, name_size: int, source: str, call_dict: dict[str, Any], arrow: str = ...) -> None: ... + def print_call_line(self, name_size: int, source: str, call_dict: dict[str, Any], arrow: str = '->') -> None: ... def print_title(self) -> None: ... def print_line(self, func: str) -> None: ... diff --git a/stdlib/py_compile.pyi b/stdlib/py_compile.pyi index 83350566412f..f20b78c12f3b 100644 --- a/stdlib/py_compile.pyi +++ b/stdlib/py_compile.pyi @@ -9,7 +9,7 @@ class PyCompileError(Exception): exc_value: BaseException file: str msg: str - def __init__(self, exc_type: type[BaseException], exc_value: BaseException, file: str, msg: str = ...) -> None: ... + def __init__(self, exc_type: type[BaseException], exc_value: BaseException, file: str, msg: str = '') -> None: ... class PycInvalidationMode(enum.Enum): TIMESTAMP: int @@ -24,7 +24,7 @@ if sys.version_info >= (3, 8): cfile: AnyStr | None = None, dfile: AnyStr | None = None, doraise: bool = False, - optimize: int = ..., + optimize: int = -1, invalidation_mode: PycInvalidationMode | None = None, quiet: int = 0, ) -> AnyStr | None: ... @@ -32,11 +32,11 @@ if sys.version_info >= (3, 8): else: def compile( file: AnyStr, - cfile: AnyStr | None = None, - dfile: AnyStr | None = None, - doraise: bool = False, + cfile: AnyStr | None = ..., + dfile: AnyStr | None = ..., + doraise: bool = ..., optimize: int = ..., - invalidation_mode: PycInvalidationMode | None = None, + invalidation_mode: PycInvalidationMode | None = ..., ) -> AnyStr | None: ... if sys.version_info >= (3, 10): diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 287a6558a734..873f32e0c745 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -44,21 +44,21 @@ def safeimport(path: str, forceload: bool = ..., cache: MutableMapping[str, Modu class Doc: PYTHONDOCS: str - def document(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def fail(self, object: object, name: str | None = ..., *args: Any) -> NoReturn: ... + def document(self, object: object, name: str | None = None, *args: Any) -> str: ... + def fail(self, object: object, name: str | None = None, *args: Any) -> NoReturn: ... @abstractmethod - def docmodule(self, object: object, name: str | None = ..., *args: Any) -> str: ... + def docmodule(self, object: object, name: str | None = None, *args: Any) -> str: ... @abstractmethod - def docclass(self, object: object, name: str | None = ..., *args: Any) -> str: ... + def docclass(self, object: object, name: str | None = None, *args: Any) -> str: ... @abstractmethod - def docroutine(self, object: object, name: str | None = ..., *args: Any) -> str: ... + def docroutine(self, object: object, name: str | None = None, *args: Any) -> str: ... @abstractmethod - def docother(self, object: object, name: str | None = ..., *args: Any) -> str: ... + def docother(self, object: object, name: str | None = None, *args: Any) -> str: ... @abstractmethod - def docproperty(self, object: object, name: str | None = ..., *args: Any) -> str: ... + def docproperty(self, object: object, name: str | None = None, *args: Any) -> str: ... @abstractmethod - def docdata(self, object: object, name: str | None = ..., *args: Any) -> str: ... - def getdocloc(self, object: object, basedir: str = ...) -> str | None: ... + def docdata(self, object: object, name: str | None = None, *args: Any) -> str: ... + def getdocloc(self, object: object, basedir: str = '/Users/jelle/.pyenv/versions/3.11.1/lib/python3.11') -> str | None: ... class HTMLRepr(Repr): def escape(self, text: str) -> str: ... @@ -112,20 +112,20 @@ class HTMLDoc(Doc): def markup( self, text: str, - escape: Callable[[str], str] | None = ..., + escape: Callable[[str], str] | None = None, funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., ) -> str: ... def formattree( - self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ... + self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = None ) -> str: ... - def docmodule(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... + def docmodule(self, object: object, name: str | None = None, mod: str | None = None, *ignored: Any) -> str: ... def docclass( self, object: object, - name: str | None = ..., - mod: str | None = ..., + name: str | None = None, + mod: str | None = None, funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., *ignored: Any, @@ -134,17 +134,17 @@ class HTMLDoc(Doc): def docroutine( # type: ignore[override] self, object: object, - name: str | None = ..., - mod: str | None = ..., + name: str | None = None, + mod: str | None = None, funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., - cl: type | None = ..., + cl: type | None = None, ) -> str: ... - def docproperty(self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] - def docother(self, object: object, name: str | None = ..., mod: Any | None = ..., *ignored: Any) -> str: ... - def docdata(self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] - def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = ...) -> str: ... + def docproperty(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docother(self, object: object, name: str | None = None, mod: Any | None = None, *ignored: Any) -> str: ... + def docdata(self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def index(self, dir: str, shadowed: MutableMapping[str, bool] | None = None) -> str: ... def filelink(self, url: str, path: str) -> str: ... class TextRepr(Repr): @@ -157,25 +157,25 @@ class TextDoc(Doc): _repr_instance: TextRepr = ... repr = _repr_instance.repr def bold(self, text: str) -> str: ... - def indent(self, text: str, prefix: str = ...) -> str: ... + def indent(self, text: str, prefix: str = ' ') -> str: ... def section(self, title: str, contents: str) -> str: ... def formattree( - self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = ..., prefix: str = ... + self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = None, prefix: str = '' ) -> str: ... - def docmodule(self, object: object, name: str | None = ..., mod: Any | None = ...) -> str: ... # type: ignore[override] - def docclass(self, object: object, name: str | None = ..., mod: str | None = ..., *ignored: Any) -> str: ... + def docmodule(self, object: object, name: str | None = None, mod: Any | None = None) -> str: ... # type: ignore[override] + def docclass(self, object: object, name: str | None = None, mod: str | None = None, *ignored: Any) -> str: ... def formatvalue(self, object: object) -> str: ... - def docroutine(self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] - def docproperty(self, object: object, name: str | None = ..., mod: Any | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] - def docdata(self, object: object, name: str | None = ..., mod: str | None = ..., cl: Any | None = ...) -> str: ... # type: ignore[override] + def docroutine(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docproperty(self, object: object, name: str | None = None, mod: Any | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] + def docdata(self, object: object, name: str | None = None, mod: str | None = None, cl: Any | None = None) -> str: ... # type: ignore[override] def docother( # type: ignore[override] self, object: object, - name: str | None = ..., - mod: str | None = ..., - parent: str | None = ..., - maxlen: int | None = ..., - doc: Any | None = ..., + name: str | None = None, + mod: str | None = None, + parent: str | None = None, + maxlen: int | None = None, + doc: Any | None = None, ) -> str: ... def pager(text: str) -> None: ... @@ -192,23 +192,16 @@ text: TextDoc html: HTMLDoc def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ... -def render_doc( - thing: str | object, title: str = "Python Library Documentation: %s", forceload: bool = ..., renderer: Doc | None = None -) -> str: ... -def doc( - thing: str | object, - title: str = "Python Library Documentation: %s", - forceload: bool = ..., - output: SupportsWrite[str] | None = None, -) -> None: ... +def render_doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = ..., renderer: Doc | None = None) -> str: ... +def doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = ..., output: SupportsWrite[str] | None = None) -> None: ... def writedoc(thing: str | object, forceload: bool = ...) -> None: ... -def writedocs(dir: str, pkgpath: str = "", done: Any | None = None) -> None: ... +def writedocs(dir: str, pkgpath: str = '', done: Any | None = None) -> None: ... class Helper: keywords: dict[str, str | tuple[str, str]] symbols: dict[str, str] topics: dict[str, str | tuple[str, ...]] - def __init__(self, input: IO[str] | None = ..., output: IO[str] | None = ...) -> None: ... + def __init__(self, input: IO[str] | None = None, output: IO[str] | None = None) -> None: ... @property def input(self) -> IO[str]: ... @property @@ -218,13 +211,13 @@ class Helper: def getline(self, prompt: str) -> str: ... def help(self, request: Any) -> None: ... def intro(self) -> None: ... - def list(self, items: _list[str], columns: int = ..., width: int = ...) -> None: ... + def list(self, items: _list[str], columns: int = 4, width: int = 80) -> None: ... def listkeywords(self) -> None: ... def listsymbols(self) -> None: ... def listtopics(self) -> None: ... - def showtopic(self, topic: str, more_xrefs: str = ...) -> None: ... + def showtopic(self, topic: str, more_xrefs: str = '') -> None: ... def showsymbol(self, symbol: str) -> None: ... - def listmodules(self, key: str = ...) -> None: ... + def listmodules(self, key: str = '') -> None: ... help: Helper @@ -233,9 +226,9 @@ class ModuleScanner: def run( self, callback: Callable[[str | None, str, str], object], - key: str | None = ..., - completer: Callable[[], object] | None = ..., - onerror: Callable[[str], object] | None = ..., + key: str | None = None, + completer: Callable[[], object] | None = None, + onerror: Callable[[str], object] | None = None, ) -> None: ... def apropos(key: str) -> None: ... diff --git a/stdlib/queue.pyi b/stdlib/queue.pyi index 7ea4beb664c5..3537e445ed97 100644 --- a/stdlib/queue.pyi +++ b/stdlib/queue.pyi @@ -23,14 +23,14 @@ class Queue(Generic[_T]): # Despite the fact that `queue` has `deque` type, # we treat it as `Any` to allow different implementations in subtypes. queue: Any # undocumented - def __init__(self, maxsize: int = ...) -> None: ... + def __init__(self, maxsize: int = 0) -> None: ... def _init(self, maxsize: int) -> None: ... def empty(self) -> bool: ... def full(self) -> bool: ... - def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... + def get(self, block: bool = True, timeout: float | None = None) -> _T: ... def get_nowait(self) -> _T: ... def _get(self) -> _T: ... - def put(self, item: _T, block: bool = ..., timeout: float | None = ...) -> None: ... + def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ... def put_nowait(self, item: _T) -> None: ... def _put(self, item: _T) -> None: ... def join(self) -> None: ... @@ -49,9 +49,9 @@ class LifoQueue(Queue[_T]): class SimpleQueue(Generic[_T]): def __init__(self) -> None: ... def empty(self) -> bool: ... - def get(self, block: bool = ..., timeout: float | None = ...) -> _T: ... + def get(self, block: bool = True, timeout: float | None = None) -> _T: ... def get_nowait(self) -> _T: ... - def put(self, item: _T, block: bool = ..., timeout: float | None = ...) -> None: ... + def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ... def put_nowait(self, item: _T) -> None: ... def qsize(self) -> int: ... if sys.version_info >= (3, 9): diff --git a/stdlib/random.pyi b/stdlib/random.pyi index a2a1d956e78f..bffb02897ef1 100644 --- a/stdlib/random.pyi +++ b/stdlib/random.pyi @@ -39,7 +39,7 @@ _T = TypeVar("_T") class Random(_random.Random): VERSION: ClassVar[int] - def __init__(self, x: Any = ...) -> None: ... + def __init__(self, x: Any = None) -> None: ... # Using other `seed` types is deprecated since 3.9 and removed in 3.11 # Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit # int better documents conventional usage of random.seed. @@ -50,7 +50,7 @@ class Random(_random.Random): def getstate(self) -> tuple[Any, ...]: ... def setstate(self, state: tuple[Any, ...]) -> None: ... - def randrange(self, start: int, stop: int | None = ..., step: int = ...) -> int: ... + def randrange(self, start: int, stop: int | None = None, step: int = 1) -> int: ... def randint(self, a: int, b: int) -> int: ... if sys.version_info >= (3, 9): def randbytes(self, n: int) -> bytes: ... @@ -59,10 +59,10 @@ class Random(_random.Random): def choices( self, population: SupportsLenAndGetItem[_T], - weights: Sequence[float | Fraction] | None = ..., + weights: Sequence[float | Fraction] | None = None, *, - cum_weights: Sequence[float | Fraction] | None = ..., - k: int = ..., + cum_weights: Sequence[float | Fraction] | None = None, + k: int = 1, ) -> list[_T]: ... if sys.version_info >= (3, 11): def shuffle(self, x: MutableSequence[Any]) -> None: ... @@ -78,7 +78,7 @@ class Random(_random.Random): def sample(self, population: Sequence[_T] | AbstractSet[_T], k: int) -> list[_T]: ... def uniform(self, a: float, b: float) -> float: ... - def triangular(self, low: float = ..., high: float = ..., mode: float | None = ...) -> float: ... + def triangular(self, low: float = ..., high: float = ..., mode: float | None = None) -> float: ... def betavariate(self, alpha: float, beta: float) -> float: ... def expovariate(self, lambd: float) -> float: ... def gammavariate(self, alpha: float, beta: float) -> float: ... diff --git a/stdlib/re.pyi b/stdlib/re.pyi index 4962ab8edad9..a1a2656baa6f 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -113,47 +113,47 @@ class Pattern(Generic[AnyStr]): @property def pattern(self) -> AnyStr: ... @overload - def search(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... + def search(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... @overload - def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... + def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Match[bytes] | None: ... @overload - def match(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... + def match(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... @overload - def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... + def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Match[bytes] | None: ... @overload - def fullmatch(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... + def fullmatch(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... @overload - def fullmatch(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... + def fullmatch(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Match[bytes] | None: ... @overload - def split(self: Pattern[str], string: str, maxsplit: int = ...) -> list[str | Any]: ... + def split(self: Pattern[str], string: str, maxsplit: int = 0) -> list[str | Any]: ... @overload - def split(self: Pattern[bytes], string: ReadableBuffer, maxsplit: int = ...) -> list[bytes | Any]: ... + def split(self: Pattern[bytes], string: ReadableBuffer, maxsplit: int = 0) -> list[bytes | Any]: ... # return type depends on the number of groups in the pattern @overload - def findall(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> list[Any]: ... + def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> list[Any]: ... @overload - def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> list[Any]: ... + def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> list[Any]: ... @overload - def finditer(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Iterator[Match[str]]: ... + def finditer(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Iterator[Match[str]]: ... @overload - def finditer(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Iterator[Match[bytes]]: ... + def finditer(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Iterator[Match[bytes]]: ... @overload - def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ...) -> str: ... + def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> str: ... @overload def sub( self: Pattern[bytes], repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], string: ReadableBuffer, - count: int = ..., + count: int = 0, ) -> bytes: ... @overload - def subn(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ...) -> tuple[str, int]: ... + def subn(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> tuple[str, int]: ... @overload def subn( self: Pattern[bytes], repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], string: ReadableBuffer, - count: int = ..., + count: int = 0, ) -> tuple[bytes, int]: ... def __copy__(self) -> Pattern[AnyStr]: ... def __deepcopy__(self, __memo: Any) -> Pattern[AnyStr]: ... diff --git a/stdlib/reprlib.pyi b/stdlib/reprlib.pyi index 21c8a5cd4e0c..4f2126d1e32e 100644 --- a/stdlib/reprlib.pyi +++ b/stdlib/reprlib.pyi @@ -8,7 +8,7 @@ __all__ = ["Repr", "repr", "recursive_repr"] _ReprFunc: TypeAlias = Callable[[Any], str] -def recursive_repr(fillvalue: str = "...") -> Callable[[_ReprFunc], _ReprFunc]: ... +def recursive_repr(fillvalue: str = '...') -> Callable[[_ReprFunc], _ReprFunc]: ... class Repr: maxlevel: int diff --git a/stdlib/rlcompleter.pyi b/stdlib/rlcompleter.pyi index 1840b7cfced7..8d9477e3ee45 100644 --- a/stdlib/rlcompleter.pyi +++ b/stdlib/rlcompleter.pyi @@ -3,7 +3,7 @@ from typing import Any __all__ = ["Completer"] class Completer: - def __init__(self, namespace: dict[str, Any] | None = ...) -> None: ... + def __init__(self, namespace: dict[str, Any] | None = None) -> None: ... def complete(self, text: str, state: int) -> str | None: ... def attr_matches(self, text: str) -> list[str]: ... def global_matches(self, text: str) -> list[str]: ... diff --git a/stdlib/sched.pyi b/stdlib/sched.pyi index 29c84f951124..a8ec78d68fd2 100644 --- a/stdlib/sched.pyi +++ b/stdlib/sched.pyi @@ -35,7 +35,7 @@ class scheduler: def enter( self, delay: float, priority: Any, action: _ActionCallback, argument: tuple[Any, ...] = ..., kwargs: dict[str, Any] = ... ) -> Event: ... - def run(self, blocking: bool = ...) -> float | None: ... + def run(self, blocking: bool = True) -> float | None: ... def cancel(self, event: Event) -> None: ... def empty(self) -> bool: ... @property diff --git a/stdlib/selectors.pyi b/stdlib/selectors.pyi index 931692ff7b3a..54d135d37e3f 100644 --- a/stdlib/selectors.pyi +++ b/stdlib/selectors.pyi @@ -18,12 +18,12 @@ class SelectorKey(NamedTuple): class BaseSelector(metaclass=ABCMeta): @abstractmethod - def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... + def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ... @abstractmethod def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def modify(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... + def modify(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ... @abstractmethod - def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ... def close(self) -> None: ... def get_key(self, fileobj: FileDescriptorLike) -> SelectorKey: ... @abstractmethod @@ -32,16 +32,16 @@ class BaseSelector(metaclass=ABCMeta): def __exit__(self, *args: Unused) -> None: ... class SelectSelector(BaseSelector): - def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... + def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... if sys.platform != "win32": class PollSelector(BaseSelector): - def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... + def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... if sys.platform == "linux": @@ -61,13 +61,13 @@ class DevpollSelector(BaseSelector): class KqueueSelector(BaseSelector): def fileno(self) -> int: ... - def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... + def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... class DefaultSelector(BaseSelector): - def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = ...) -> SelectorKey: ... + def register(self, fileobj: FileDescriptorLike, events: _EventMask, data: Any = None) -> SelectorKey: ... def unregister(self, fileobj: FileDescriptorLike) -> SelectorKey: ... - def select(self, timeout: float | None = ...) -> list[tuple[SelectorKey, _EventMask]]: ... + def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ... def get_map(self) -> Mapping[FileDescriptorLike, SelectorKey]: ... diff --git a/stdlib/shelve.pyi b/stdlib/shelve.pyi index 52cccd215ae0..ec48c51c8216 100644 --- a/stdlib/shelve.pyi +++ b/stdlib/shelve.pyi @@ -11,7 +11,7 @@ _VT = TypeVar("_VT") class Shelf(MutableMapping[str, _VT]): def __init__( - self, dict: MutableMapping[bytes, bytes], protocol: int | None = ..., writeback: bool = ..., keyencoding: str = ... + self, dict: MutableMapping[bytes, bytes], protocol: int | None = None, writeback: bool = False, keyencoding: str = 'utf-8' ) -> None: ... def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... @@ -38,6 +38,6 @@ class BsdDbShelf(Shelf[_VT]): def last(self) -> tuple[str, _VT]: ... class DbfilenameShelf(Shelf[_VT]): - def __init__(self, filename: str, flag: _TFlags = ..., protocol: int | None = ..., writeback: bool = ...) -> None: ... + def __init__(self, filename: str, flag: _TFlags = 'c', protocol: int | None = None, writeback: bool = False) -> None: ... -def open(filename: str, flag: _TFlags = "c", protocol: int | None = None, writeback: bool = False) -> Shelf[Any]: ... +def open(filename: str, flag: _TFlags = 'c', protocol: int | None = None, writeback: bool = False) -> Shelf[Any]: ... diff --git a/stdlib/shlex.pyi b/stdlib/shlex.pyi index f30c9ac3f22e..9a578d186be8 100644 --- a/stdlib/shlex.pyi +++ b/stdlib/shlex.pyi @@ -34,17 +34,17 @@ class shlex(Iterable[str]): def punctuation_chars(self) -> str: ... def __init__( self, - instream: str | TextIO | None = ..., - infile: str | None = ..., - posix: bool = ..., - punctuation_chars: bool | str = ..., + instream: str | TextIO | None = None, + infile: str | None = None, + posix: bool = False, + punctuation_chars: bool | str = False, ) -> None: ... def get_token(self) -> str: ... def push_token(self, tok: str) -> None: ... def read_token(self) -> str: ... def sourcehook(self, newfile: str) -> tuple[str, TextIO]: ... - def push_source(self, newstream: str | TextIO, newfile: str | None = ...) -> None: ... + def push_source(self, newstream: str | TextIO, newfile: str | None = None) -> None: ... def pop_source(self) -> None: ... - def error_leader(self, infile: str | None = ..., lineno: int | None = ...) -> None: ... + def error_leader(self, infile: str | None = None, lineno: int | None = None) -> None: ... def __iter__(self: Self) -> Self: ... def __next__(self) -> str: ... diff --git a/stdlib/shutil.pyi b/stdlib/shutil.pyi index b2c49353064b..0f088268e95f 100644 --- a/stdlib/shutil.pyi +++ b/stdlib/shutil.pyi @@ -47,7 +47,7 @@ class ExecError(OSError): ... class ReadError(OSError): ... class RegistryError(Exception): ... -def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = ...) -> None: ... +def copyfileobj(fsrc: SupportsRead[AnyStr], fdst: SupportsWrite[AnyStr], length: int = 0) -> None: ... def copyfile(src: StrOrBytesPath, dst: _StrOrBytesPathT, *, follow_symlinks: bool = True) -> _StrOrBytesPathT: ... def copymode(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... def copystat(src: StrOrBytesPath, dst: StrOrBytesPath, *, follow_symlinks: bool = True) -> None: ... @@ -76,10 +76,10 @@ else: def copytree( src: StrPath, dst: StrPath, - symlinks: bool = False, - ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = None, + symlinks: bool = ..., + ignore: None | Callable[[str, list[str]], Iterable[str]] | Callable[[StrPath, list[str]], Iterable[str]] = ..., copy_function: Callable[[str, str], object] = ..., - ignore_dangling_symlinks: bool = False, + ignore_dangling_symlinks: bool = ..., ) -> _PathReturn: ... _OnErrorCallback: TypeAlias = Callable[[Callable[..., Any], Any, Any], object] @@ -139,7 +139,7 @@ if sys.version_info >= (3, 8): def which(cmd: bytes, mode: int = ..., path: StrPath | None = ...) -> bytes | None: ... else: - def which(cmd: _StrPathT, mode: int = 1, path: StrPath | None = None) -> str | _StrPathT | None: ... + def which(cmd: _StrPathT, mode: int = ..., path: StrPath | None = ...) -> str | _StrPathT | None: ... def make_archive( base_name: str, diff --git a/stdlib/smtpd.pyi b/stdlib/smtpd.pyi index f2de6c155c07..7392bd51627d 100644 --- a/stdlib/smtpd.pyi +++ b/stdlib/smtpd.pyi @@ -41,10 +41,10 @@ class SMTPChannel(asynchat.async_chat): server: SMTPServer, conn: socket.socket, addr: Any, - data_size_limit: int = ..., - map: asyncore._MapType | None = ..., - enable_SMTPUTF8: bool = ..., - decode_data: bool = ..., + data_size_limit: int = 33554432, + map: asyncore._MapType | None = None, + enable_SMTPUTF8: bool = False, + decode_data: bool = False, ) -> None: ... # base asynchat.async_chat.push() accepts bytes def push(self, msg: str) -> None: ... # type: ignore[override] @@ -71,10 +71,10 @@ class SMTPServer(asyncore.dispatcher): self, localaddr: _Address, remoteaddr: _Address, - data_size_limit: int = ..., - map: asyncore._MapType | None = ..., - enable_SMTPUTF8: bool = ..., - decode_data: bool = ..., + data_size_limit: int = 33554432, + map: asyncore._MapType | None = None, + enable_SMTPUTF8: bool = False, + decode_data: bool = False, ) -> None: ... def handle_accepted(self, conn: socket.socket, addr: Any) -> None: ... def process_message( diff --git a/stdlib/smtplib.pyi b/stdlib/smtplib.pyi index 9fedd6f316d1..ab7e7390494a 100644 --- a/stdlib/smtplib.pyi +++ b/stdlib/smtplib.pyi @@ -89,26 +89,26 @@ class SMTP: local_hostname: str def __init__( self, - host: str = ..., - port: int = ..., - local_hostname: str | None = ..., + host: str = '', + port: int = 0, + local_hostname: str | None = None, timeout: float = ..., - source_address: _SourceAddress | None = ..., + source_address: _SourceAddress | None = None, ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None ) -> None: ... def set_debuglevel(self, debuglevel: int) -> None: ... - def connect(self, host: str = ..., port: int = ..., source_address: _SourceAddress | None = ...) -> _Reply: ... + def connect(self, host: str = 'localhost', port: int = 0, source_address: _SourceAddress | None = None) -> _Reply: ... def send(self, s: ReadableBuffer | str) -> None: ... - def putcmd(self, cmd: str, args: str = ...) -> None: ... + def putcmd(self, cmd: str, args: str = '') -> None: ... def getreply(self) -> _Reply: ... - def docmd(self, cmd: str, args: str = ...) -> _Reply: ... - def helo(self, name: str = ...) -> _Reply: ... - def ehlo(self, name: str = ...) -> _Reply: ... + def docmd(self, cmd: str, args: str = '') -> _Reply: ... + def helo(self, name: str = '') -> _Reply: ... + def ehlo(self, name: str = '') -> _Reply: ... def has_extn(self, opt: str) -> bool: ... - def help(self, args: str = ...) -> bytes: ... + def help(self, args: str = '') -> bytes: ... def rset(self) -> _Reply: ... def noop(self) -> _Reply: ... def mail(self, sender: str, options: Sequence[str] = ...) -> _Reply: ... @@ -120,15 +120,15 @@ class SMTP: def ehlo_or_helo_if_needed(self) -> None: ... user: str password: str - def auth(self, mechanism: str, authobject: _AuthObject, *, initial_response_ok: bool = ...) -> _Reply: ... + def auth(self, mechanism: str, authobject: _AuthObject, *, initial_response_ok: bool = True) -> _Reply: ... @overload - def auth_cram_md5(self, challenge: None = ...) -> None: ... + def auth_cram_md5(self, challenge: None = None) -> None: ... @overload def auth_cram_md5(self, challenge: ReadableBuffer) -> str: ... - def auth_plain(self, challenge: ReadableBuffer | None = ...) -> str: ... - def auth_login(self, challenge: ReadableBuffer | None = ...) -> str: ... - def login(self, user: str, password: str, *, initial_response_ok: bool = ...) -> _Reply: ... - def starttls(self, keyfile: str | None = ..., certfile: str | None = ..., context: SSLContext | None = ...) -> _Reply: ... + def auth_plain(self, challenge: ReadableBuffer | None = None) -> str: ... + def auth_login(self, challenge: ReadableBuffer | None = None) -> str: ... + def login(self, user: str, password: str, *, initial_response_ok: bool = True) -> _Reply: ... + def starttls(self, keyfile: str | None = None, certfile: str | None = None, context: SSLContext | None = None) -> _Reply: ... def sendmail( self, from_addr: str, @@ -140,8 +140,8 @@ class SMTP: def send_message( self, msg: _Message, - from_addr: str | None = ..., - to_addrs: str | Sequence[str] | None = ..., + from_addr: str | None = None, + to_addrs: str | Sequence[str] | None = None, mail_options: Sequence[str] = ..., rcpt_options: Sequence[str] = ..., ) -> _SendErrs: ... @@ -154,14 +154,14 @@ class SMTP_SSL(SMTP): context: SSLContext def __init__( self, - host: str = ..., - port: int = ..., - local_hostname: str | None = ..., - keyfile: str | None = ..., - certfile: str | None = ..., + host: str = '', + port: int = 0, + local_hostname: str | None = None, + keyfile: str | None = None, + certfile: str | None = None, timeout: float = ..., - source_address: _SourceAddress | None = ..., - context: SSLContext | None = ..., + source_address: _SourceAddress | None = None, + context: SSLContext | None = None, ) -> None: ... LMTP_PORT: int diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index 6c90df496fb1..5334ef1842e1 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -655,7 +655,7 @@ class _SendableFile(Protocol): class socket(_socket.socket): def __init__( - self, family: AddressFamily | int = ..., type: SocketKind | int = ..., proto: int = ..., fileno: int | None = ... + self, family: AddressFamily | int = -1, type: SocketKind | int = -1, proto: int = -1, fileno: int | None = None ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, *args: Unused) -> None: ... @@ -669,39 +669,39 @@ class socket(_socket.socket): mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], buffering: Literal[0], *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, ) -> SocketIO: ... @overload def makefile( self, mode: Literal["rwb", "rbw", "wrb", "wbr", "brw", "bwr"], - buffering: Literal[-1, 1] | None = ..., + buffering: Literal[-1, 1] | None = None, *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, ) -> BufferedRWPair: ... @overload def makefile( self, mode: Literal["rb", "br"], - buffering: Literal[-1, 1] | None = ..., + buffering: Literal[-1, 1] | None = None, *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, ) -> BufferedReader: ... @overload def makefile( self, mode: Literal["wb", "bw"], - buffering: Literal[-1, 1] | None = ..., + buffering: Literal[-1, 1] | None = None, *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, ) -> BufferedWriter: ... @overload def makefile( @@ -709,21 +709,21 @@ class socket(_socket.socket): mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], buffering: int, *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, ) -> IOBase: ... @overload def makefile( self, - mode: Literal["r", "w", "rw", "wr", ""] = ..., - buffering: int | None = ..., + mode: Literal["r", "w", "rw", "wr", ""] = 'r', + buffering: int | None = None, *, - encoding: str | None = ..., - errors: str | None = ..., - newline: str | None = ..., + encoding: str | None = None, + errors: str | None = None, + newline: str | None = None, ) -> TextIOWrapper: ... - def sendfile(self, file: _SendableFile, offset: int = ..., count: int | None = ...) -> int: ... + def sendfile(self, file: _SendableFile, offset: int = 0, count: int | None = None) -> int: ... @property def family(self) -> AddressFamily: ... # type: ignore[override] @property @@ -748,7 +748,7 @@ if sys.platform == "win32": else: def socketpair( - family: int | AddressFamily | None = None, type: SocketType | int = ..., proto: int = ... + family: int | AddressFamily | None = None, type: SocketType | int = 1, proto: int = 0 ) -> tuple[socket, socket]: ... class SocketIO(RawIOBase): @@ -760,7 +760,7 @@ class SocketIO(RawIOBase): @property def mode(self) -> Literal["rb", "wb", "rwb"]: ... -def getfqdn(name: str = "") -> str: ... +def getfqdn(name: str = '') -> str: ... if sys.version_info >= (3, 11): def create_connection( @@ -773,7 +773,7 @@ if sys.version_info >= (3, 11): else: def create_connection( - address: tuple[str | None, int], timeout: float | None = ..., source_address: _Address | None = None # noqa: F811 + address: tuple[str | None, int], timeout: float | None = ..., source_address: _Address | None = ... # noqa: F811 ) -> socket: ... if sys.version_info >= (3, 8): @@ -784,5 +784,10 @@ if sys.version_info >= (3, 8): # the 5th tuple item is an address def getaddrinfo( - host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0 + host: bytes | str | None, + port: bytes | str | int | None, + family: int = 0, + type: int = 0, + proto: int = 0, + flags: int = 0, ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... diff --git a/stdlib/socketserver.pyi b/stdlib/socketserver.pyi index b5147d356ffe..b593e77c5f23 100644 --- a/stdlib/socketserver.pyi +++ b/stdlib/socketserver.pyi @@ -79,7 +79,7 @@ class TCPServer(BaseServer): self: Self, server_address: _AfInetAddress, RequestHandlerClass: Callable[[Any, _RetAddress, Self], BaseRequestHandler], - bind_and_activate: bool = ..., + bind_and_activate: bool = True, ) -> None: ... def get_request(self) -> tuple[_socket, _RetAddress]: ... @@ -94,7 +94,7 @@ if sys.platform != "win32": self: Self, server_address: _AfUnixAddress, RequestHandlerClass: Callable[[Any, _RetAddress, Self], BaseRequestHandler], - bind_and_activate: bool = ..., + bind_and_activate: bool = True, ) -> None: ... class UnixDatagramServer(BaseServer): @@ -103,7 +103,7 @@ if sys.platform != "win32": self: Self, server_address: _AfUnixAddress, RequestHandlerClass: Callable[[Any, _RetAddress, Self], BaseRequestHandler], - bind_and_activate: bool = ..., + bind_and_activate: bool = True, ) -> None: ... if sys.platform != "win32": @@ -112,7 +112,7 @@ if sys.platform != "win32": active_children: set[int] | None # undocumented max_children: int # undocumented block_on_close: bool - def collect_children(self, *, blocking: bool = ...) -> None: ... # undocumented + def collect_children(self, *, blocking: bool = False) -> None: ... # undocumented def handle_timeout(self) -> None: ... # undocumented def service_actions(self) -> None: ... # undocumented def process_request(self, request: _RequestType, client_address: _RetAddress) -> None: ... diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index e590dfc4a4ef..714ef41fc2a0 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -346,9 +346,9 @@ class Connection: self, target: Connection, *, - pages: int = ..., - progress: Callable[[int, int, int], object] | None = ..., - name: str = ..., + pages: int = -1, + progress: Callable[[int, int, int], object] | None = None, + name: str = 'main', sleep: float = ..., ) -> None: ... if sys.version_info >= (3, 11): @@ -381,7 +381,7 @@ class Cursor(Iterator[Any]): def executemany(self: Self, __sql: str, __seq_of_parameters: Iterable[_Parameters]) -> Self: ... def executescript(self, __sql_script: str) -> Cursor: ... def fetchall(self) -> list[Any]: ... - def fetchmany(self, size: int | None = ...) -> list[Any]: ... + def fetchmany(self, size: int | None = 1) -> list[Any]: ... # Returns either a row (as created by the row_factory) or None, but # putting None in the return annotation causes annoying false positives. def fetchone(self) -> Any: ... diff --git a/stdlib/sre_constants.pyi b/stdlib/sre_constants.pyi index e7344fae3798..2ca12f7e6e0d 100644 --- a/stdlib/sre_constants.pyi +++ b/stdlib/sre_constants.pyi @@ -12,7 +12,7 @@ class error(Exception): pos: int | None lineno: int colno: int - def __init__(self, msg: str, pattern: str | bytes | None = ..., pos: int | None = ...) -> None: ... + def __init__(self, msg: str, pattern: str | bytes | None = None, pos: int | None = None) -> None: ... class _NamedIntConstant(int): name: Any diff --git a/stdlib/sre_parse.pyi b/stdlib/sre_parse.pyi index efaf412ce423..9c055e32bd0a 100644 --- a/stdlib/sre_parse.pyi +++ b/stdlib/sre_parse.pyi @@ -57,7 +57,7 @@ class SubPattern: pattern: Pattern def __init__(self, pattern: Pattern, data: list[_CodeType] | None = ...) -> None: ... - def dump(self, level: int = ...) -> None: ... + def dump(self, level: int = 0) -> None: ... def __len__(self) -> int: ... def __delitem__(self, index: int | slice) -> None: ... def __getitem__(self, index: int | slice) -> SubPattern | _CodeType: ... @@ -85,7 +85,7 @@ class Tokenizer: def pos(self) -> int: ... def tell(self) -> int: ... def seek(self, index: int) -> None: ... - def error(self, msg: str, offset: int = ...) -> _Error: ... + def error(self, msg: str, offset: int = 0) -> _Error: ... if sys.version_info >= (3, 11): def checkgroupname(self, name: str, offset: int, nested: int) -> None: ... @@ -102,7 +102,7 @@ if sys.version_info >= (3, 8): def parse_template(source: bytes, state: _Pattern[Any]) -> _TemplateByteType: ... else: - def parse(str: str, flags: int = 0, pattern: Pattern | None = ...) -> SubPattern: ... + def parse(str: str, flags: int = ..., pattern: Pattern | None = ...) -> SubPattern: ... @overload def parse_template(source: str, pattern: _Pattern[Any]) -> _TemplateType: ... @overload diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index 88f2ceddc33b..ddcfcfb91a8c 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -49,8 +49,8 @@ def wrap_socket( keyfile: StrOrBytesPath | None = None, certfile: StrOrBytesPath | None = None, server_side: bool = False, - cert_reqs: int = ..., - ssl_version: int = ..., + cert_reqs: int = 0, + ssl_version: int = 2, ca_certs: str | None = None, do_handshake_on_connect: bool = True, suppress_ragged_eofs: bool = True, @@ -68,14 +68,14 @@ if sys.version_info >= (3, 10): def _create_unverified_context( protocol: int | None = None, *, - cert_reqs: int = ..., - check_hostname: bool = ..., + cert_reqs: int = 0, + check_hostname: bool = False, purpose: Purpose = ..., - certfile: StrOrBytesPath | None = ..., - keyfile: StrOrBytesPath | None = ..., - cafile: StrOrBytesPath | None = ..., - capath: StrOrBytesPath | None = ..., - cadata: str | ReadableBuffer | None = ..., + certfile: StrOrBytesPath | None = None, + keyfile: StrOrBytesPath | None = None, + cafile: StrOrBytesPath | None = None, + capath: StrOrBytesPath | None = None, + cadata: str | ReadableBuffer | None = None, ) -> SSLContext: ... else: @@ -107,11 +107,11 @@ def cert_time_to_seconds(cert_time: str) -> int: ... if sys.version_info >= (3, 10): def get_server_certificate( - addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = None, timeout: float = ... + addr: tuple[str, int], ssl_version: int = 16, ca_certs: str | None = None, timeout: float = ... ) -> str: ... else: - def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = None) -> str: ... + def get_server_certificate(addr: tuple[str, int], ssl_version: int = ..., ca_certs: str | None = ...) -> str: ... def DER_cert_to_PEM_cert(der_cert_bytes: ReadableBuffer) -> str: ... def PEM_cert_to_DER_cert(pem_cert_string: str) -> bytes: ... @@ -315,24 +315,24 @@ class SSLSocket(socket.socket): def __init__(self, *args: Any, **kwargs: Any) -> None: ... def connect(self, addr: socket._Address) -> None: ... def connect_ex(self, addr: socket._Address) -> int: ... - def recv(self, buflen: int = ..., flags: int = ...) -> bytes: ... - def recv_into(self, buffer: WriteableBuffer, nbytes: int | None = ..., flags: int = ...) -> int: ... - def recvfrom(self, buflen: int = ..., flags: int = ...) -> tuple[bytes, socket._RetAddress]: ... + def recv(self, buflen: int = 1024, flags: int = 0) -> bytes: ... + def recv_into(self, buffer: WriteableBuffer, nbytes: int | None = None, flags: int = 0) -> int: ... + def recvfrom(self, buflen: int = 1024, flags: int = 0) -> tuple[bytes, socket._RetAddress]: ... def recvfrom_into( - self, buffer: WriteableBuffer, nbytes: int | None = ..., flags: int = ... + self, buffer: WriteableBuffer, nbytes: int | None = None, flags: int = 0 ) -> tuple[int, socket._RetAddress]: ... - def send(self, data: ReadableBuffer, flags: int = ...) -> int: ... - def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ... + def send(self, data: ReadableBuffer, flags: int = 0) -> int: ... + def sendall(self, data: ReadableBuffer, flags: int = 0) -> None: ... @overload - def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = ...) -> int: ... + def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = None) -> int: ... @overload def sendto(self, data: ReadableBuffer, flags_or_addr: int, addr: socket._Address) -> int: ... def shutdown(self, how: int) -> None: ... - def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ... + def read(self, len: int = 1024, buffer: bytearray | None = None) -> bytes: ... def write(self, data: ReadableBuffer) -> int: ... - def do_handshake(self, block: bool = ...) -> None: ... # block is undocumented + def do_handshake(self, block: bool = False) -> None: ... # block is undocumented @overload - def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ... + def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ... @overload def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload @@ -340,7 +340,7 @@ class SSLSocket(socket.socket): def cipher(self) -> tuple[str, str, int] | None: ... def shared_ciphers(self) -> list[tuple[str, str, int]] | None: ... def compression(self) -> str | None: ... - def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ... + def get_channel_binding(self, cb_type: str = 'tls-unique') -> bytes | None: ... def selected_alpn_protocol(self) -> str | None: ... def selected_npn_protocol(self) -> str | None: ... def accept(self) -> tuple[SSLSocket, socket._RetAddress]: ... @@ -378,21 +378,21 @@ class SSLContext: if sys.version_info >= (3, 8): keylog_filename: str post_handshake_auth: bool - def __new__(cls: type[Self], protocol: int = ..., *args: Any, **kwargs: Any) -> Self: ... + def __new__(cls: type[Self], protocol: int = None, *args: Any, **kwargs: Any) -> Self: ... def cert_store_stats(self) -> dict[str, int]: ... def load_cert_chain( - self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = ..., password: _PasswordType | None = ... + self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = None, password: _PasswordType | None = None ) -> None: ... def load_default_certs(self, purpose: Purpose = ...) -> None: ... def load_verify_locations( - self, cafile: StrOrBytesPath | None = ..., capath: StrOrBytesPath | None = ..., cadata: str | ReadableBuffer | None = ... + self, cafile: StrOrBytesPath | None = None, capath: StrOrBytesPath | None = None, cadata: str | ReadableBuffer | None = None ) -> None: ... @overload - def get_ca_certs(self, binary_form: Literal[False] = ...) -> list[_PeerCertRetDictType]: ... + def get_ca_certs(self, binary_form: Literal[False] = False) -> list[_PeerCertRetDictType]: ... @overload def get_ca_certs(self, binary_form: Literal[True]) -> list[bytes]: ... @overload - def get_ca_certs(self, binary_form: bool = ...) -> Any: ... + def get_ca_certs(self, binary_form: bool = False) -> Any: ... def get_ciphers(self) -> list[_Cipher]: ... def set_default_verify_paths(self) -> None: ... def set_ciphers(self, __cipherlist: str) -> None: ... @@ -404,19 +404,19 @@ class SSLContext: def wrap_socket( self, sock: socket.socket, - server_side: bool = ..., - do_handshake_on_connect: bool = ..., - suppress_ragged_eofs: bool = ..., - server_hostname: str | None = ..., - session: SSLSession | None = ..., + server_side: bool = False, + do_handshake_on_connect: bool = True, + suppress_ragged_eofs: bool = True, + server_hostname: str | None = None, + session: SSLSession | None = None, ) -> SSLSocket: ... def wrap_bio( self, incoming: MemoryBIO, outgoing: MemoryBIO, - server_side: bool = ..., - server_hostname: str | None = ..., - session: SSLSession | None = ..., + server_side: bool = False, + server_hostname: str | None = None, + session: SSLSession | None = None, ) -> SSLObject: ... def session_stats(self) -> dict[str, int]: ... @@ -430,10 +430,10 @@ class SSLObject: @property def session_reused(self) -> bool: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def read(self, len: int = ..., buffer: bytearray | None = ...) -> bytes: ... + def read(self, len: int = 1024, buffer: bytearray | None = None) -> bytes: ... def write(self, data: ReadableBuffer) -> int: ... @overload - def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ... + def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ... @overload def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload @@ -447,7 +447,7 @@ class SSLObject: def do_handshake(self) -> None: ... def unwrap(self) -> None: ... def version(self) -> str | None: ... - def get_channel_binding(self, cb_type: str = ...) -> bytes | None: ... + def get_channel_binding(self, cb_type: str = 'tls-unique') -> bytes | None: ... if sys.version_info >= (3, 8): def verify_client_post_handshake(self) -> None: ... diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index 9a834e6b20ea..d4c83376177b 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -73,7 +73,7 @@ def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: if sys.version_info >= (3, 8): def quantiles( - data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = "exclusive" + data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = 'exclusive' ) -> list[_NumberT]: ... def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: ... @@ -94,12 +94,12 @@ if sys.version_info >= (3, 8): def variance(self) -> float: ... @classmethod def from_samples(cls: type[Self], data: Iterable[SupportsFloat]) -> Self: ... - def samples(self, n: int, *, seed: Any | None = ...) -> list[float]: ... + def samples(self, n: int, *, seed: Any | None = None) -> list[float]: ... def pdf(self, x: float) -> float: ... def cdf(self, x: float) -> float: ... def inv_cdf(self, p: float) -> float: ... def overlap(self, other: NormalDist) -> float: ... - def quantiles(self, n: int = ...) -> list[float]: ... + def quantiles(self, n: int = 4) -> list[float]: ... if sys.version_info >= (3, 9): def zscore(self, x: float) -> float: ... diff --git a/stdlib/string.pyi b/stdlib/string.pyi index 3dd68e2af33f..dc9a449e0e39 100644 --- a/stdlib/string.pyi +++ b/stdlib/string.pyi @@ -71,7 +71,7 @@ class Formatter: kwargs: Mapping[str, Any], used_args: set[int | str], recursion_depth: int, - auto_arg_index: int = ..., + auto_arg_index: int = 0, ) -> tuple[str, int]: ... def parse( self, format_string: StrOrLiteralStr diff --git a/stdlib/struct.pyi b/stdlib/struct.pyi index c9f8251d6bc2..4220cd825b76 100644 --- a/stdlib/struct.pyi +++ b/stdlib/struct.pyi @@ -22,5 +22,5 @@ class Struct: def pack(self, *v: Any) -> bytes: ... def pack_into(self, buffer: WriteableBuffer, offset: int, *v: Any) -> None: ... def unpack(self, __buffer: ReadableBuffer) -> tuple[Any, ...]: ... - def unpack_from(self, buffer: ReadableBuffer, offset: int = ...) -> tuple[Any, ...]: ... + def unpack_from(self, buffer: ReadableBuffer, offset: int = 0) -> tuple[Any, ...]: ... def iter_unpack(self, __buffer: ReadableBuffer) -> Iterator[tuple[Any, ...]]: ... diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index bd92fb7166dd..712f15d4a28a 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -96,8 +96,8 @@ class CompletedProcess(Generic[_T]): self, args: _CMD, returncode: int, - stdout: _T | None = ..., # pyright: ignore[reportInvalidTypeVarUse] - stderr: _T | None = ..., + stdout: _T | None = None, # pyright: ignore[reportInvalidTypeVarUse] + stderr: _T | None = None, ) -> None: ... def check_returncode(self) -> None: ... if sys.version_info >= (3, 9): @@ -933,7 +933,7 @@ elif sys.version_info >= (3, 10): start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, - timeout: float | None = None, + timeout: float | None = ..., text: bool | None = ..., user: str | int | None = ..., group: str | int | None = ..., @@ -963,7 +963,7 @@ elif sys.version_info >= (3, 9): start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, - timeout: float | None = None, + timeout: float | None = ..., text: bool | None = ..., user: str | int | None = ..., group: str | int | None = ..., @@ -991,7 +991,7 @@ else: start_new_session: bool = ..., pass_fds: Collection[int] = ..., *, - timeout: float | None = None, + timeout: float | None = ..., text: bool | None = ..., ) -> int: ... @@ -1822,7 +1822,7 @@ DEVNULL: int class SubprocessError(Exception): ... class TimeoutExpired(SubprocessError): - def __init__(self, cmd: _CMD, timeout: float, output: str | bytes | None = ..., stderr: str | bytes | None = ...) -> None: ... + def __init__(self, cmd: _CMD, timeout: float, output: str | bytes | None = None, stderr: str | bytes | None = None) -> None: ... # morally: _CMD cmd: Any timeout: float @@ -1842,7 +1842,7 @@ class CalledProcessError(SubprocessError): stdout: Any stderr: Any def __init__( - self, returncode: int, cmd: _CMD, output: str | bytes | None = ..., stderr: str | bytes | None = ... + self, returncode: int, cmd: _CMD, output: str | bytes | None = None, stderr: str | bytes | None = None ) -> None: ... class Popen(Generic[AnyStr]): @@ -2557,11 +2557,11 @@ class Popen(Generic[AnyStr]): ) -> None: ... def poll(self) -> int | None: ... - def wait(self, timeout: float | None = ...) -> int: ... + def wait(self, timeout: float | None = None) -> int: ... # morally the members of the returned tuple should be optional # TODO this should allow ReadableBuffer for Popen[bytes], but adding # overloads for that runs into a mypy bug (python/mypy#14070). - def communicate(self, input: AnyStr | None = ..., timeout: float | None = ...) -> tuple[AnyStr, AnyStr]: ... + def communicate(self, input: AnyStr | None = None, timeout: float | None = None) -> tuple[AnyStr, AnyStr]: ... def send_signal(self, sig: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... @@ -2574,8 +2574,8 @@ class Popen(Generic[AnyStr]): # The result really is always a str. if sys.version_info >= (3, 11): - def getstatusoutput(cmd: str | bytes, *, encoding: str | None = ..., errors: str | None = ...) -> tuple[int, str]: ... - def getoutput(cmd: str | bytes, *, encoding: str | None = ..., errors: str | None = ...) -> str: ... + def getstatusoutput(cmd: str | bytes, *, encoding: str | None = None, errors: str | None = None) -> tuple[int, str]: ... + def getoutput(cmd: str | bytes, *, encoding: str | None = None, errors: str | None = None) -> str: ... else: def getstatusoutput(cmd: str | bytes) -> tuple[int, str]: ... diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index 4a4bcb24d94c..ed6c14e2ec91 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -28,8 +28,8 @@ if sys.version_info >= (3, 10): def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... def get_path_names() -> tuple[str, ...]: ... -def get_path(name: str, scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... -def get_paths(scheme: str = ..., vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... +def get_path(name: str, scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... +def get_paths(scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... @@ -39,6 +39,6 @@ if sys.version_info >= (3, 11): else: def is_python_build(check_home: bool = False) -> bool: ... -def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = ...) -> dict[str, Any]: ... +def parse_config_h(fp: IO[Any], vars: dict[str, Any] | None = None) -> dict[str, Any]: ... def get_config_h_filename() -> str: ... def get_makefile_filename() -> str: ... diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index e92ad95959da..0071ebe217f3 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -90,7 +90,7 @@ ENCODING: str def open( name: StrOrBytesPath | None = None, - mode: str = "r", + mode: str = 'r', fileobj: IO[bytes] | None = None, # depends on mode bufsize: int = 10240, *, @@ -127,19 +127,19 @@ class TarFile: offset: int # undocumented def __init__( self, - name: StrOrBytesPath | None = ..., - mode: Literal["r", "a", "w", "x"] = ..., - fileobj: _Fileobj | None = ..., - format: int | None = ..., - tarinfo: type[TarInfo] | None = ..., - dereference: bool | None = ..., - ignore_zeros: bool | None = ..., - encoding: str | None = ..., - errors: str = ..., - pax_headers: Mapping[str, str] | None = ..., - debug: int | None = ..., - errorlevel: int | None = ..., - copybufsize: int | None = ..., # undocumented + name: StrOrBytesPath | None = None, + mode: Literal["r", "a", "w", "x"] = 'r', + fileobj: _Fileobj | None = None, + format: int | None = None, + tarinfo: type[TarInfo] | None = None, + dereference: bool | None = None, + ignore_zeros: bool | None = None, + encoding: str | None = None, + errors: str = 'surrogateescape', + pax_headers: Mapping[str, str] | None = None, + debug: int | None = None, + errorlevel: int | None = None, + copybufsize: int | None = None, # undocumented ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__( @@ -149,10 +149,10 @@ class TarFile: @classmethod def open( cls: type[Self], - name: StrOrBytesPath | None = ..., - mode: str = ..., - fileobj: IO[bytes] | None = ..., # depends on mode - bufsize: int = ..., + name: StrOrBytesPath | None = None, + mode: str = 'r', + fileobj: IO[bytes] | None = None, # depends on mode + bufsize: int = 10240, *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -168,8 +168,8 @@ class TarFile: def taropen( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r", "a", "w", "x"] = ..., - fileobj: _Fileobj | None = ..., + mode: Literal["r", "a", "w", "x"] = 'r', + fileobj: _Fileobj | None = None, *, compresslevel: int = ..., format: int | None = ..., @@ -186,9 +186,9 @@ class TarFile: def gzopen( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r"] = ..., - fileobj: _GzipReadableFileobj | None = ..., - compresslevel: int = ..., + mode: Literal["r"] = 'r', + fileobj: _GzipReadableFileobj | None = None, + compresslevel: int = 9, *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -205,8 +205,8 @@ class TarFile: cls: type[Self], name: StrOrBytesPath | None, mode: Literal["w", "x"], - fileobj: _GzipWritableFileobj | None = ..., - compresslevel: int = ..., + fileobj: _GzipWritableFileobj | None = None, + compresslevel: int = 9, *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -223,8 +223,8 @@ class TarFile: cls: type[Self], name: StrOrBytesPath | None, mode: Literal["w", "x"], - fileobj: _Bz2WritableFileobj | None = ..., - compresslevel: int = ..., + fileobj: _Bz2WritableFileobj | None = None, + compresslevel: int = 9, *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -240,9 +240,9 @@ class TarFile: def bz2open( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r"] = ..., - fileobj: _Bz2ReadableFileobj | None = ..., - compresslevel: int = ..., + mode: Literal["r"] = 'r', + fileobj: _Bz2ReadableFileobj | None = None, + compresslevel: int = 9, *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -257,9 +257,9 @@ class TarFile: def xzopen( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r", "w", "x"] = ..., - fileobj: IO[bytes] | None = ..., - preset: int | None = ..., + mode: Literal["r", "w", "x"] = 'r', + fileobj: IO[bytes] | None = None, + preset: int | None = None, *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -273,16 +273,16 @@ class TarFile: def getmember(self, name: str) -> TarInfo: ... def getmembers(self) -> _list[TarInfo]: ... def getnames(self) -> _list[str]: ... - def list(self, verbose: bool = ..., *, members: _list[TarInfo] | None = ...) -> None: ... + def list(self, verbose: bool = True, *, members: _list[TarInfo] | None = None) -> None: ... def next(self) -> TarInfo | None: ... def extractall( - self, path: StrOrBytesPath = ..., members: Iterable[TarInfo] | None = ..., *, numeric_owner: bool = ... + self, path: StrOrBytesPath = '.', members: Iterable[TarInfo] | None = None, *, numeric_owner: bool = False ) -> None: ... def extract( - self, member: str | TarInfo, path: StrOrBytesPath = ..., set_attrs: bool = ..., *, numeric_owner: bool = ... + self, member: str | TarInfo, path: StrOrBytesPath = '', set_attrs: bool = True, *, numeric_owner: bool = False ) -> None: ... def _extract_member( - self, tarinfo: TarInfo, targetpath: str, set_attrs: bool = ..., numeric_owner: bool = ... + self, tarinfo: TarInfo, targetpath: str, set_attrs: bool = True, numeric_owner: bool = False ) -> None: ... # undocumented def extractfile(self, member: str | TarInfo) -> IO[bytes] | None: ... def makedir(self, tarinfo: TarInfo, targetpath: StrOrBytesPath) -> None: ... # undocumented @@ -297,14 +297,14 @@ class TarFile: def add( self, name: StrPath, - arcname: StrPath | None = ..., - recursive: bool = ..., + arcname: StrPath | None = None, + recursive: bool = True, *, - filter: Callable[[TarInfo], TarInfo | None] | None = ..., + filter: Callable[[TarInfo], TarInfo | None] | None = None, ) -> None: ... - def addfile(self, tarinfo: TarInfo, fileobj: IO[bytes] | None = ...) -> None: ... + def addfile(self, tarinfo: TarInfo, fileobj: IO[bytes] | None = None) -> None: ... def gettarinfo( - self, name: StrOrBytesPath | None = ..., arcname: str | None = ..., fileobj: IO[bytes] | None = ... + self, name: StrOrBytesPath | None = None, arcname: str | None = None, fileobj: IO[bytes] | None = None ) -> TarInfo: ... def close(self) -> None: ... @@ -344,7 +344,7 @@ class TarInfo: uname: str gname: str pax_headers: Mapping[str, str] - def __init__(self, name: str = ...) -> None: ... + def __init__(self, name: str = '') -> None: ... @classmethod def frombuf(cls: Type[Self], buf: bytes | bytearray, encoding: str, errors: str) -> Self: ... @classmethod @@ -354,7 +354,7 @@ class TarInfo: @linkpath.setter def linkpath(self, linkname: str) -> None: ... def get_info(self) -> Mapping[str, str | int | bytes | Mapping[str, str]]: ... - def tobuf(self, format: int | None = ..., encoding: str | None = ..., errors: str = ...) -> bytes: ... + def tobuf(self, format: int | None = 2, encoding: str | None = 'utf-8', errors: str = 'surrogateescape') -> bytes: ... def create_ustar_header( self, info: Mapping[str, str | int | bytes | Mapping[str, str]], encoding: str, errors: str ) -> bytes: ... diff --git a/stdlib/telnetlib.pyi b/stdlib/telnetlib.pyi index 67ae5fcc8055..bcf9ef3693b2 100644 --- a/stdlib/telnetlib.pyi +++ b/stdlib/telnetlib.pyi @@ -88,15 +88,15 @@ NOOPT: bytes class Telnet: host: str | None # undocumented - def __init__(self, host: str | None = ..., port: int = ..., timeout: float = ...) -> None: ... - def open(self, host: str, port: int = ..., timeout: float = ...) -> None: ... + def __init__(self, host: str | None = None, port: int = 0, timeout: float = ...) -> None: ... + def open(self, host: str, port: int = 0, timeout: float = ...) -> None: ... def msg(self, msg: str, *args: Any) -> None: ... def set_debuglevel(self, debuglevel: int) -> None: ... def close(self) -> None: ... def get_socket(self) -> socket.socket: ... def fileno(self) -> int: ... def write(self, buffer: bytes) -> None: ... - def read_until(self, match: bytes, timeout: float | None = ...) -> bytes: ... + def read_until(self, match: bytes, timeout: float | None = None) -> bytes: ... def read_all(self) -> bytes: ... def read_some(self) -> bytes: ... def read_very_eager(self) -> bytes: ... @@ -113,7 +113,7 @@ class Telnet: def mt_interact(self) -> None: ... def listener(self) -> None: ... def expect( - self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = ... + self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = None ) -> tuple[int, Match[bytes] | None, bytes]: ... def __enter__(self: Self) -> Self: ... def __exit__( diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index 1ed7a9fb85bb..1d5feb26d9af 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -185,7 +185,7 @@ class _TemporaryFileWrapper(Generic[AnyStr], IO[AnyStr]): file: IO[AnyStr] # io.TextIOWrapper, io.BufferedReader or io.BufferedWriter name: str delete: bool - def __init__(self, file: IO[AnyStr], name: str, delete: bool = ...) -> None: ... + def __init__(self, file: IO[AnyStr], name: str, delete: bool = True) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ... def __getattr__(self, name: str) -> Any: ... @@ -337,7 +337,7 @@ class SpooledTemporaryFile(IO[AnyStr], _SpooledTemporaryFileBase): def readlines(self, __hint: int = ...) -> list[AnyStr]: ... # type: ignore[override] def seek(self, offset: int, whence: int = ...) -> int: ... def tell(self) -> int: ... - def truncate(self, size: int | None = ...) -> None: ... # type: ignore[override] + def truncate(self, size: int | None = None) -> None: ... # type: ignore[override] def write(self, s: AnyStr) -> int: ... def writelines(self, iterable: Iterable[AnyStr]) -> None: ... # type: ignore[override] def __iter__(self) -> Iterator[AnyStr]: ... # type: ignore[override] @@ -399,7 +399,7 @@ def mkstemp( def mkdtemp(suffix: str | None = ..., prefix: str | None = ..., dir: StrPath | None = ...) -> str: ... # type: ignore[misc] @overload def mkdtemp(suffix: bytes | None = ..., prefix: bytes | None = ..., dir: BytesPath | None = ...) -> bytes: ... -def mktemp(suffix: str = "", prefix: str = "tmp", dir: StrPath | None = None) -> str: ... +def mktemp(suffix: str = '', prefix: str = 'tmp', dir: StrPath | None = None) -> str: ... def gettempdirb() -> bytes: ... def gettempprefixb() -> bytes: ... def gettempdir() -> str: ... diff --git a/stdlib/textwrap.pyi b/stdlib/textwrap.pyi index 34f5925acb08..f3017d12cd7e 100644 --- a/stdlib/textwrap.pyi +++ b/stdlib/textwrap.pyi @@ -27,19 +27,19 @@ class TextWrapper: x: str # leaked loop variable def __init__( self, - width: int = ..., - initial_indent: str = ..., - subsequent_indent: str = ..., - expand_tabs: bool = ..., - replace_whitespace: bool = ..., - fix_sentence_endings: bool = ..., - break_long_words: bool = ..., - drop_whitespace: bool = ..., - break_on_hyphens: bool = ..., - tabsize: int = ..., + width: int = 70, + initial_indent: str = '', + subsequent_indent: str = '', + expand_tabs: bool = True, + replace_whitespace: bool = True, + fix_sentence_endings: bool = False, + break_long_words: bool = True, + drop_whitespace: bool = True, + break_on_hyphens: bool = True, + tabsize: int = 8, *, - max_lines: int | None = ..., - placeholder: str = ..., + max_lines: int | None = None, + placeholder: str = ' [...]', ) -> None: ... # Private methods *are* part of the documented API for subclasses. def _munge_whitespace(self, text: str) -> str: ... diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index 6fb1ab99c833..66262715bcd7 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -74,17 +74,17 @@ class Thread: daemon: bool def __init__( self, - group: None = ..., - target: Callable[..., object] | None = ..., - name: str | None = ..., + group: None = None, + target: Callable[..., object] | None = None, + name: str | None = None, args: Iterable[Any] = ..., - kwargs: Mapping[str, Any] | None = ..., + kwargs: Mapping[str, Any] | None = None, *, - daemon: bool | None = ..., + daemon: bool | None = None, ) -> None: ... def start(self) -> None: ... def run(self) -> None: ... - def join(self, timeout: float | None = ...) -> None: ... + def join(self, timeout: float | None = None) -> None: ... if sys.version_info >= (3, 8): @property def native_id(self) -> int | None: ... # only available on some platforms @@ -111,7 +111,7 @@ class Lock: def locked(self) -> bool: ... class _RLock: - def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... + def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... def release(self) -> None: ... __enter__ = acquire def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... @@ -119,25 +119,25 @@ class _RLock: RLock = _RLock class Condition: - def __init__(self, lock: Lock | _RLock | None = ...) -> None: ... + def __init__(self, lock: Lock | _RLock | None = None) -> None: ... def __enter__(self) -> bool: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... def release(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... - def wait_for(self, predicate: Callable[[], _T], timeout: float | None = ...) -> _T: ... - def notify(self, n: int = ...) -> None: ... + def wait(self, timeout: float | None = None) -> bool: ... + def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ... + def notify(self, n: int = 1) -> None: ... def notify_all(self) -> None: ... def notifyAll(self) -> None: ... # deprecated alias for notify_all() class Semaphore: _value: int - def __init__(self, value: int = ...) -> None: ... + def __init__(self, value: int = 1) -> None: ... def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... - def acquire(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ... - def __enter__(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ... + def acquire(self, blocking: bool = True, timeout: float | None = None) -> bool: ... + def __enter__(self, blocking: bool = True, timeout: float | None = None) -> bool: ... if sys.version_info >= (3, 9): def release(self, n: int = ...) -> None: ... else: @@ -150,7 +150,7 @@ class Event: def isSet(self) -> bool: ... # deprecated alias for is_set() def set(self) -> None: ... def clear(self) -> None: ... - def wait(self, timeout: float | None = ...) -> bool: ... + def wait(self, timeout: float | None = None) -> bool: ... if sys.version_info >= (3, 8): from _thread import _excepthook, _ExceptHookArgs @@ -169,8 +169,8 @@ class Timer(Thread): self, interval: float, function: Callable[..., object], - args: Iterable[Any] | None = ..., - kwargs: Mapping[str, Any] | None = ..., + args: Iterable[Any] | None = None, + kwargs: Mapping[str, Any] | None = None, ) -> None: ... def cancel(self) -> None: ... @@ -181,8 +181,8 @@ class Barrier: def n_waiting(self) -> int: ... @property def broken(self) -> bool: ... - def __init__(self, parties: int, action: Callable[[], None] | None = ..., timeout: float | None = ...) -> None: ... - def wait(self, timeout: float | None = ...) -> int: ... + def __init__(self, parties: int, action: Callable[[], None] | None = None, timeout: float | None = None) -> None: ... + def wait(self, timeout: float | None = None) -> int: ... def reset(self) -> None: ... def abort(self) -> None: ... diff --git a/stdlib/timeit.pyi b/stdlib/timeit.pyi index be7d16703098..01a9d6da34f3 100644 --- a/stdlib/timeit.pyi +++ b/stdlib/timeit.pyi @@ -11,19 +11,19 @@ default_timer: _Timer class Timer: def __init__( - self, stmt: _Stmt = ..., setup: _Stmt = ..., timer: _Timer = ..., globals: dict[str, Any] | None = ... + self, stmt: _Stmt = 'pass', setup: _Stmt = 'pass', timer: _Timer = ..., globals: dict[str, Any] | None = None ) -> None: ... - def print_exc(self, file: IO[str] | None = ...) -> None: ... - def timeit(self, number: int = ...) -> float: ... - def repeat(self, repeat: int = ..., number: int = ...) -> list[float]: ... - def autorange(self, callback: Callable[[int, float], object] | None = ...) -> tuple[int, float]: ... + def print_exc(self, file: IO[str] | None = None) -> None: ... + def timeit(self, number: int = 1000000) -> float: ... + def repeat(self, repeat: int = 5, number: int = 1000000) -> list[float]: ... + def autorange(self, callback: Callable[[int, float], object] | None = None) -> tuple[int, float]: ... def timeit( - stmt: _Stmt = "pass", setup: _Stmt = "pass", timer: _Timer = ..., number: int = 1000000, globals: dict[str, Any] | None = None + stmt: _Stmt = 'pass', setup: _Stmt = 'pass', timer: _Timer = ..., number: int = 1000000, globals: dict[str, Any] | None = None ) -> float: ... def repeat( - stmt: _Stmt = "pass", - setup: _Stmt = "pass", + stmt: _Stmt = 'pass', + setup: _Stmt = 'pass', timer: _Timer = ..., repeat: int = 5, number: int = 1000000, diff --git a/stdlib/trace.pyi b/stdlib/trace.pyi index 1f0de1d4d964..f79b38f1ce82 100644 --- a/stdlib/trace.pyi +++ b/stdlib/trace.pyi @@ -14,35 +14,35 @@ _FileModuleFunction: TypeAlias = tuple[str, str | None, str] class CoverageResults: def __init__( self, - counts: dict[tuple[str, int], int] | None = ..., - calledfuncs: dict[_FileModuleFunction, int] | None = ..., - infile: StrPath | None = ..., - callers: dict[tuple[_FileModuleFunction, _FileModuleFunction], int] | None = ..., - outfile: StrPath | None = ..., + counts: dict[tuple[str, int], int] | None = None, + calledfuncs: dict[_FileModuleFunction, int] | None = None, + infile: StrPath | None = None, + callers: dict[tuple[_FileModuleFunction, _FileModuleFunction], int] | None = None, + outfile: StrPath | None = None, ) -> None: ... # undocumented def update(self, other: CoverageResults) -> None: ... - def write_results(self, show_missing: bool = ..., summary: bool = ..., coverdir: StrPath | None = ...) -> None: ... + def write_results(self, show_missing: bool = True, summary: bool = False, coverdir: StrPath | None = None) -> None: ... def write_results_file( - self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: str | None = ... + self, path: StrPath, lines: Sequence[str], lnotab: Any, lines_hit: Mapping[int, int], encoding: str | None = None ) -> tuple[int, int]: ... def is_ignored_filename(self, filename: str) -> bool: ... # undocumented class Trace: def __init__( self, - count: int = ..., - trace: int = ..., - countfuncs: int = ..., - countcallers: int = ..., + count: int = 1, + trace: int = 1, + countfuncs: int = 0, + countcallers: int = 0, ignoremods: Sequence[str] = ..., ignoredirs: Sequence[str] = ..., - infile: StrPath | None = ..., - outfile: StrPath | None = ..., - timing: bool = ..., + infile: StrPath | None = None, + outfile: StrPath | None = None, + timing: bool = False, ) -> None: ... def run(self, cmd: str | types.CodeType) -> None: ... def runctx( - self, cmd: str | types.CodeType, globals: Mapping[str, Any] | None = ..., locals: Mapping[str, Any] | None = ... + self, cmd: str | types.CodeType, globals: Mapping[str, Any] | None = None, locals: Mapping[str, Any] | None = None ) -> None: ... if sys.version_info >= (3, 9): def runfunc(self, __func: Callable[_P, _T], *args: _P.args, **kw: _P.kwargs) -> _T: ... diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index 6ae417cc9c7f..7688f3fb38d1 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -61,16 +61,16 @@ else: etype: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, - limit: int | None = None, - file: SupportsWrite[str] | None = None, - chain: bool = True, + limit: int | None = ..., + file: SupportsWrite[str] | None = ..., + chain: bool = ..., ) -> None: ... def format_exception( etype: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None, - limit: int | None = None, - chain: bool = True, + limit: int | None = ..., + chain: bool = ..., ) -> list[str]: ... def print_exc(limit: int | None = None, file: SupportsWrite[str] | None = None, chain: bool = True) -> None: ... @@ -99,7 +99,7 @@ def walk_tb(tb: TracebackType | None) -> Iterator[tuple[FrameType, int]]: ... if sys.version_info >= (3, 11): class _ExceptionPrintContext: def indent(self) -> str: ... - def emit(self, text_gen: str | Iterable[str], margin_char: str | None = ...) -> Generator[str, None, None]: ... + def emit(self, text_gen: str | Iterable[str], margin_char: str | None = None) -> Generator[str, None, None]: ... class TracebackException: __cause__: TracebackException @@ -246,9 +246,9 @@ class StackSummary(list[FrameSummary]): cls, frame_gen: Iterable[tuple[FrameType, int]], *, - limit: int | None = ..., - lookup_lines: bool = ..., - capture_locals: bool = ..., + limit: int | None = None, + lookup_lines: bool = True, + capture_locals: bool = False, ) -> StackSummary: ... @classmethod def from_list(cls, a_list: Iterable[FrameSummary | _PT]) -> StackSummary: ... diff --git a/stdlib/tracemalloc.pyi b/stdlib/tracemalloc.pyi index ed952616600f..b551fb113d39 100644 --- a/stdlib/tracemalloc.pyi +++ b/stdlib/tracemalloc.pyi @@ -23,7 +23,7 @@ class Filter(BaseFilter): def filename_pattern(self) -> str: ... all_frames: bool def __init__( - self, inclusive: bool, filename_pattern: str, lineno: int | None = ..., all_frames: bool = ..., domain: int | None = ... + self, inclusive: bool, filename_pattern: str, lineno: int | None = None, all_frames: bool = False, domain: int | None = None ) -> None: ... class Statistic: @@ -84,7 +84,7 @@ class Traceback(Sequence[Frame]): else: def __init__(self, frames: Sequence[_FrameTuple]) -> None: ... - def format(self, limit: int | None = ..., most_recent_first: bool = ...) -> list[str]: ... + def format(self, limit: int | None = None, most_recent_first: bool = False) -> list[str]: ... @overload def __getitem__(self, index: SupportsIndex) -> Frame: ... @overload @@ -104,11 +104,11 @@ class Traceback(Sequence[Frame]): class Snapshot: def __init__(self, traces: Sequence[_TraceTuple], traceback_limit: int) -> None: ... - def compare_to(self, old_snapshot: Snapshot, key_type: str, cumulative: bool = ...) -> list[StatisticDiff]: ... + def compare_to(self, old_snapshot: Snapshot, key_type: str, cumulative: bool = False) -> list[StatisticDiff]: ... def dump(self, filename: str) -> None: ... def filter_traces(self, filters: Sequence[DomainFilter | Filter]) -> Snapshot: ... @staticmethod def load(filename: str) -> Snapshot: ... - def statistics(self, key_type: str, cumulative: bool = ...) -> list[Statistic]: ... + def statistics(self, key_type: str, cumulative: bool = False) -> list[Statistic]: ... traceback_limit: int traces: Sequence[Trace] diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 83b70a6097cf..6153ac193fb7 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -137,7 +137,7 @@ class TypeVar: __covariant__: bool __contravariant__: bool def __init__( - self, name: str, *constraints: Any, bound: Any | None = ..., covariant: bool = ..., contravariant: bool = ... + self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False ) -> None: ... if sys.version_info >= (3, 10): def __or__(self, right: Any) -> _SpecialForm: ... @@ -215,7 +215,7 @@ if sys.version_info >= (3, 10): __bound__: Any | None __covariant__: bool __contravariant__: bool - def __init__(self, name: str, *, bound: Any | None = ..., contravariant: bool = ..., covariant: bool = ...) -> None: ... + def __init__(self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False) -> None: ... @property def args(self) -> ParamSpecArgs: ... @property @@ -465,7 +465,7 @@ class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]): @abstractmethod def __getitem__(self, index: slice) -> Sequence[_T_co]: ... # Mixin methods - def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ... + def index(self, value: Any, start: int = 0, stop: int = None) -> int: ... def count(self, value: Any) -> int: ... def __contains__(self, value: object) -> bool: ... def __iter__(self) -> Iterator[_T_co]: ... @@ -497,7 +497,7 @@ class MutableSequence(Sequence[_T], Generic[_T]): def clear(self) -> None: ... def extend(self, values: Iterable[_T]) -> None: ... def reverse(self) -> None: ... - def pop(self, index: int = ...) -> _T: ... + def pop(self, index: int = -1) -> _T: ... def remove(self, value: _T) -> None: ... def __iadd__(self: _typeshed.Self, values: Iterable[_T]) -> _typeshed.Self: ... @@ -735,7 +735,7 @@ if sys.version_info >= (3, 9): else: def get_type_hints( - obj: _get_type_hints_obj_allowed_types, globalns: dict[str, Any] | None = None, localns: dict[str, Any] | None = None + obj: _get_type_hints_obj_allowed_types, globalns: dict[str, Any] | None = ..., localns: dict[str, Any] | None = ... ) -> dict[str, Any]: ... if sys.version_info >= (3, 8): diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index 66e9d9461c3e..a635785b3009 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -224,9 +224,9 @@ else: def dataclass_transform( *, - eq_default: bool = True, - order_default: bool = False, - kw_only_default: bool = False, + eq_default: bool = ..., + order_default: bool = ..., + kw_only_default: bool = ..., field_specifiers: tuple[type[Any] | Callable[..., Any], ...] = ..., **kwargs: object, ) -> IdentityFunction: ... @@ -291,9 +291,9 @@ class ParamSpec: self, name: str, *, - bound: None | type[Any] | str = ..., - contravariant: bool = ..., - covariant: bool = ..., + bound: None | type[Any] | str = None, + contravariant: bool = False, + covariant: bool = False, default: type[Any] | str | None = ..., ) -> None: ... @property diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index 42633ed13bb8..f645640838ea 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -94,7 +94,7 @@ class TestCase: _testMethodName: str # undocumented _testMethodDoc: str - def __init__(self, methodName: str = ...) -> None: ... + def __init__(self, methodName: str = 'runTest') -> None: ... def __eq__(self, other: object) -> bool: ... def setUp(self) -> None: ... def tearDown(self) -> None: ... @@ -102,7 +102,7 @@ class TestCase: def setUpClass(cls) -> None: ... @classmethod def tearDownClass(cls) -> None: ... - def run(self, result: unittest.result.TestResult | None = ...) -> unittest.result.TestResult | None: ... + def run(self, result: unittest.result.TestResult | None = None) -> unittest.result.TestResult | None: ... def __call__(self, result: unittest.result.TestResult | None = ...) -> unittest.result.TestResult | None: ... def skipTest(self, reason: Any) -> NoReturn: ... def subTest(self, msg: Any = ..., **params: Any) -> AbstractContextManager[None]: ... @@ -110,34 +110,34 @@ class TestCase: if sys.version_info < (3, 11): def _addSkip(self, result: unittest.result.TestResult, test_case: TestCase, reason: str) -> None: ... - def assertEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def assertNotEqual(self, first: Any, second: Any, msg: Any = ...) -> None: ... - def assertTrue(self, expr: Any, msg: Any = ...) -> None: ... - def assertFalse(self, expr: Any, msg: Any = ...) -> None: ... - def assertIs(self, expr1: object, expr2: object, msg: Any = ...) -> None: ... - def assertIsNot(self, expr1: object, expr2: object, msg: Any = ...) -> None: ... - def assertIsNone(self, obj: object, msg: Any = ...) -> None: ... - def assertIsNotNone(self, obj: object, msg: Any = ...) -> None: ... - def assertIn(self, member: Any, container: Iterable[Any] | Container[Any], msg: Any = ...) -> None: ... - def assertNotIn(self, member: Any, container: Iterable[Any] | Container[Any], msg: Any = ...) -> None: ... - def assertIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = ...) -> None: ... - def assertNotIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = ...) -> None: ... + def assertEqual(self, first: Any, second: Any, msg: Any = None) -> None: ... + def assertNotEqual(self, first: Any, second: Any, msg: Any = None) -> None: ... + def assertTrue(self, expr: Any, msg: Any = None) -> None: ... + def assertFalse(self, expr: Any, msg: Any = None) -> None: ... + def assertIs(self, expr1: object, expr2: object, msg: Any = None) -> None: ... + def assertIsNot(self, expr1: object, expr2: object, msg: Any = None) -> None: ... + def assertIsNone(self, obj: object, msg: Any = None) -> None: ... + def assertIsNotNone(self, obj: object, msg: Any = None) -> None: ... + def assertIn(self, member: Any, container: Iterable[Any] | Container[Any], msg: Any = None) -> None: ... + def assertNotIn(self, member: Any, container: Iterable[Any] | Container[Any], msg: Any = None) -> None: ... + def assertIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = None) -> None: ... + def assertNotIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = None) -> None: ... @overload - def assertGreater(self, a: SupportsDunderGT[_T], b: _T, msg: Any = ...) -> None: ... + def assertGreater(self, a: SupportsDunderGT[_T], b: _T, msg: Any = None) -> None: ... @overload - def assertGreater(self, a: _T, b: SupportsDunderLT[_T], msg: Any = ...) -> None: ... + def assertGreater(self, a: _T, b: SupportsDunderLT[_T], msg: Any = None) -> None: ... @overload - def assertGreaterEqual(self, a: SupportsDunderGE[_T], b: _T, msg: Any = ...) -> None: ... + def assertGreaterEqual(self, a: SupportsDunderGE[_T], b: _T, msg: Any = None) -> None: ... @overload - def assertGreaterEqual(self, a: _T, b: SupportsDunderLE[_T], msg: Any = ...) -> None: ... + def assertGreaterEqual(self, a: _T, b: SupportsDunderLE[_T], msg: Any = None) -> None: ... @overload - def assertLess(self, a: SupportsDunderLT[_T], b: _T, msg: Any = ...) -> None: ... + def assertLess(self, a: SupportsDunderLT[_T], b: _T, msg: Any = None) -> None: ... @overload - def assertLess(self, a: _T, b: SupportsDunderGT[_T], msg: Any = ...) -> None: ... + def assertLess(self, a: _T, b: SupportsDunderGT[_T], msg: Any = None) -> None: ... @overload - def assertLessEqual(self, a: SupportsDunderLT[_T], b: _T, msg: Any = ...) -> None: ... + def assertLessEqual(self, a: SupportsDunderLT[_T], b: _T, msg: Any = None) -> None: ... @overload - def assertLessEqual(self, a: _T, b: SupportsDunderGT[_T], msg: Any = ...) -> None: ... + def assertLessEqual(self, a: _T, b: SupportsDunderGT[_T], msg: Any = None) -> None: ... # `assertRaises`, `assertRaisesRegex`, and `assertRaisesRegexp` # are not using `ParamSpec` intentionally, # because they might be used with explicitly wrong arg types to raise some error in tests. @@ -192,7 +192,7 @@ class TestCase: self, expected_warning: type[Warning] | tuple[type[Warning], ...], expected_regex: str | Pattern[str], *, msg: Any = ... ) -> _AssertWarnsContext: ... def assertLogs( - self, logger: str | logging.Logger | None = ..., level: int | str | None = ... + self, logger: str | logging.Logger | None = None, level: int | str | None = None ) -> _AssertLogsContext[_LoggingWatcher]: ... if sys.version_info >= (3, 10): def assertNoLogs( @@ -203,63 +203,63 @@ class TestCase: def assertAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload def assertAlmostEqual( - self, first: _S, second: _S, places: None = ..., msg: Any = ..., *, delta: _SupportsAbsAndDunderGE + self, first: _S, second: _S, places: None = None, msg: Any = None, *, delta: _SupportsAbsAndDunderGE ) -> None: ... @overload def assertAlmostEqual( self, first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]], second: _T, - places: int | None = ..., - msg: Any = ..., - delta: None = ..., + places: int | None = None, + msg: Any = None, + delta: None = None, ) -> None: ... @overload def assertAlmostEqual( self, first: _T, second: SupportsRSub[_T, SupportsAbs[SupportsRound[object]]], - places: int | None = ..., - msg: Any = ..., - delta: None = ..., + places: int | None = None, + msg: Any = None, + delta: None = None, ) -> None: ... @overload def assertNotAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload def assertNotAlmostEqual( - self, first: _S, second: _S, places: None = ..., msg: Any = ..., *, delta: _SupportsAbsAndDunderGE + self, first: _S, second: _S, places: None = None, msg: Any = None, *, delta: _SupportsAbsAndDunderGE ) -> None: ... @overload def assertNotAlmostEqual( self, first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]], second: _T, - places: int | None = ..., - msg: Any = ..., - delta: None = ..., + places: int | None = None, + msg: Any = None, + delta: None = None, ) -> None: ... @overload def assertNotAlmostEqual( self, first: _T, second: SupportsRSub[_T, SupportsAbs[SupportsRound[object]]], - places: int | None = ..., - msg: Any = ..., - delta: None = ..., + places: int | None = None, + msg: Any = None, + delta: None = None, ) -> None: ... - def assertRegex(self, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... - def assertNotRegex(self, text: AnyStr, unexpected_regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... - def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any], msg: Any = ...) -> None: ... + def assertRegex(self, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = None) -> None: ... + def assertNotRegex(self, text: AnyStr, unexpected_regex: AnyStr | Pattern[AnyStr], msg: Any = None) -> None: ... + def assertCountEqual(self, first: Iterable[Any], second: Iterable[Any], msg: Any = None) -> None: ... def addTypeEqualityFunc(self, typeobj: type[Any], function: Callable[..., None]) -> None: ... - def assertMultiLineEqual(self, first: str, second: str, msg: Any = ...) -> None: ... + def assertMultiLineEqual(self, first: str, second: str, msg: Any = None) -> None: ... def assertSequenceEqual( - self, seq1: Sequence[Any], seq2: Sequence[Any], msg: Any = ..., seq_type: type[Sequence[Any]] | None = ... + self, seq1: Sequence[Any], seq2: Sequence[Any], msg: Any = None, seq_type: type[Sequence[Any]] | None = None ) -> None: ... - def assertListEqual(self, list1: list[Any], list2: list[Any], msg: Any = ...) -> None: ... - def assertTupleEqual(self, tuple1: tuple[Any, ...], tuple2: tuple[Any, ...], msg: Any = ...) -> None: ... - def assertSetEqual(self, set1: AbstractSet[object], set2: AbstractSet[object], msg: Any = ...) -> None: ... - def assertDictEqual(self, d1: Mapping[Any, object], d2: Mapping[Any, object], msg: Any = ...) -> None: ... - def fail(self, msg: Any = ...) -> NoReturn: ... + def assertListEqual(self, list1: list[Any], list2: list[Any], msg: Any = None) -> None: ... + def assertTupleEqual(self, tuple1: tuple[Any, ...], tuple2: tuple[Any, ...], msg: Any = None) -> None: ... + def assertSetEqual(self, set1: AbstractSet[object], set2: AbstractSet[object], msg: Any = None) -> None: ... + def assertDictEqual(self, d1: Mapping[Any, object], d2: Mapping[Any, object], msg: Any = None) -> None: ... + def fail(self, msg: Any = None) -> NoReturn: ... def countTestCases(self) -> int: ... def defaultTestResult(self) -> unittest.result.TestResult: ... def id(self) -> str: ... @@ -309,9 +309,9 @@ class FunctionTestCase(TestCase): def __init__( self, testFunc: Callable[[], Any], - setUp: Callable[[], Any] | None = ..., - tearDown: Callable[[], Any] | None = ..., - description: str | None = ..., + setUp: Callable[[], Any] | None = None, + tearDown: Callable[[], Any] | None = None, + description: str | None = None, ) -> None: ... def runTest(self) -> None: ... diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index 72b21f2553f3..ab8b70dbd58f 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -18,11 +18,11 @@ class TestLoader: testNamePatterns: list[str] | None suiteClass: _SuiteClass def loadTestsFromTestCase(self, testCaseClass: type[unittest.case.TestCase]) -> unittest.suite.TestSuite: ... - def loadTestsFromModule(self, module: ModuleType, *args: Any, pattern: Any = ...) -> unittest.suite.TestSuite: ... - def loadTestsFromName(self, name: str, module: ModuleType | None = ...) -> unittest.suite.TestSuite: ... - def loadTestsFromNames(self, names: Sequence[str], module: ModuleType | None = ...) -> unittest.suite.TestSuite: ... + def loadTestsFromModule(self, module: ModuleType, *args: Any, pattern: Any = None) -> unittest.suite.TestSuite: ... + def loadTestsFromName(self, name: str, module: ModuleType | None = None) -> unittest.suite.TestSuite: ... + def loadTestsFromNames(self, names: Sequence[str], module: ModuleType | None = None) -> unittest.suite.TestSuite: ... def getTestCaseNames(self, testCaseClass: type[unittest.case.TestCase]) -> Sequence[str]: ... - def discover(self, start_dir: str, pattern: str = ..., top_level_dir: str | None = ...) -> unittest.suite.TestSuite: ... + def discover(self, start_dir: str, pattern: str = 'test*.py', top_level_dir: str | None = None) -> unittest.suite.TestSuite: ... def _match_path(self, path: str, full_path: str, pattern: str) -> bool: ... defaultTestLoader: TestLoader @@ -35,10 +35,10 @@ def getTestCaseNames( ) -> Sequence[str]: ... def makeSuite( testCaseClass: type[unittest.case.TestCase], - prefix: str = "test", + prefix: str = 'test', sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ..., ) -> unittest.suite.TestSuite: ... def findTestCases( - module: ModuleType, prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... + module: ModuleType, prefix: str = 'test', sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... ) -> unittest.suite.TestSuite: ... diff --git a/stdlib/unittest/main.pyi b/stdlib/unittest/main.pyi index 915d559cce5b..d32098f89aad 100644 --- a/stdlib/unittest/main.pyi +++ b/stdlib/unittest/main.pyi @@ -25,23 +25,23 @@ class TestProgram: testNamePatterns: list[str] | None def __init__( self, - module: None | str | ModuleType = ..., - defaultTest: str | Iterable[str] | None = ..., - argv: list[str] | None = ..., - testRunner: type[_TestRunner] | _TestRunner | None = ..., + module: None | str | ModuleType = '__main__', + defaultTest: str | Iterable[str] | None = None, + argv: list[str] | None = None, + testRunner: type[_TestRunner] | _TestRunner | None = None, testLoader: unittest.loader.TestLoader = ..., - exit: bool = ..., - verbosity: int = ..., - failfast: bool | None = ..., - catchbreak: bool | None = ..., - buffer: bool | None = ..., - warnings: str | None = ..., + exit: bool = True, + verbosity: int = 1, + failfast: bool | None = None, + catchbreak: bool | None = None, + buffer: bool | None = None, + warnings: str | None = None, *, - tb_locals: bool = ..., + tb_locals: bool = False, ) -> None: ... - def usageExit(self, msg: Any = ...) -> None: ... + def usageExit(self, msg: Any = None) -> None: ... def parseArgs(self, argv: list[str]) -> None: ... - def createTests(self, from_discovery: bool = ..., Loader: unittest.loader.TestLoader | None = ...) -> None: ... + def createTests(self, from_discovery: bool = False, Loader: unittest.loader.TestLoader | None = None) -> None: ... def runTests(self) -> None: ... # undocumented main = TestProgram diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 97e3715aae11..3e87a687a191 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -70,16 +70,16 @@ class _Call(tuple[Any, ...]): def __new__( cls: type[Self], value: _CallValue = ..., - name: str | None = ..., - parent: Any | None = ..., - two: bool = ..., - from_kall: bool = ..., + name: str | None = '', + parent: Any | None = None, + two: bool = False, + from_kall: bool = True, ) -> Self: ... name: Any parent: Any from_kall: Any def __init__( - self, value: _CallValue = ..., name: str | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ... + self, value: _CallValue = ..., name: str | None = None, parent: Any | None = None, two: bool = False, from_kall: bool = True ) -> None: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, __other: object) -> bool: ... @@ -106,17 +106,17 @@ class NonCallableMock(Base, Any): def __new__(__cls: type[Self], *args: Any, **kw: Any) -> Self: ... def __init__( self, - spec: list[str] | object | type[object] | None = ..., - wraps: Any | None = ..., - name: str | None = ..., - spec_set: list[str] | object | type[object] | None = ..., - parent: NonCallableMock | None = ..., - _spec_state: Any | None = ..., - _new_name: str = ..., - _new_parent: NonCallableMock | None = ..., - _spec_as_instance: bool = ..., - _eat_self: bool | None = ..., - unsafe: bool = ..., + spec: list[str] | object | type[object] | None = None, + wraps: Any | None = None, + name: str | None = None, + spec_set: list[str] | object | type[object] | None = None, + parent: NonCallableMock | None = None, + _spec_state: Any | None = None, + _new_name: str = '', + _new_parent: NonCallableMock | None = None, + _spec_as_instance: bool = False, + _eat_self: bool | None = None, + unsafe: bool = False, **kwargs: Any, ) -> None: ... def __getattr__(self, name: str) -> Any: ... @@ -141,13 +141,13 @@ class NonCallableMock(Base, Any): def assert_called(_mock_self) -> None: ... def assert_called_once(_mock_self) -> None: ... - def reset_mock(self, visited: Any = ..., *, return_value: bool = ..., side_effect: bool = ...) -> None: ... + def reset_mock(self, visited: Any = None, *, return_value: bool = False, side_effect: bool = False) -> None: ... def _extract_mock_name(self) -> str: ... def _get_call_signature_from_name(self, name: str) -> Any: ... def assert_any_call(self, *args: Any, **kwargs: Any) -> None: ... - def assert_has_calls(self, calls: Sequence[_Call], any_order: bool = ...) -> None: ... - def mock_add_spec(self, spec: Any, spec_set: bool = ...) -> None: ... - def _mock_add_spec(self, spec: Any, spec_set: bool, _spec_as_instance: bool = ..., _eat_self: bool = ...) -> None: ... + def assert_has_calls(self, calls: Sequence[_Call], any_order: bool = False) -> None: ... + def mock_add_spec(self, spec: Any, spec_set: bool = False) -> None: ... + def _mock_add_spec(self, spec: Any, spec_set: bool, _spec_as_instance: bool = False, _eat_self: bool = False) -> None: ... def attach_mock(self, mock: NonCallableMock, attribute: str) -> None: ... def configure_mock(self, **kwargs: Any) -> None: ... return_value: Any @@ -165,16 +165,16 @@ class CallableMixin(Base): side_effect: Any def __init__( self, - spec: Any | None = ..., - side_effect: Any | None = ..., + spec: Any | None = None, + side_effect: Any | None = None, return_value: Any = ..., - wraps: Any | None = ..., - name: Any | None = ..., - spec_set: Any | None = ..., - parent: Any | None = ..., - _spec_state: Any | None = ..., - _new_name: Any = ..., - _new_parent: Any | None = ..., + wraps: Any | None = None, + name: Any | None = None, + spec_set: Any | None = None, + parent: Any | None = None, + _spec_state: Any | None = None, + _new_name: Any = '', + _new_parent: Any | None = None, **kwargs: Any, ) -> None: ... if sys.version_info >= (3, 8): @@ -258,7 +258,7 @@ class _patch_dict: in_dict: Any values: Any clear: Any - def __init__(self, in_dict: Any, values: Any = ..., clear: Any = ..., **kwargs: Any) -> None: ... + def __init__(self, in_dict: Any, values: Any = ..., clear: Any = False, **kwargs: Any) -> None: ... def __call__(self, f: Any) -> Any: ... if sys.version_info >= (3, 10): def decorate_callable(self, f: _F) -> _F: ... @@ -361,7 +361,7 @@ if sys.version_info >= (3, 8): def assert_awaited_with(self, *args: Any, **kwargs: Any) -> None: ... def assert_awaited_once_with(self, *args: Any, **kwargs: Any) -> None: ... def assert_any_await(self, *args: Any, **kwargs: Any) -> None: ... - def assert_has_awaits(self, calls: Iterable[_Call], any_order: bool = ...) -> None: ... + def assert_has_awaits(self, calls: Iterable[_Call], any_order: bool = False) -> None: ... def assert_not_awaited(self) -> None: ... def reset_mock(self, *args: Any, **kwargs: Any) -> None: ... await_count: int @@ -381,7 +381,7 @@ class MagicProxy: def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def create_mock(self) -> Any: ... - def __get__(self, obj: Any, _type: Any | None = ...) -> Any: ... + def __get__(self, obj: Any, _type: Any | None = None) -> Any: ... class _ANY: def __eq__(self, other: object) -> Literal[True]: ... @@ -403,12 +403,7 @@ if sys.version_info >= (3, 10): else: def create_autospec( - spec: Any, - spec_set: Any = False, - instance: Any = False, - _parent: Any | None = None, - _name: Any | None = None, - **kwargs: Any, + spec: Any, spec_set: Any = ..., instance: Any = ..., _parent: Any | None = ..., _name: Any | None = ..., **kwargs: Any ) -> Any: ... class _SpecState: @@ -421,14 +416,14 @@ class _SpecState: def __init__( self, spec: Any, - spec_set: Any = ..., - parent: Any | None = ..., - name: Any | None = ..., - ids: Any | None = ..., - instance: Any = ..., + spec_set: Any = False, + parent: Any | None = None, + name: Any | None = None, + ids: Any | None = None, + instance: Any = False, ) -> None: ... -def mock_open(mock: Any | None = None, read_data: Any = "") -> Any: ... +def mock_open(mock: Any | None = None, read_data: Any = '') -> Any: ... class PropertyMock(Mock): if sys.version_info >= (3, 8): diff --git a/stdlib/unittest/result.pyi b/stdlib/unittest/result.pyi index 5dfec13cb52c..8d78bc0f7dcf 100644 --- a/stdlib/unittest/result.pyi +++ b/stdlib/unittest/result.pyi @@ -22,7 +22,7 @@ class TestResult: buffer: bool failfast: bool tb_locals: bool - def __init__(self, stream: TextIO | None = ..., descriptions: bool | None = ..., verbosity: int | None = ...) -> None: ... + def __init__(self, stream: TextIO | None = None, descriptions: bool | None = None, verbosity: int | None = None) -> None: ... def printErrors(self) -> None: ... def wasSuccessful(self) -> bool: ... def stop(self) -> None: ... diff --git a/stdlib/unittest/runner.pyi b/stdlib/unittest/runner.pyi index 17514828898a..c0ddcdb49208 100644 --- a/stdlib/unittest/runner.pyi +++ b/stdlib/unittest/runner.pyi @@ -22,15 +22,15 @@ class TextTestRunner: resultclass: _ResultClassType def __init__( self, - stream: TextIO | None = ..., - descriptions: bool = ..., - verbosity: int = ..., - failfast: bool = ..., - buffer: bool = ..., - resultclass: _ResultClassType | None = ..., - warnings: type[Warning] | None = ..., + stream: TextIO | None = None, + descriptions: bool = True, + verbosity: int = 1, + failfast: bool = False, + buffer: bool = False, + resultclass: _ResultClassType | None = None, + warnings: type[Warning] | None = None, *, - tb_locals: bool = ..., + tb_locals: bool = False, ) -> None: ... def _makeResult(self) -> unittest.result.TestResult: ... def run(self, test: unittest.suite.TestSuite | unittest.case.TestCase) -> unittest.result.TestResult: ... diff --git a/stdlib/unittest/suite.pyi b/stdlib/unittest/suite.pyi index 26bef658f1cd..f6b8ef003518 100644 --- a/stdlib/unittest/suite.pyi +++ b/stdlib/unittest/suite.pyi @@ -19,4 +19,4 @@ class BaseTestSuite(Iterable[_TestType]): def __eq__(self, other: object) -> bool: ... class TestSuite(BaseTestSuite): - def run(self, result: unittest.result.TestResult, debug: bool = ...) -> unittest.result.TestResult: ... + def run(self, result: unittest.result.TestResult, debug: bool = False) -> unittest.result.TestResult: ... diff --git a/stdlib/urllib/error.pyi b/stdlib/urllib/error.pyi index 7a4de10d7cf6..8ea25680f1a4 100644 --- a/stdlib/urllib/error.pyi +++ b/stdlib/urllib/error.pyi @@ -6,7 +6,7 @@ __all__ = ["URLError", "HTTPError", "ContentTooShortError"] class URLError(IOError): reason: str | BaseException - def __init__(self, reason: str | BaseException, filename: str | None = ...) -> None: ... + def __init__(self, reason: str | BaseException, filename: str | None = None) -> None: ... class HTTPError(URLError, addinfourl): @property diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 53daee4042dc..6a963d17fd98 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -43,10 +43,10 @@ class _ResultMixinBase(Generic[AnyStr]): def geturl(self) -> AnyStr: ... class _ResultMixinStr(_ResultMixinBase[str]): - def encode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinBytes: ... + def encode(self, encoding: str = 'ascii', errors: str = 'strict') -> _ResultMixinBytes: ... class _ResultMixinBytes(_ResultMixinBase[bytes]): - def decode(self, encoding: str = ..., errors: str = ...) -> _ResultMixinStr: ... + def decode(self, encoding: str = 'ascii', errors: str = 'strict') -> _ResultMixinStr: ... class _NetlocResultMixinBase(Generic[AnyStr]): @property @@ -117,38 +117,38 @@ def parse_qs( qs: AnyStr | None, keep_blank_values: bool = False, strict_parsing: bool = False, - encoding: str = "utf-8", - errors: str = "replace", + encoding: str = 'utf-8', + errors: str = 'replace', max_num_fields: int | None = None, - separator: str = "&", + separator: str = '&', ) -> dict[AnyStr, list[AnyStr]]: ... def parse_qsl( qs: AnyStr | None, keep_blank_values: bool = False, strict_parsing: bool = False, - encoding: str = "utf-8", - errors: str = "replace", + encoding: str = 'utf-8', + errors: str = 'replace', max_num_fields: int | None = None, - separator: str = "&", + separator: str = '&', ) -> list[tuple[AnyStr, AnyStr]]: ... @overload def quote(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... -def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = "/") -> str: ... +def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = '/') -> str: ... @overload def quote_plus(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote_plus(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... if sys.version_info >= (3, 9): - def unquote(string: str | bytes, encoding: str = "utf-8", errors: str = "replace") -> str: ... + def unquote(string: str | bytes, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... else: - def unquote(string: str, encoding: str = "utf-8", errors: str = "replace") -> str: ... + def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ... def unquote_to_bytes(string: str | bytes | bytearray) -> bytes: ... -def unquote_plus(string: str, encoding: str = "utf-8", errors: str = "replace") -> str: ... +def unquote_plus(string: str, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... @overload def urldefrag(url: str) -> DefragResult: ... @overload @@ -159,7 +159,7 @@ _Q = TypeVar("_Q", bound=str | Iterable[int]) def urlencode( query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]], doseq: bool = False, - safe: _Q = ..., + safe: _Q = '', encoding: str | None = None, errors: str | None = None, quote_via: Callable[[AnyStr, _Q, str, str], str] = ..., diff --git a/stdlib/urllib/request.pyi b/stdlib/urllib/request.pyi index 0004ad7798e8..2c4a4858b4bd 100644 --- a/stdlib/urllib/request.pyi +++ b/stdlib/urllib/request.pyi @@ -101,11 +101,11 @@ class Request: def __init__( self, url: str, - data: _DataType = ..., + data: _DataType = None, headers: MutableMapping[str, str] = ..., - origin_req_host: str | None = ..., - unverifiable: bool = ..., - method: str | None = ..., + origin_req_host: str | None = None, + unverifiable: bool = False, + method: str | None = None, ) -> None: ... def get_method(self) -> str: ... def add_header(self, key: str, val: str) -> None: ... @@ -124,7 +124,7 @@ class Request: class OpenerDirector: addheaders: list[tuple[str, str]] def add_handler(self, handler: BaseHandler) -> None: ... - def open(self, fullurl: str | Request, data: _DataType = ..., timeout: float | None = ...) -> _UrlopenRet: ... + def open(self, fullurl: str | Request, data: _DataType = None, timeout: float | None = ...) -> _UrlopenRet: ... def error(self, proto: str, *args: Any) -> _UrlopenRet: ... def close(self) -> None: ... @@ -158,14 +158,14 @@ class HTTPRedirectHandler(BaseHandler): class HTTPCookieProcessor(BaseHandler): cookiejar: CookieJar - def __init__(self, cookiejar: CookieJar | None = ...) -> None: ... + def __init__(self, cookiejar: CookieJar | None = None) -> None: ... def http_request(self, request: Request) -> Request: ... # undocumented def http_response(self, request: Request, response: HTTPResponse) -> HTTPResponse: ... # undocumented def https_request(self, request: Request) -> Request: ... # undocumented def https_response(self, request: Request, response: HTTPResponse) -> HTTPResponse: ... # undocumented class ProxyHandler(BaseHandler): - def __init__(self, proxies: dict[str, str] | None = ...) -> None: ... + def __init__(self, proxies: dict[str, str] | None = None) -> None: ... def proxy_open(self, req: Request, proxy: str, type: str) -> _UrlopenRet | None: ... # undocumented # TODO add a method for every (common) proxy protocol @@ -173,7 +173,7 @@ class HTTPPasswordMgr: def add_password(self, realm: str, uri: str | Sequence[str], user: str, passwd: str) -> None: ... def find_user_password(self, realm: str, authuri: str) -> tuple[str | None, str | None]: ... def is_suburi(self, base: str, test: str) -> bool: ... # undocumented - def reduce_uri(self, uri: str, default_port: bool = ...) -> str: ... # undocumented + def reduce_uri(self, uri: str, default_port: bool = True) -> str: ... # undocumented class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): def add_password(self, realm: str | None, uri: str | Sequence[str], user: str, passwd: str) -> None: ... @@ -181,16 +181,16 @@ class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm): def add_password( - self, realm: str | None, uri: str | Sequence[str], user: str, passwd: str, is_authenticated: bool = ... + self, realm: str | None, uri: str | Sequence[str], user: str, passwd: str, is_authenticated: bool = False ) -> None: ... - def update_authenticated(self, uri: str | Sequence[str], is_authenticated: bool = ...) -> None: ... + def update_authenticated(self, uri: str | Sequence[str], is_authenticated: bool = False) -> None: ... def is_authenticated(self, authuri: str) -> bool: ... class AbstractBasicAuthHandler: rx: ClassVar[Pattern[str]] # undocumented passwd: HTTPPasswordMgr add_password: Callable[[str, str | Sequence[str], str, str], None] - def __init__(self, password_mgr: HTTPPasswordMgr | None = ...) -> None: ... + def __init__(self, password_mgr: HTTPPasswordMgr | None = None) -> None: ... def http_error_auth_reqed(self, authreq: str, host: str, req: Request, headers: HTTPMessage) -> None: ... def http_request(self, req: Request) -> Request: ... # undocumented def http_response(self, req: Request, response: HTTPResponse) -> HTTPResponse: ... # undocumented @@ -207,7 +207,7 @@ class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): def http_error_407(self, req: Request, fp: IO[bytes], code: int, msg: str, headers: HTTPMessage) -> _UrlopenRet | None: ... class AbstractDigestAuthHandler: - def __init__(self, passwd: HTTPPasswordMgr | None = ...) -> None: ... + def __init__(self, passwd: HTTPPasswordMgr | None = None) -> None: ... def reset_retry_count(self) -> None: ... def http_error_auth_reqed(self, auth_header: str, host: str, req: Request, headers: HTTPMessage) -> None: ... def retry_http_digest_auth(self, req: Request, auth: str) -> _UrlopenRet | None: ... @@ -235,7 +235,7 @@ class _HTTPConnectionProtocol(Protocol): ) -> HTTPConnection: ... class AbstractHTTPHandler(BaseHandler): # undocumented - def __init__(self, debuglevel: int = ...) -> None: ... + def __init__(self, debuglevel: int = 0) -> None: ... def set_http_debuglevel(self, level: int) -> None: ... def do_request_(self, request: Request) -> Request: ... def do_open(self, http_class: _HTTPConnectionProtocol, req: Request, **http_conn_args: Any) -> HTTPResponse: ... @@ -246,7 +246,7 @@ class HTTPHandler(AbstractHTTPHandler): class HTTPSHandler(AbstractHTTPHandler): def __init__( - self, debuglevel: int = ..., context: ssl.SSLContext | None = ..., check_hostname: bool | None = ... + self, debuglevel: int = 0, context: ssl.SSLContext | None = None, check_hostname: bool | None = None ) -> None: ... def https_open(self, req: Request) -> HTTPResponse: ... def https_request(self, request: Request) -> Request: ... # undocumented @@ -262,7 +262,7 @@ class DataHandler(BaseHandler): class ftpwrapper: # undocumented def __init__( - self, user: str, passwd: str, host: str, port: int, dirs: str, timeout: float | None = ..., persistent: bool = ... + self, user: str, passwd: str, host: str, port: int, dirs: str, timeout: float | None = None, persistent: bool = True ) -> None: ... def close(self) -> None: ... def endtransfer(self) -> None: ... @@ -300,47 +300,47 @@ def urlcleanup() -> None: ... class URLopener: version: ClassVar[str] - def __init__(self, proxies: dict[str, str] | None = ..., **x509: str) -> None: ... - def open(self, fullurl: str, data: ReadableBuffer | None = ...) -> _UrlopenRet: ... - def open_unknown(self, fullurl: str, data: ReadableBuffer | None = ...) -> _UrlopenRet: ... + def __init__(self, proxies: dict[str, str] | None = None, **x509: str) -> None: ... + def open(self, fullurl: str, data: ReadableBuffer | None = None) -> _UrlopenRet: ... + def open_unknown(self, fullurl: str, data: ReadableBuffer | None = None) -> _UrlopenRet: ... def retrieve( self, url: str, - filename: str | None = ..., - reporthook: Callable[[int, int, int], object] | None = ..., - data: ReadableBuffer | None = ..., + filename: str | None = None, + reporthook: Callable[[int, int, int], object] | None = None, + data: ReadableBuffer | None = None, ) -> tuple[str, Message | None]: ... def addheader(self, *args: tuple[str, str]) -> None: ... # undocumented def cleanup(self) -> None: ... # undocumented def close(self) -> None: ... # undocumented def http_error( - self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: bytes | None = ... + self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: bytes | None = None ) -> _UrlopenRet: ... # undocumented def http_error_default( self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage ) -> _UrlopenRet: ... # undocumented - def open_data(self, url: str, data: ReadableBuffer | None = ...) -> addinfourl: ... # undocumented + def open_data(self, url: str, data: ReadableBuffer | None = None) -> addinfourl: ... # undocumented def open_file(self, url: str) -> addinfourl: ... # undocumented def open_ftp(self, url: str) -> addinfourl: ... # undocumented - def open_http(self, url: str, data: ReadableBuffer | None = ...) -> _UrlopenRet: ... # undocumented - def open_https(self, url: str, data: ReadableBuffer | None = ...) -> _UrlopenRet: ... # undocumented + def open_http(self, url: str, data: ReadableBuffer | None = None) -> _UrlopenRet: ... # undocumented + def open_https(self, url: str, data: ReadableBuffer | None = None) -> _UrlopenRet: ... # undocumented def open_local_file(self, url: str) -> addinfourl: ... # undocumented - def open_unknown_proxy(self, proxy: str, fullurl: str, data: ReadableBuffer | None = ...) -> None: ... # undocumented + def open_unknown_proxy(self, proxy: str, fullurl: str, data: ReadableBuffer | None = None) -> None: ... # undocumented class FancyURLopener(URLopener): def prompt_user_passwd(self, host: str, realm: str) -> tuple[str, str]: ... - def get_user_passwd(self, host: str, realm: str, clear_cache: int = ...) -> tuple[str, str]: ... # undocumented + def get_user_passwd(self, host: str, realm: str, clear_cache: int = 0) -> tuple[str, str]: ... # undocumented def http_error_301( - self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = ... + self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = None ) -> _UrlopenRet | addinfourl | None: ... # undocumented def http_error_302( - self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = ... + self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = None ) -> _UrlopenRet | addinfourl | None: ... # undocumented def http_error_303( - self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = ... + self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = None ) -> _UrlopenRet | addinfourl | None: ... # undocumented def http_error_307( - self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = ... + self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = None ) -> _UrlopenRet | addinfourl | None: ... # undocumented if sys.version_info >= (3, 11): def http_error_308( @@ -354,8 +354,8 @@ class FancyURLopener(URLopener): errcode: int, errmsg: str, headers: HTTPMessage, - data: ReadableBuffer | None = ..., - retry: bool = ..., + data: ReadableBuffer | None = None, + retry: bool = False, ) -> _UrlopenRet | None: ... # undocumented def http_error_407( self, @@ -364,8 +364,8 @@ class FancyURLopener(URLopener): errcode: int, errmsg: str, headers: HTTPMessage, - data: ReadableBuffer | None = ..., - retry: bool = ..., + data: ReadableBuffer | None = None, + retry: bool = False, ) -> _UrlopenRet | None: ... # undocumented def http_error_default( self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage @@ -374,14 +374,14 @@ class FancyURLopener(URLopener): self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None ) -> _UrlopenRet | None: ... # undocumented def retry_http_basic_auth( - self, url: str, realm: str, data: ReadableBuffer | None = ... + self, url: str, realm: str, data: ReadableBuffer | None = None ) -> _UrlopenRet | None: ... # undocumented def retry_https_basic_auth( - self, url: str, realm: str, data: ReadableBuffer | None = ... + self, url: str, realm: str, data: ReadableBuffer | None = None ) -> _UrlopenRet | None: ... # undocumented def retry_proxy_http_basic_auth( - self, url: str, realm: str, data: ReadableBuffer | None = ... + self, url: str, realm: str, data: ReadableBuffer | None = None ) -> _UrlopenRet | None: ... # undocumented def retry_proxy_https_basic_auth( - self, url: str, realm: str, data: ReadableBuffer | None = ... + self, url: str, realm: str, data: ReadableBuffer | None = None ) -> _UrlopenRet | None: ... # undocumented diff --git a/stdlib/urllib/response.pyi b/stdlib/urllib/response.pyi index ca9781dbfbb4..4db1b5649c7a 100644 --- a/stdlib/urllib/response.pyi +++ b/stdlib/urllib/response.pyi @@ -53,6 +53,6 @@ class addinfourl(addinfo): @property def status(self) -> int | None: ... - def __init__(self, fp: IO[bytes], headers: Message, url: str, code: int | None = ...) -> None: ... + def __init__(self, fp: IO[bytes], headers: Message, url: str, code: int | None = None) -> None: ... def geturl(self) -> str: ... def getcode(self) -> int | None: ... diff --git a/stdlib/urllib/robotparser.pyi b/stdlib/urllib/robotparser.pyi index 795cf83fcecd..2a59561998ba 100644 --- a/stdlib/urllib/robotparser.pyi +++ b/stdlib/urllib/robotparser.pyi @@ -9,7 +9,7 @@ class RequestRate(NamedTuple): seconds: int class RobotFileParser: - def __init__(self, url: str = ...) -> None: ... + def __init__(self, url: str = '') -> None: ... def set_url(self, url: str) -> None: ... def read(self) -> None: ... def parse(self, lines: Iterable[str]) -> None: ... diff --git a/stdlib/uu.pyi b/stdlib/uu.pyi index 20e79bf3fec9..363439a80e0a 100644 --- a/stdlib/uu.pyi +++ b/stdlib/uu.pyi @@ -7,7 +7,5 @@ _File: TypeAlias = str | BinaryIO class Error(Exception): ... -def encode( - in_file: _File, out_file: _File, name: str | None = None, mode: int | None = None, *, backtick: bool = False -) -> None: ... +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: ... diff --git a/stdlib/uuid.pyi b/stdlib/uuid.pyi index 29a44b5c7511..1fed902c9f6b 100644 --- a/stdlib/uuid.pyi +++ b/stdlib/uuid.pyi @@ -16,12 +16,12 @@ class SafeUUID(Enum): class UUID: def __init__( self, - hex: str | None = ..., - bytes: _Bytes | None = ..., - bytes_le: _Bytes | None = ..., - fields: _FieldsType | None = ..., - int: _Int | None = ..., - version: _Int | None = ..., + hex: str | None = None, + bytes: _Bytes | None = None, + bytes_le: _Bytes | None = None, + fields: _FieldsType | None = None, + int: _Int | None = None, + version: _Int | None = None, *, is_safe: SafeUUID = ..., ) -> None: ... diff --git a/stdlib/venv/__init__.pyi b/stdlib/venv/__init__.pyi index 362fa7857385..74a8f67e5553 100644 --- a/stdlib/venv/__init__.pyi +++ b/stdlib/venv/__init__.pyi @@ -44,7 +44,7 @@ class EnvBuilder: def ensure_directories(self, env_dir: StrOrBytesPath) -> SimpleNamespace: ... def create_configuration(self, context: SimpleNamespace) -> None: ... def symlink_or_copy( - self, src: StrOrBytesPath, dst: StrOrBytesPath, relative_symlinks_ok: bool = ... + self, src: StrOrBytesPath, dst: StrOrBytesPath, relative_symlinks_ok: bool = False ) -> None: ... # undocumented def setup_python(self, context: SimpleNamespace) -> None: ... def _setup_pip(self, context: SimpleNamespace) -> None: ... # undocumented @@ -69,11 +69,11 @@ if sys.version_info >= (3, 9): else: def create( env_dir: StrOrBytesPath, - system_site_packages: bool = False, - clear: bool = False, - symlinks: bool = False, - with_pip: bool = False, - prompt: str | None = None, + system_site_packages: bool = ..., + clear: bool = ..., + symlinks: bool = ..., + with_pip: bool = ..., + prompt: str | None = ..., ) -> None: ... def main(args: Sequence[str] | None = None) -> None: ... diff --git a/stdlib/warnings.pyi b/stdlib/warnings.pyi index 8c14bb914640..2fa978004ca8 100644 --- a/stdlib/warnings.pyi +++ b/stdlib/warnings.pyi @@ -22,18 +22,16 @@ _ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "module filters: Sequence[tuple[str, str | None, type[Warning], str | None, int]] # undocumented, do not mutate def showwarning( - message: Warning | str, - category: type[Warning], - filename: str, - lineno: int, - file: TextIO | None = None, - line: str | None = None, + message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = None, line: str | None = None ) -> None: ... -def formatwarning( - message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = None -) -> str: ... +def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = None) -> str: ... def filterwarnings( - action: _ActionKind, message: str = "", category: type[Warning] = ..., module: str = "", lineno: int = 0, append: bool = False + action: _ActionKind, + message: str = '', + category: type[Warning] = ..., + module: str = '', + lineno: int = 0, + append: bool = False, ) -> None: ... def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = 0, append: bool = False) -> None: ... def resetwarnings() -> None: ... @@ -54,9 +52,9 @@ class WarningMessage: category: type[Warning], filename: str, lineno: int, - file: TextIO | None = ..., - line: str | None = ..., - source: Any | None = ..., + file: TextIO | None = None, + line: str | None = None, + source: Any | None = None, ) -> None: ... class catch_warnings(Generic[_W]): diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index 9a619235e689..a1a079d1a159 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -41,7 +41,7 @@ _P = ParamSpec("_P") ProxyTypes: tuple[type[Any], ...] class WeakMethod(ref[_CallableT], Generic[_CallableT]): - def __new__(cls: type[Self], meth: _CallableT, callback: Callable[[_CallableT], object] | None = ...) -> Self: ... + def __new__(cls: type[Self], meth: _CallableT, callback: Callable[[_CallableT], object] | None = None) -> Self: ... def __call__(self) -> _CallableT | None: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... @@ -70,7 +70,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ... - def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... + def setdefault(self, key: _KT, default: _VT = None) -> _VT: ... @overload def pop(self, key: _KT) -> _VT: ... @overload @@ -92,7 +92,7 @@ class KeyedRef(ref[_T], Generic[_KT, _T]): class WeakKeyDictionary(MutableMapping[_KT, _VT]): @overload - def __init__(self, dict: None = ...) -> None: ... + def __init__(self, dict: None = None) -> None: ... @overload def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ... def __len__(self) -> int: ... @@ -109,7 +109,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def values(self) -> Iterator[_VT]: ... # type: ignore[override] def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def keyrefs(self) -> list[ref[_KT]]: ... - def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... + def setdefault(self, key: _KT, default: _VT = None) -> _VT: ... @overload def pop(self, key: _KT) -> _VT: ... @overload @@ -125,7 +125,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): class finalize: # TODO: This is a good candidate for to be a `Generic[_P, _T]` class def __init__(self, __obj: object, __func: Callable[_P, Any], *args: _P.args, **kwargs: _P.kwargs) -> None: ... - def __call__(self, _: Any = ...) -> Any | None: ... + def __call__(self, _: Any = None) -> Any | None: ... def detach(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... def peek(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... @property diff --git a/stdlib/webbrowser.pyi b/stdlib/webbrowser.pyi index 0a55b1fae3fe..6511999d437b 100644 --- a/stdlib/webbrowser.pyi +++ b/stdlib/webbrowser.pyi @@ -19,20 +19,20 @@ class BaseBrowser: args: list[str] name: str basename: str - def __init__(self, name: str = ...) -> None: ... + def __init__(self, name: str = '') -> None: ... @abstractmethod - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... + def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... def open_new(self, url: str) -> bool: ... def open_new_tab(self, url: str) -> bool: ... class GenericBrowser(BaseBrowser): def __init__(self, name: str | Sequence[str]) -> None: ... - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... + def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... class BackgroundBrowser(GenericBrowser): ... class UnixBrowser(BaseBrowser): - def open(self, url: str, new: Literal[0, 1, 2] = ..., autoraise: bool = ...) -> bool: ... # type: ignore[override] + def open(self, url: str, new: Literal[0, 1, 2] = 0, autoraise: bool = True) -> bool: ... # type: ignore[override] raise_opts: list[str] | None background: bool redirect_stdout: bool @@ -51,10 +51,10 @@ class Opera(UnixBrowser): ... class Elinks(UnixBrowser): ... class Konqueror(BaseBrowser): - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... + def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... class Grail(BaseBrowser): - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... + def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... if sys.platform == "win32": class WindowsDefault(BaseBrowser): @@ -62,7 +62,7 @@ if sys.platform == "win32": if sys.platform == "darwin": class MacOSX(BaseBrowser): - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... + def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... class MacOSXOSAScript(BaseBrowser): # In runtime this class does not have `name` and `basename` - def open(self, url: str, new: int = ..., autoraise: bool = ...) -> bool: ... + def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... diff --git a/stdlib/wsgiref/handlers.pyi b/stdlib/wsgiref/handlers.pyi index 655fba668598..ebead540018e 100644 --- a/stdlib/wsgiref/handlers.pyi +++ b/stdlib/wsgiref/handlers.pyi @@ -38,7 +38,7 @@ class BaseHandler: def set_content_length(self) -> None: ... def cleanup_headers(self) -> None: ... def start_response( - self, status: str, headers: list[tuple[str, str]], exc_info: OptExcInfo | None = ... + self, status: str, headers: list[tuple[str, str]], exc_info: OptExcInfo | None = None ) -> Callable[[bytes], None]: ... def send_preamble(self) -> None: ... def write(self, data: bytes) -> None: ... @@ -73,8 +73,8 @@ class SimpleHandler(BaseHandler): stdout: IO[bytes], stderr: ErrorStream, environ: MutableMapping[str, str], - multithread: bool = ..., - multiprocess: bool = ..., + multithread: bool = True, + multiprocess: bool = False, ) -> None: ... def get_stdin(self) -> InputStream: ... def get_stderr(self) -> ErrorStream: ... diff --git a/stdlib/wsgiref/headers.pyi b/stdlib/wsgiref/headers.pyi index dd963d9b4727..2654d79bf4e5 100644 --- a/stdlib/wsgiref/headers.pyi +++ b/stdlib/wsgiref/headers.pyi @@ -7,7 +7,7 @@ _HeaderList: TypeAlias = list[tuple[str, str]] tspecials: Pattern[str] # undocumented class Headers: - def __init__(self, headers: _HeaderList | None = ...) -> None: ... + def __init__(self, headers: _HeaderList | None = None) -> None: ... def __len__(self) -> int: ... def __setitem__(self, name: str, val: str) -> None: ... def __delitem__(self, name: str) -> None: ... @@ -17,7 +17,7 @@ class Headers: @overload def get(self, name: str, default: str) -> str: ... @overload - def get(self, name: str, default: str | None = ...) -> str | None: ... + def get(self, name: str, default: str | None = None) -> str | None: ... def keys(self) -> list[str]: ... def values(self) -> list[str]: ... def items(self) -> _HeaderList: ... diff --git a/stdlib/wsgiref/util.pyi b/stdlib/wsgiref/util.pyi index 002eb32cecf4..962fac2c5a22 100644 --- a/stdlib/wsgiref/util.pyi +++ b/stdlib/wsgiref/util.pyi @@ -9,7 +9,7 @@ class FileWrapper: filelike: IO[bytes] blksize: int close: Callable[[], None] # only exists if filelike.close exists - def __init__(self, filelike: IO[bytes], blksize: int = ...) -> None: ... + def __init__(self, filelike: IO[bytes], blksize: int = 8192) -> None: ... if sys.version_info < (3, 11): def __getitem__(self, key: Any) -> bytes: ... diff --git a/stdlib/xml/dom/domreg.pyi b/stdlib/xml/dom/domreg.pyi index a46d3ff090e6..75b7796c4718 100644 --- a/stdlib/xml/dom/domreg.pyi +++ b/stdlib/xml/dom/domreg.pyi @@ -5,6 +5,4 @@ well_known_implementations: dict[str, str] registered: dict[str, Callable[[], DOMImplementation]] def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... -def getDOMImplementation( - name: str | None = None, features: str | Iterable[tuple[str, str | None]] = ... -) -> DOMImplementation: ... +def getDOMImplementation(name: str | None = None, features: str | Iterable[tuple[str, str | None]] = ...) -> DOMImplementation: ... diff --git a/stdlib/xml/dom/expatbuilder.pyi b/stdlib/xml/dom/expatbuilder.pyi index bd2331586aa5..45f0af7aa979 100644 --- a/stdlib/xml/dom/expatbuilder.pyi +++ b/stdlib/xml/dom/expatbuilder.pyi @@ -14,7 +14,7 @@ theDOMImplementation: DOMImplementation | None class ElementInfo: tagName: Incomplete - def __init__(self, tagName, model: Incomplete | None = ...) -> None: ... + def __init__(self, tagName, model: Incomplete | None = None) -> None: ... def getAttributeType(self, aname) -> TypeInfo: ... def getAttributeTypeNS(self, namespaceURI, localName) -> TypeInfo: ... def isElementContent(self) -> bool: ... @@ -25,7 +25,7 @@ class ElementInfo: class ExpatBuilder: document: Document # Created in self.reset() curNode: Incomplete # Created in self.reset() - def __init__(self, options: Options | None = ...) -> None: ... + def __init__(self, options: Options | None = None) -> None: ... def createParser(self): ... def getParser(self): ... def reset(self) -> None: ... @@ -71,7 +71,7 @@ class FragmentBuilder(ExpatBuilder): fragment: Incomplete | None originalDocument: Incomplete context: Incomplete - def __init__(self, context, options: Options | None = ...) -> None: ... + def __init__(self, context, options: Options | None = None) -> None: ... class Namespaces: def createParser(self): ... diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index 83248482c657..c045ae9bb20d 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -69,7 +69,7 @@ class Attr(Node): value: str prefix: Incomplete def __init__( - self, qName: str, namespaceURI: str | None = ..., localName: str | None = ..., prefix: Incomplete | None = ... + self, qName: str, namespaceURI: str | None = None, localName: str | None = None, prefix: Incomplete | None = None ) -> None: ... def unlink(self) -> None: ... @property @@ -86,7 +86,7 @@ class NamedNodeMap: def keys(self): ... def keysNS(self): ... def values(self): ... - def get(self, name: str, value: Incomplete | None = ...): ... + def get(self, name: str, value: Incomplete | None = None): ... def __len__(self) -> int: ... def __eq__(self, other: object) -> bool: ... def __ge__(self, other: NamedNodeMap) -> bool: ... @@ -124,7 +124,7 @@ class Element(Node): childNodes: Incomplete nextSibling: Incomplete def __init__( - self, tagName, namespaceURI: str | None = ..., prefix: Incomplete | None = ..., localName: Incomplete | None = ... + self, tagName, namespaceURI: str | None = None, prefix: Incomplete | None = None, localName: Incomplete | None = None ) -> None: ... def unlink(self) -> None: ... def getAttribute(self, attname: str) -> str: ... @@ -143,7 +143,7 @@ class Element(Node): def hasAttributeNS(self, namespaceURI: str, localName) -> bool: ... def getElementsByTagName(self, name: str): ... def getElementsByTagNameNS(self, namespaceURI: str, localName): ... - def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... def hasAttributes(self) -> bool: ... def setIdAttribute(self, name) -> None: ... def setIdAttributeNS(self, namespaceURI: str, localName) -> None: ... @@ -170,7 +170,7 @@ class ProcessingInstruction(Childless, Node): def __init__(self, target, data) -> None: ... nodeValue: Incomplete nodeName: Incomplete - def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... class CharacterData(Childless, Node): ownerDocument: Incomplete @@ -193,7 +193,7 @@ class Text(CharacterData): attributes: Incomplete data: Incomplete def splitText(self, offset): ... - def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... def replaceWholeText(self, content): ... @property def isWhitespaceInElementContent(self) -> bool: ... @@ -204,12 +204,12 @@ class Comment(CharacterData): nodeType: int nodeName: str def __init__(self, data) -> None: ... - def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... class CDATASection(Text): nodeType: int nodeName: str - def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... class ReadOnlySequentialNamedNodeMap: def __init__(self, seq=...) -> None: ... @@ -239,7 +239,7 @@ class DocumentType(Identified, Childless, Node): nodeName: Incomplete def __init__(self, qualifiedName: str) -> None: ... def cloneNode(self, deep): ... - def writexml(self, writer: SupportsWrite[str], indent: str = ..., addindent: str = ..., newl: str = ...) -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... class Entity(Identified, Node): attributes: Incomplete diff --git a/stdlib/xml/dom/pulldom.pyi b/stdlib/xml/dom/pulldom.pyi index 2ee0d16fef89..920905160e43 100644 --- a/stdlib/xml/dom/pulldom.pyi +++ b/stdlib/xml/dom/pulldom.pyi @@ -39,7 +39,7 @@ class PullDOM(ContentHandler): lastEvent: Incomplete elementStack: Sequence[Incomplete] pending_events: Sequence[Incomplete] - def __init__(self, documentFactory: _DocumentFactory = ...) -> None: ... + def __init__(self, documentFactory: _DocumentFactory = None) -> None: ... def pop(self) -> Element: ... def setDocumentLocator(self, locator) -> None: ... def startPrefixMapping(self, prefix, uri) -> None: ... diff --git a/stdlib/xml/etree/ElementInclude.pyi b/stdlib/xml/etree/ElementInclude.pyi index 96059efbcf65..e04cef122ad2 100644 --- a/stdlib/xml/etree/ElementInclude.pyi +++ b/stdlib/xml/etree/ElementInclude.pyi @@ -12,7 +12,7 @@ if sys.version_info >= (3, 9): class FatalIncludeError(SyntaxError): ... -def default_loader(href: FileDescriptorOrPath, parse: str, encoding: str | None = ...) -> str | Element: ... +def default_loader(href: FileDescriptorOrPath, parse: str, encoding: str | None = None) -> str | Element: ... # TODO: loader is of type default_loader ie it takes a callable that has the # same signature as default_loader. But default_loader has a keyword argument @@ -25,4 +25,4 @@ if sys.version_info >= (3, 9): class LimitedRecursiveIncludeError(FatalIncludeError): ... else: - def include(elem: Element, loader: Callable[..., str | Element] | None = None) -> None: ... + def include(elem: Element, loader: Callable[..., str | Element] | None = ...) -> None: ... diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index db827db1a02f..d991ce54fe12 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -90,20 +90,20 @@ class Element: def append(self, __subelement: Element) -> None: ... def clear(self) -> None: ... def extend(self, __elements: Iterable[Element]) -> None: ... - def find(self, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... - def findall(self, path: str, namespaces: dict[str, str] | None = ...) -> list[Element]: ... + def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... + def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... @overload - def findtext(self, path: str, default: None = ..., namespaces: dict[str, str] | None = ...) -> str | None: ... + def findtext(self, path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ... @overload - def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = ...) -> _T | str: ... + def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = None) -> _T | str: ... @overload - def get(self, key: str, default: None = ...) -> str | None: ... + def get(self, key: str, default: None = None) -> str | None: ... @overload def get(self, key: str, default: _T) -> str | _T: ... def insert(self, __index: int, __subelement: Element) -> None: ... def items(self) -> ItemsView[str, str]: ... - def iter(self, tag: str | None = ...) -> Generator[Element, None, None]: ... - def iterfind(self, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... + def iter(self, tag: str | None = None) -> Generator[Element, None, None]: ... + def iterfind(self, path: str, namespaces: dict[str, str] | None = None) -> Generator[Element, None, None]: ... def itertext(self) -> Generator[str, None, None]: ... def keys(self) -> dict_keys[str, str]: ... # makeelement returns the type of self in Python impl, but not in C impl @@ -136,7 +136,7 @@ PI: Callable[..., Element] class QName: text: str - def __init__(self, text_or_uri: str, tag: str | None = ...) -> None: ... + def __init__(self, text_or_uri: str, tag: str | None = None) -> None: ... def __lt__(self, other: QName | str) -> bool: ... def __le__(self, other: QName | str) -> bool: ... def __gt__(self, other: QName | str) -> bool: ... @@ -144,29 +144,29 @@ class QName: def __eq__(self, other: object) -> bool: ... class ElementTree: - def __init__(self, element: Element | None = ..., file: _FileRead | None = ...) -> None: ... + def __init__(self, element: Element | None = None, file: _FileRead | None = None) -> None: ... def getroot(self) -> Element | Any: ... - def parse(self, source: _FileRead, parser: XMLParser | None = ...) -> Element: ... - def iter(self, tag: str | None = ...) -> Generator[Element, None, None]: ... + def parse(self, source: _FileRead, parser: XMLParser | None = None) -> Element: ... + def iter(self, tag: str | None = None) -> Generator[Element, None, None]: ... if sys.version_info < (3, 9): def getiterator(self, tag: str | None = ...) -> list[Element]: ... - def find(self, path: str, namespaces: dict[str, str] | None = ...) -> Element | None: ... + def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... @overload - def findtext(self, path: str, default: None = ..., namespaces: dict[str, str] | None = ...) -> str | None: ... + def findtext(self, path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ... @overload - def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = ...) -> _T | str: ... - def findall(self, path: str, namespaces: dict[str, str] | None = ...) -> list[Element]: ... - def iterfind(self, path: str, namespaces: dict[str, str] | None = ...) -> Generator[Element, None, None]: ... + def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = None) -> _T | str: ... + def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... + def iterfind(self, path: str, namespaces: dict[str, str] | None = None) -> Generator[Element, None, None]: ... def write( self, file_or_filename: _FileWrite, - encoding: str | None = ..., - xml_declaration: bool | None = ..., - default_namespace: str | None = ..., - method: str | None = ..., + encoding: str | None = None, + xml_declaration: bool | None = None, + default_namespace: str | None = None, + method: str | None = None, *, - short_empty_elements: bool = ..., + short_empty_elements: bool = True, ) -> None: ... def write_c14n(self, file: _FileWriteC14N) -> None: ... @@ -261,7 +261,7 @@ else: def dump(elem: Element) -> None: ... if sys.version_info >= (3, 9): - def indent(tree: Element | ElementTree, space: str = " ", level: int = 0) -> None: ... + def indent(tree: Element | ElementTree, space: str = ' ', level: int = 0) -> None: ... def parse(source: _FileRead, parser: XMLParser | None = None) -> ElementTree: ... def iterparse( @@ -269,7 +269,7 @@ def iterparse( ) -> Iterator[tuple[str, Any]]: ... class XMLPullParser: - def __init__(self, events: Sequence[str] | None = ..., *, _parser: XMLParser | None = ...) -> None: ... + def __init__(self, events: Sequence[str] | None = None, *, _parser: XMLParser | None = None) -> None: ... def feed(self, data: str | ReadableBuffer) -> None: ... def close(self) -> None: ... # Second element in the tuple could be `Element`, `tuple[str, str]` or `None`. @@ -329,13 +329,13 @@ if sys.version_info >= (3, 8): self, write: Callable[[str], object], *, - with_comments: bool = ..., - strip_text: bool = ..., - rewrite_prefixes: bool = ..., - qname_aware_tags: Iterable[str] | None = ..., - qname_aware_attrs: Iterable[str] | None = ..., - exclude_attrs: Iterable[str] | None = ..., - exclude_tags: Iterable[str] | None = ..., + with_comments: bool = False, + strip_text: bool = False, + rewrite_prefixes: bool = False, + qname_aware_tags: Iterable[str] | None = None, + qname_aware_attrs: Iterable[str] | None = None, + exclude_attrs: Iterable[str] | None = None, + exclude_tags: Iterable[str] | None = None, ) -> None: ... def data(self, data: str) -> None: ... def start_ns(self, prefix: str, uri: str) -> None: ... diff --git a/stdlib/xml/sax/__init__.pyi b/stdlib/xml/sax/__init__.pyi index b8ab4d439e74..a591258db801 100644 --- a/stdlib/xml/sax/__init__.pyi +++ b/stdlib/xml/sax/__init__.pyi @@ -9,7 +9,7 @@ class _SupportsReadClose(SupportsRead[_T_co], Protocol[_T_co]): def close(self) -> None: ... class SAXException(Exception): - def __init__(self, msg: str, exception: Exception | None = ...) -> None: ... + def __init__(self, msg: str, exception: Exception | None = None) -> None: ... def getMessage(self) -> str: ... def getException(self) -> Exception: ... def __getitem__(self, ix: Any) -> NoReturn: ... diff --git a/stdlib/xml/sax/saxutils.pyi b/stdlib/xml/sax/saxutils.pyi index b65e9960394f..c90d56dc9823 100644 --- a/stdlib/xml/sax/saxutils.pyi +++ b/stdlib/xml/sax/saxutils.pyi @@ -11,9 +11,9 @@ def quoteattr(data: str, entities: Mapping[str, str] = ...) -> str: ... class XMLGenerator(handler.ContentHandler): def __init__( self, - out: TextIOBase | RawIOBase | StreamWriter | StreamReaderWriter | SupportsWrite[str] | None = ..., - encoding: str = ..., - short_empty_elements: bool = ..., + out: TextIOBase | RawIOBase | StreamWriter | StreamReaderWriter | SupportsWrite[str] | None = None, + encoding: str = 'iso-8859-1', + short_empty_elements: bool = False, ) -> None: ... def startDocument(self): ... def endDocument(self): ... @@ -28,7 +28,7 @@ class XMLGenerator(handler.ContentHandler): def processingInstruction(self, target, data): ... class XMLFilterBase(xmlreader.XMLReader): - def __init__(self, parent: xmlreader.XMLReader | None = ...) -> None: ... + def __init__(self, parent: xmlreader.XMLReader | None = None) -> None: ... def error(self, exception): ... def fatalError(self, exception): ... def warning(self, exception): ... @@ -57,4 +57,4 @@ class XMLFilterBase(xmlreader.XMLReader): def getParent(self): ... def setParent(self, parent): ... -def prepare_input_source(source, base=""): ... +def prepare_input_source(source, base=''): ... diff --git a/stdlib/xml/sax/xmlreader.pyi b/stdlib/xml/sax/xmlreader.pyi index 4480f4098635..0bf167b04a37 100644 --- a/stdlib/xml/sax/xmlreader.pyi +++ b/stdlib/xml/sax/xmlreader.pyi @@ -17,7 +17,7 @@ class XMLReader: def setProperty(self, name, value): ... class IncrementalParser(XMLReader): - def __init__(self, bufsize: int = ...) -> None: ... + def __init__(self, bufsize: int = 65536) -> None: ... def parse(self, source): ... def feed(self, data): ... def prepareParser(self, source): ... @@ -31,7 +31,7 @@ class Locator: def getSystemId(self): ... class InputSource: - def __init__(self, system_id: str | None = ...) -> None: ... + def __init__(self, system_id: str | None = None) -> None: ... def setPublicId(self, public_id): ... def getPublicId(self): ... def setSystemId(self, system_id): ... @@ -57,7 +57,7 @@ class AttributesImpl: def __getitem__(self, name): ... def keys(self): ... def __contains__(self, name): ... - def get(self, name, alternative=...): ... + def get(self, name, alternative=None): ... def copy(self): ... def items(self): ... def values(self): ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index fa3b676e9ee1..a6169324fda8 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -79,7 +79,7 @@ def _strftime(value: _XMLDate) -> str: ... # undocumented class DateTime: value: str # undocumented - def __init__(self, value: int | str | datetime | time.struct_time | tuple[int, ...] = ...) -> None: ... + def __init__(self, value: int | str | datetime | time.struct_time | tuple[int, ...] = 0) -> None: ... def __lt__(self, other: _DateTimeComparable) -> bool: ... def __le__(self, other: _DateTimeComparable) -> bool: ... def __gt__(self, other: _DateTimeComparable) -> bool: ... @@ -96,7 +96,7 @@ def _datetime_type(data: str) -> datetime: ... # undocumented class Binary: data: bytes - def __init__(self, data: bytes | bytearray | None = ...) -> None: ... + def __init__(self, data: bytes | bytearray | None = None) -> None: ... def decode(self, data: ReadableBuffer) -> None: ... def encode(self, out: SupportsWrite[str]) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -119,7 +119,7 @@ class Marshaller: data: None encoding: str | None allow_none: bool - def __init__(self, encoding: str | None = ..., allow_none: bool = ...) -> None: ... + def __init__(self, encoding: str | None = None, allow_none: bool = False) -> None: ... def dumps(self, values: Fault | Iterable[_Marshallable]) -> str: ... def __dump(self, value: _Marshallable, write: _WriteCallback) -> None: ... # undocumented def dump_nil(self, value: None, write: _WriteCallback) -> None: ... @@ -150,7 +150,7 @@ class Unmarshaller: append: Callable[[Any], None] _use_datetime: bool _use_builtin_types: bool - def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ...) -> None: ... + def __init__(self, use_datetime: bool = False, use_builtin_types: bool = False) -> None: ... def close(self) -> tuple[_Marshallable, ...]: ... def getmethodname(self) -> str | None: ... def xml(self, encoding: str, standalone: Any) -> None: ... # Standalone is ignored @@ -208,9 +208,7 @@ def dumps( encoding: str | None = None, allow_none: bool = False, ) -> str: ... -def loads( - data: str, use_datetime: bool = False, use_builtin_types: bool = False -) -> tuple[tuple[_Marshallable, ...], str | None]: ... +def loads(data: str, use_datetime: bool = False, use_builtin_types: bool = False) -> tuple[tuple[_Marshallable, ...], str | None]: ... def gzip_encode(data: ReadableBuffer) -> bytes: ... # undocumented def gzip_decode(data: ReadableBuffer, max_decode: int = 20971520) -> bytes: ... # undocumented @@ -247,10 +245,10 @@ class Transport: def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ...) -> None: ... def request( - self, host: _HostType, handler: str, request_body: _BufferWithLen, verbose: bool = ... + self, host: _HostType, handler: str, request_body: _BufferWithLen, verbose: bool = False ) -> tuple[_Marshallable, ...]: ... def single_request( - self, host: _HostType, handler: str, request_body: _BufferWithLen, verbose: bool = ... + self, host: _HostType, handler: str, request_body: _BufferWithLen, verbose: bool = False ) -> tuple[_Marshallable, ...]: ... def getparser(self) -> tuple[ExpatParser, Unmarshaller]: ... def get_host_info(self, host: _HostType) -> tuple[str, list[tuple[str, str]], dict[str, str]]: ... diff --git a/stdlib/xmlrpc/server.pyi b/stdlib/xmlrpc/server.pyi index f92dab58335c..10fa2bd793e9 100644 --- a/stdlib/xmlrpc/server.pyi +++ b/stdlib/xmlrpc/server.pyi @@ -42,16 +42,16 @@ class SimpleXMLRPCDispatcher: # undocumented allow_none: bool encoding: str use_builtin_types: bool - def __init__(self, allow_none: bool = ..., encoding: str | None = ..., use_builtin_types: bool = ...) -> None: ... - def register_instance(self, instance: Any, allow_dotted_names: bool = ...) -> None: ... - def register_function(self, function: _DispatchProtocol | None = ..., name: str | None = ...) -> Callable[..., Any]: ... + def __init__(self, allow_none: bool = False, encoding: str | None = None, use_builtin_types: bool = False) -> None: ... + def register_instance(self, instance: Any, allow_dotted_names: bool = False) -> None: ... + def register_function(self, function: _DispatchProtocol | None = None, name: str | None = None) -> Callable[..., Any]: ... def register_introspection_functions(self) -> None: ... def register_multicall_functions(self) -> None: ... def _marshaled_dispatch( self, data: str, - dispatch_method: Callable[[str | None, tuple[_Marshallable, ...]], Fault | tuple[_Marshallable, ...]] | None = ..., - path: Any | None = ..., + dispatch_method: Callable[[str | None, tuple[_Marshallable, ...]], Fault | tuple[_Marshallable, ...]] | None = None, + path: Any | None = None, ) -> str: ... # undocumented def system_listMethods(self) -> list[str]: ... # undocumented def system_methodSignature(self, method_name: str) -> str: ... # undocumented @@ -76,11 +76,11 @@ class SimpleXMLRPCServer(socketserver.TCPServer, SimpleXMLRPCDispatcher): self, addr: tuple[str, int], requestHandler: type[SimpleXMLRPCRequestHandler] = ..., - logRequests: bool = ..., - allow_none: bool = ..., - encoding: str | None = ..., - bind_and_activate: bool = ..., - use_builtin_types: bool = ..., + logRequests: bool = True, + allow_none: bool = False, + encoding: str | None = None, + bind_and_activate: bool = True, + use_builtin_types: bool = False, ) -> None: ... class MultiPathXMLRPCServer(SimpleXMLRPCServer): # undocumented @@ -90,31 +90,31 @@ class MultiPathXMLRPCServer(SimpleXMLRPCServer): # undocumented self, addr: tuple[str, int], requestHandler: type[SimpleXMLRPCRequestHandler] = ..., - logRequests: bool = ..., - allow_none: bool = ..., - encoding: str | None = ..., - bind_and_activate: bool = ..., - use_builtin_types: bool = ..., + logRequests: bool = True, + allow_none: bool = False, + encoding: str | None = None, + bind_and_activate: bool = True, + use_builtin_types: bool = False, ) -> None: ... def add_dispatcher(self, path: str, dispatcher: SimpleXMLRPCDispatcher) -> SimpleXMLRPCDispatcher: ... def get_dispatcher(self, path: str) -> SimpleXMLRPCDispatcher: ... class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): - def __init__(self, allow_none: bool = ..., encoding: str | None = ..., use_builtin_types: bool = ...) -> None: ... + def __init__(self, allow_none: bool = False, encoding: str | None = None, use_builtin_types: bool = False) -> None: ... def handle_xmlrpc(self, request_text: str) -> None: ... def handle_get(self) -> None: ... - def handle_request(self, request_text: str | None = ...) -> None: ... + def handle_request(self, request_text: str | None = None) -> None: ... class ServerHTMLDoc(pydoc.HTMLDoc): # undocumented def docroutine( # type: ignore[override] self, object: object, name: str, - mod: str | None = ..., + mod: str | None = None, funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., - cl: type | None = ..., + cl: type | None = None, ) -> str: ... def docserver(self, server_name: str, package_documentation: str, methods: dict[str, str]) -> str: ... @@ -136,11 +136,11 @@ class DocXMLRPCServer(SimpleXMLRPCServer, XMLRPCDocGenerator): self, addr: tuple[str, int], requestHandler: type[SimpleXMLRPCRequestHandler] = ..., - logRequests: bool = ..., - allow_none: bool = ..., - encoding: str | None = ..., - bind_and_activate: bool = ..., - use_builtin_types: bool = ..., + logRequests: bool = True, + allow_none: bool = False, + encoding: str | None = None, + bind_and_activate: bool = True, + use_builtin_types: bool = False, ) -> None: ... class DocCGIXMLRPCRequestHandler(CGIXMLRPCRequestHandler, XMLRPCDocGenerator): diff --git a/stdlib/zipfile.pyi b/stdlib/zipfile.pyi index e964cd6eda87..a3dcb52914e3 100644 --- a/stdlib/zipfile.pyi +++ b/stdlib/zipfile.pyi @@ -70,7 +70,7 @@ class ZipExtFile(io.BufferedIOBase): fileobj: _ClosableZipStream, mode: _ReadWriteMode, zipinfo: ZipInfo, - pwd: bytes | None = ..., + pwd: bytes | None = None, *, close_fileobj: Literal[True], ) -> None: ... @@ -80,14 +80,14 @@ class ZipExtFile(io.BufferedIOBase): fileobj: _ZipStream, mode: _ReadWriteMode, zipinfo: ZipInfo, - pwd: bytes | None = ..., - close_fileobj: Literal[False] = ..., + pwd: bytes | None = None, + close_fileobj: Literal[False] = False, ) -> None: ... - def read(self, n: int | None = ...) -> bytes: ... - def readline(self, limit: int = ...) -> bytes: ... # type: ignore[override] - def peek(self, n: int = ...) -> bytes: ... + def read(self, n: int | None = -1) -> bytes: ... + def readline(self, limit: int = -1) -> bytes: ... # type: ignore[override] + def peek(self, n: int = 1) -> bytes: ... def read1(self, n: int | None) -> bytes: ... # type: ignore[override] - def seek(self, offset: int, whence: int = ...) -> int: ... + def seek(self, offset: int, whence: int = 0) -> int: ... class _Writer(Protocol): def write(self, __s: str) -> object: ... @@ -159,34 +159,34 @@ class ZipFile: def infolist(self) -> list[ZipInfo]: ... def namelist(self) -> list[str]: ... def open( - self, name: str | ZipInfo, mode: _ReadWriteMode = ..., pwd: bytes | None = ..., *, force_zip64: bool = ... + self, name: str | ZipInfo, mode: _ReadWriteMode = 'r', pwd: bytes | None = None, *, force_zip64: bool = False ) -> IO[bytes]: ... - def extract(self, member: str | ZipInfo, path: StrPath | None = ..., pwd: bytes | None = ...) -> str: ... + def extract(self, member: str | ZipInfo, path: StrPath | None = None, pwd: bytes | None = None) -> str: ... def extractall( - self, path: StrPath | None = ..., members: Iterable[str | ZipInfo] | None = ..., pwd: bytes | None = ... + self, path: StrPath | None = None, members: Iterable[str | ZipInfo] | None = None, pwd: bytes | None = None ) -> None: ... - def printdir(self, file: _Writer | None = ...) -> None: ... + def printdir(self, file: _Writer | None = None) -> None: ... def setpassword(self, pwd: bytes) -> None: ... - def read(self, name: str | ZipInfo, pwd: bytes | None = ...) -> bytes: ... + def read(self, name: str | ZipInfo, pwd: bytes | None = None) -> bytes: ... def testzip(self) -> str | None: ... def write( - self, filename: StrPath, arcname: StrPath | None = ..., compress_type: int | None = ..., compresslevel: int | None = ... + self, filename: StrPath, arcname: StrPath | None = None, compress_type: int | None = None, compresslevel: int | None = None ) -> None: ... def writestr( self, zinfo_or_arcname: str | ZipInfo, data: _BufferWithLen | str, - compress_type: int | None = ..., - compresslevel: int | None = ..., + compress_type: int | None = None, + compresslevel: int | None = None, ) -> None: ... if sys.version_info >= (3, 11): def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = ...) -> None: ... class PyZipFile(ZipFile): def __init__( - self, file: str | IO[bytes], mode: _ZipFileMode = ..., compression: int = ..., allowZip64: bool = ..., optimize: int = ... + self, file: str | IO[bytes], mode: _ZipFileMode = 'r', compression: int = 0, allowZip64: bool = True, optimize: int = -1 ) -> None: ... - def writepy(self, pathname: str, basename: str = ..., filterfunc: Callable[[str], bool] | None = ...) -> None: ... + def writepy(self, pathname: str, basename: str = '', filterfunc: Callable[[str], bool] | None = None) -> None: ... class ZipInfo: filename: str @@ -207,7 +207,7 @@ class ZipInfo: compress_size: int file_size: int orig_filename: str # undocumented - def __init__(self, filename: str = ..., date_time: _DateTuple = ...) -> None: ... + def __init__(self, filename: str = 'NoName', date_time: _DateTuple = ...) -> None: ... if sys.version_info >= (3, 8): @classmethod def from_file( @@ -218,7 +218,7 @@ class ZipInfo: def from_file(cls: type[Self], filename: StrPath, arcname: StrPath | None = ...) -> Self: ... def is_dir(self) -> bool: ... - def FileHeader(self, zip64: bool | None = ...) -> bytes: ... + def FileHeader(self, zip64: bool | None = None) -> bytes: ... class _PathOpenProtocol(Protocol): def __call__(self, mode: _ReadWriteMode = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ... @@ -240,7 +240,7 @@ if sys.version_info >= (3, 8): @property def stem(self) -> str: ... - def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = ...) -> None: ... + def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = '') -> None: ... if sys.version_info >= (3, 9): def open(self, mode: _ReadWriteBinaryMode = ..., *args: Any, pwd: bytes | None = ..., **kwargs: Any) -> IO[bytes]: ... else: diff --git a/stdlib/zipimport.pyi b/stdlib/zipimport.pyi index dc2f1aee0752..fb0b450f9e56 100644 --- a/stdlib/zipimport.pyi +++ b/stdlib/zipimport.pyi @@ -17,8 +17,8 @@ class zipimporter: else: def __init__(self, path: StrOrBytesPath) -> None: ... - def find_loader(self, fullname: str, path: str | None = ...) -> tuple[zipimporter | None, list[str]]: ... # undocumented - def find_module(self, fullname: str, path: str | None = ...) -> zipimporter | None: ... + def find_loader(self, fullname: str, path: str | None = None) -> tuple[zipimporter | None, list[str]]: ... # undocumented + def find_module(self, fullname: str, path: str | None = None) -> zipimporter | None: ... def get_code(self, fullname: str) -> CodeType: ... def get_data(self, pathname: str) -> bytes: ... def get_filename(self, fullname: str) -> str: ... diff --git a/stdlib/zlib.pyi b/stdlib/zlib.pyi index 11151a92e16c..13d0f33c5728 100644 --- a/stdlib/zlib.pyi +++ b/stdlib/zlib.pyi @@ -43,13 +43,18 @@ class _Decompress: def adler32(__data: ReadableBuffer, __value: int = ...) -> int: ... if sys.version_info >= (3, 11): - def compress(__data: ReadableBuffer, level: int = ..., wbits: int = 15) -> bytes: ... + def compress(__data: ReadableBuffer, level: int = -1, wbits: int = 15) -> bytes: ... else: def compress(__data: ReadableBuffer, level: int = ...) -> bytes: ... def compressobj( - level: int = ..., method: int = 8, wbits: int = 15, memLevel: int = 8, strategy: int = 0, zdict: ReadableBuffer | None = None + level: int = -1, + method: int = 8, + wbits: int = 15, + memLevel: int = 8, + strategy: int = 0, + zdict: ReadableBuffer | None = None, ) -> _Compress: ... def crc32(__data: ReadableBuffer, __value: int = ...) -> int: ... def decompress(__data: ReadableBuffer, wbits: int = 15, bufsize: int = 16384) -> bytes: ... diff --git a/stubs/JACK-Client/METADATA.toml b/stubs/JACK-Client/METADATA.toml index 20062a169165..a5e9329001c5 100644 --- a/stubs/JACK-Client/METADATA.toml +++ b/stubs/JACK-Client/METADATA.toml @@ -1,4 +1,6 @@ version = "0.5.*" +# Requires a version of numpy with a `py.typed` file +requires = ["types-cffi", "numpy>=1.20"] [tool.stubtest] ignore_missing_stub = false diff --git a/stubs/JACK-Client/jack/__init__.pyi b/stubs/JACK-Client/jack/__init__.pyi index 19f30bde54ce..8a904b7c75c7 100644 --- a/stubs/JACK-Client/jack/__init__.pyi +++ b/stubs/JACK-Client/jack/__init__.pyi @@ -1,12 +1,38 @@ import sys from _typeshed import Self from collections.abc import Callable, Generator, Iterable, Iterator, Sequence -from typing import Any, overload -from typing_extensions import Literal, TypeAlias +from typing import Any, NoReturn, overload +from typing_extensions import Literal -_NDArray: TypeAlias = Any # FIXME: no typings for numpy arrays +import numpy +from _cffi_backend import _CDataBase +from numpy.typing import NDArray -class _JackPositionT: ... +# Aka jack_position_t +# Actual type: _cffi_backend.__CDataOwn +# This is not a real subclassing. Just ensuring type-checkers sees this type as compatible with _CDataBase +# pyright has no error code for subclassing final +class _JackPositionT(_CDataBase): # type: ignore[misc] # pyright: ignore + audio_frames_per_video_frame: float + bar: int + bar_start_tick: float + bbt_offset: int + beat: int + beat_type: float + beats_per_bar: float + beats_per_minute: float + frame: int + frame_rate: int + frame_time: float + next_time: float + padding: _CDataBase # + tick: int + ticks_per_beat: float + unique_1: int + unique_2: int + usecs: int + valid: int + video_offset: int class _CBufferType: @overload @@ -100,9 +126,9 @@ class Client: @transport_frame.setter def transport_frame(self, frame: int) -> None: ... def transport_locate(self, frame: int) -> None: ... - def transport_query(self) -> tuple[TransportState, dict[str, Any]]: ... + def transport_query(self) -> tuple[TransportState, dict[str, Any]]: ... # Anyof[int, float, _CDataBase] def transport_query_struct(self) -> tuple[TransportState, _JackPositionT]: ... - def transport_reposition_struct(self, position: _JackPositionT) -> None: ... # TODO + def transport_reposition_struct(self, position: _JackPositionT) -> None: ... def set_sync_timeout(self, timeout: int) -> None: ... def set_freewheel(self, onoff: bool) -> None: ... def set_shutdown_callback(self, callback: Callable[[Status, str], object]) -> None: ... @@ -149,7 +175,8 @@ class Client: def remove_all_properties(self) -> None: ... class Port: - def __init__(self, port_ptr: Any, client: Client) -> None: ... + # + def __init__(self, port_ptr: _CDataBase, client: Client) -> None: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... @property @@ -196,12 +223,14 @@ class OwnPort(Port): def disconnect(self, other: str | Port | None = ...) -> None: ... def unregister(self) -> None: ... def get_buffer(self) -> _CBufferType: ... - def get_array(self) -> _NDArray: ... + def get_array(self) -> NDArray[numpy.float32]: ... class OwnMidiPort(MidiPort, OwnPort): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def get_buffer(self) -> _CBufferType: ... - def get_array(self) -> _NDArray: ... + def __init__(self, port_ptr: _CDataBase, client: Client) -> None: ... + # The implementation raises NotImplementedError, but this is not an abstract class. + # `get_buffer()` and `get_array()` are disabled for OwnMidiPort + def get_buffer(self) -> NoReturn: ... + def get_array(self) -> NoReturn: ... @property def max_event_size(self) -> int: ... @property @@ -212,7 +241,7 @@ class OwnMidiPort(MidiPort, OwnPort): def reserve_midi_event(self, time: int, size: int) -> _CBufferType: ... class Ports: - def __init__(self, client: Client, porttype: Any, flag: Any) -> None: ... + def __init__(self, client: Client, porttype: str, flag: int) -> None: ... def __len__(self) -> int: ... def __getitem__(self, name: str) -> Port: ... def __iter__(self) -> Iterator[Port]: ... @@ -278,7 +307,7 @@ class CallbackExit(Exception): ... def get_property(subject: int | str, key: str) -> tuple[bytes, str] | None: ... def get_properties(subject: int | str) -> dict[str, tuple[bytes, str]]: ... def get_all_properties() -> dict[str, dict[str, tuple[bytes, str]]]: ... -def position2dict(pos: _JackPositionT) -> dict[str, Any]: ... +def position2dict(pos: _JackPositionT) -> dict[str, Any]: ... # Anyof[int, float, _CDataBase] def version() -> tuple[int, int, int, int]: ... def version_string() -> str: ... def client_name_size() -> int: ... From 58ef8544272a27ba33f8dee1f878c9bc1d229300 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 17 Jan 2023 21:51:53 -0800 Subject: [PATCH 11/16] black --- stdlib/argparse.pyi | 15 ++++++--- stdlib/asyncio/base_events.pyi | 4 ++- stdlib/asyncio/format_helpers.pyi | 2 +- stdlib/asyncio/sslproto.pyi | 2 +- stdlib/asyncore.pyi | 2 +- stdlib/base64.pyi | 4 ++- stdlib/bdb.pyi | 6 ++-- stdlib/builtins.pyi | 6 ++-- stdlib/calendar.pyi | 4 ++- stdlib/cgi.pyi | 10 +++--- stdlib/cgitb.pyi | 4 +-- stdlib/cmd.pyi | 2 +- stdlib/code.pyi | 8 ++--- stdlib/codecs.pyi | 34 +++++++++++-------- stdlib/codeop.pyi | 4 +-- stdlib/concurrent/futures/_base.pyi | 4 ++- stdlib/concurrent/futures/thread.pyi | 2 +- stdlib/configparser.pyi | 14 ++++---- stdlib/csv.pyi | 10 +++--- stdlib/dbm/__init__.pyi | 2 +- stdlib/dbm/dumb.pyi | 4 +-- stdlib/difflib.pyi | 41 ++++++++++++----------- stdlib/distutils/archive_util.pyi | 2 +- stdlib/distutils/ccompiler.pyi | 8 ++--- stdlib/distutils/cmd.pyi | 8 +---- stdlib/distutils/command/config.pyi | 12 +++---- stdlib/distutils/core.pyi | 2 +- stdlib/distutils/dep_util.pyi | 2 +- stdlib/distutils/filelist.pyi | 4 +-- stdlib/doctest.pyi | 11 ++++-- stdlib/email/_header_value_parser.pyi | 4 +-- stdlib/email/base64mime.pyi | 4 +-- stdlib/email/charset.pyi | 2 +- stdlib/email/header.pyi | 10 +++--- stdlib/email/headerregistry.pyi | 2 +- stdlib/email/iterators.pyi | 2 +- stdlib/email/message.pyi | 16 +++++---- stdlib/email/mime/application.pyi | 2 +- stdlib/email/mime/message.pyi | 2 +- stdlib/email/mime/multipart.pyi | 2 +- stdlib/email/mime/text.pyi | 4 ++- stdlib/email/quoprimime.pyi | 6 ++-- stdlib/email/utils.pyi | 4 +-- stdlib/encodings/utf_8.pyi | 2 +- stdlib/encodings/utf_8_sig.pyi | 12 +++---- stdlib/ftplib.pyi | 10 +++--- stdlib/getopt.pyi | 2 +- stdlib/getpass.pyi | 2 +- stdlib/hmac.pyi | 2 +- stdlib/http/cookies.pyi | 4 +-- stdlib/http/server.pyi | 2 +- stdlib/imaplib.pyi | 6 ++-- stdlib/importlib/abc.pyi | 4 +-- stdlib/importlib/metadata/__init__.pyi | 2 +- stdlib/importlib/resources.pyi | 4 +-- stdlib/lib2to3/pgen2/driver.pyi | 2 +- stdlib/lib2to3/pgen2/pgen.pyi | 2 +- stdlib/lib2to3/refactor.pyi | 4 ++- stdlib/logging/__init__.pyi | 2 +- stdlib/logging/handlers.pyi | 4 +-- stdlib/lzma.pyi | 2 +- stdlib/mailcap.pyi | 2 +- stdlib/multiprocessing/dummy/__init__.pyi | 4 ++- stdlib/multiprocessing/pool.pyi | 4 +-- stdlib/optparse.pyi | 6 ++-- stdlib/os/__init__.pyi | 10 ++++-- stdlib/pathlib.pyi | 2 +- stdlib/pdb.pyi | 4 +-- stdlib/pickle.pyi | 8 ++--- stdlib/pkgutil.pyi | 6 ++-- stdlib/platform.pyi | 12 ++++--- stdlib/plistlib.pyi | 2 +- stdlib/pstats.pyi | 2 +- stdlib/py_compile.pyi | 2 +- stdlib/pydoc.pyi | 23 ++++++++----- stdlib/re.pyi | 16 ++++++--- stdlib/reprlib.pyi | 2 +- stdlib/shelve.pyi | 6 ++-- stdlib/smtplib.pyi | 16 ++++----- stdlib/socket.pyi | 11 ++---- stdlib/sqlite3/dbapi2.pyi | 2 +- stdlib/ssl.pyi | 9 +++-- stdlib/statistics.pyi | 2 +- stdlib/subprocess.pyi | 4 ++- stdlib/sysconfig.pyi | 4 +-- stdlib/tarfile.pyi | 24 ++++++------- stdlib/tempfile.pyi | 2 +- stdlib/textwrap.pyi | 6 ++-- stdlib/timeit.pyi | 8 ++--- stdlib/tracemalloc.pyi | 7 +++- stdlib/typing.pyi | 4 ++- stdlib/unittest/case.pyi | 2 +- stdlib/unittest/loader.pyi | 8 +++-- stdlib/unittest/main.pyi | 2 +- stdlib/unittest/mock.pyi | 15 ++++++--- stdlib/urllib/parse.pyi | 24 ++++++------- stdlib/urllib/robotparser.pyi | 2 +- stdlib/uu.pyi | 4 ++- stdlib/warnings.pyi | 18 +++++----- stdlib/webbrowser.pyi | 2 +- stdlib/xml/dom/domreg.pyi | 4 ++- stdlib/xml/dom/minidom.pyi | 12 +++---- stdlib/xml/etree/ElementTree.pyi | 2 +- stdlib/xml/sax/saxutils.pyi | 4 +-- stdlib/xmlrpc/client.pyi | 4 ++- stdlib/zipfile.pyi | 16 +++++---- stdlib/zlib.pyi | 7 +--- 107 files changed, 387 insertions(+), 310 deletions(-) diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 6939dbf992fb..ba1beb3c1318 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -339,7 +339,7 @@ class FileType: _bufsize: int _encoding: str | None _errors: str | None - def __init__(self, mode: str = 'r', bufsize: int = -1, encoding: str | None = None, errors: str | None = None) -> None: ... + def __init__(self, mode: str = "r", bufsize: int = -1, encoding: str | None = None, errors: str | None = None) -> None: ... def __call__(self, string: str) -> IO[Any]: ... # undocumented @@ -436,13 +436,20 @@ class _CountAction(Action): # undocumented class _HelpAction(Action): - def __init__(self, option_strings: Sequence[str], dest: str = '==SUPPRESS==', default: str = '==SUPPRESS==', help: str | None = None) -> None: ... + def __init__( + self, option_strings: Sequence[str], dest: str = "==SUPPRESS==", default: str = "==SUPPRESS==", help: str | None = None + ) -> None: ... # undocumented class _VersionAction(Action): version: str | None def __init__( - self, option_strings: Sequence[str], version: str | None = None, dest: str = '==SUPPRESS==', default: str = '==SUPPRESS==', help: str = "show program's version number and exit" + self, + option_strings: Sequence[str], + version: str | None = None, + dest: str = "==SUPPRESS==", + default: str = "==SUPPRESS==", + help: str = "show program's version number and exit", ) -> None: ... # undocumented @@ -458,7 +465,7 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]): option_strings: Sequence[str], prog: str, parser_class: type[_ArgumentParserT], - dest: str = '==SUPPRESS==', + dest: str = "==SUPPRESS==", required: bool = False, help: str | None = None, metavar: str | tuple[str, ...] | None = None, diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 6e00dd998ee7..1dc5d0779b59 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -78,7 +78,9 @@ class BaseEventLoop(AbstractEventLoop): def call_later( self, delay: float, callback: Callable[..., object], *args: Any, context: Context | None = None ) -> TimerHandle: ... - def call_at(self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = None) -> TimerHandle: ... + def call_at( + self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = None + ) -> TimerHandle: ... def time(self) -> float: ... # Future methods def create_future(self) -> Future[Any]: ... diff --git a/stdlib/asyncio/format_helpers.pyi b/stdlib/asyncio/format_helpers.pyi index 053f0500558e..1c78dff3948a 100644 --- a/stdlib/asyncio/format_helpers.pyi +++ b/stdlib/asyncio/format_helpers.pyi @@ -16,5 +16,5 @@ def _get_function_source(func: _FuncType) -> tuple[str, int]: ... def _get_function_source(func: object) -> tuple[str, int] | None: ... def _format_callback_source(func: object, args: Iterable[Any]) -> str: ... def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ... -def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = '') -> str: ... +def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = "") -> str: ... def extract_stack(f: FrameType | None = None, limit: int | None = None) -> traceback.StackSummary: ... diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index 4db8e5b1454a..46ca40f0138a 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -151,7 +151,7 @@ class SSLProtocol(_SSLProtocolBase): def _start_handshake(self) -> None: ... def _check_handshake_timeout(self) -> None: ... def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ... - def _fatal_error(self, exc: BaseException, message: str = 'Fatal error on transport') -> None: ... + def _fatal_error(self, exc: BaseException, message: str = "Fatal error on transport") -> None: ... def _abort(self) -> None: ... if sys.version_info >= (3, 11): def get_buffer(self, n: int) -> memoryview: ... diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index 1fd860fb2410..c92bfe0a8ab2 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -49,7 +49,7 @@ class dispatcher: def recv(self, buffer_size: int) -> bytes: ... def close(self) -> None: ... def log(self, message: Any) -> None: ... - def log_info(self, message: Any, type: str = 'info') -> None: ... + def log_info(self, message: Any, type: str = "info") -> None: ... def handle_read_event(self) -> None: ... def handle_connect_event(self) -> None: ... def handle_write_event(self) -> None: ... diff --git a/stdlib/base64.pyi b/stdlib/base64.pyi index e60ac754ef51..9a6964553a4a 100644 --- a/stdlib/base64.pyi +++ b/stdlib/base64.pyi @@ -41,7 +41,9 @@ if sys.version_info >= (3, 10): def b32hexencode(s: ReadableBuffer) -> bytes: ... def b32hexdecode(s: str | ReadableBuffer, casefold: bool = False) -> bytes: ... -def a85encode(b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False) -> bytes: ... +def a85encode( + b: ReadableBuffer, *, foldspaces: bool = False, wrapcol: int = 0, pad: bool = False, adobe: bool = False +) -> bytes: ... def a85decode( b: str | ReadableBuffer, *, foldspaces: bool = False, adobe: bool = False, ignorechars: bytearray | bytes = ... ) -> bytes: ... diff --git a/stdlib/bdb.pyi b/stdlib/bdb.pyi index 24709751ad2f..d07c6a3522fb 100644 --- a/stdlib/bdb.pyi +++ b/stdlib/bdb.pyi @@ -61,8 +61,10 @@ class Bdb: def get_file_breaks(self, filename: str) -> list[Breakpoint]: ... def get_all_breaks(self) -> list[Breakpoint]: ... def get_stack(self, f: FrameType | None, t: TracebackType | None) -> tuple[list[tuple[FrameType, int]], int]: ... - def format_stack_entry(self, frame_lineno: int, lprefix: str = ': ') -> str: ... - def run(self, cmd: str | CodeType, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None) -> None: ... + def format_stack_entry(self, frame_lineno: int, lprefix: str = ": ") -> str: ... + def run( + self, cmd: str | CodeType, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None + ) -> None: ... def runeval(self, expr: str, globals: dict[str, Any] | None = None, locals: Mapping[str, Any] | None = None) -> None: ... def runctx(self, cmd: str | CodeType, globals: dict[str, Any] | None, locals: Mapping[str, Any] | None) -> None: ... def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> _T | None: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 73ffbf8cf9ab..931b6c6c35b0 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -426,7 +426,7 @@ class str(Sequence[str]): @overload def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ... # type: ignore[misc] def count(self, x: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ... - def encode(self, encoding: str = 'utf-8', errors: str = 'strict') -> bytes: ... + def encode(self, encoding: str = "utf-8", errors: str = "strict") -> bytes: ... def endswith( self, __suffix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... @@ -596,7 +596,7 @@ class bytes(ByteString): def count( self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... - def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ... def endswith( self, __suffix: ReadableBuffer | tuple[ReadableBuffer, ...], @@ -701,7 +701,7 @@ class bytearray(MutableSequence[int], ByteString): self, __sub: ReadableBuffer | SupportsIndex, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> int: ... def copy(self) -> bytearray: ... - def decode(self, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... + def decode(self, encoding: str = "utf-8", errors: str = "strict") -> str: ... def endswith( self, __suffix: ReadableBuffer | tuple[ReadableBuffer, ...], diff --git a/stdlib/calendar.pyi b/stdlib/calendar.pyi index 215afa033414..255a12d3348a 100644 --- a/stdlib/calendar.pyi +++ b/stdlib/calendar.pyi @@ -104,7 +104,9 @@ class HTMLCalendar(Calendar): def formatmonthname(self, theyear: int, themonth: int, withyear: bool = True) -> str: ... def formatmonth(self, theyear: int, themonth: int, withyear: bool = True) -> str: ... def formatyear(self, theyear: int, width: int = 3) -> str: ... - def formatyearpage(self, theyear: int, width: int = 3, css: str | None = 'calendar.css', encoding: str | None = None) -> str: ... + def formatyearpage( + self, theyear: int, width: int = 3, css: str | None = "calendar.css", encoding: str | None = None + ) -> str: ... class different_locale: def __init__(self, locale: _LocaleType) -> None: ... diff --git a/stdlib/cgi.pyi b/stdlib/cgi.pyi index 984923a8c4ab..76e7a348335c 100644 --- a/stdlib/cgi.pyi +++ b/stdlib/cgi.pyi @@ -29,7 +29,7 @@ def parse( environ: SupportsItemAccess[str, str] = ..., keep_blank_values: bool = ..., strict_parsing: bool = ..., - separator: str = '&', + separator: str = "&", ) -> dict[str, list[str]]: ... if sys.version_info < (3, 8): @@ -37,7 +37,7 @@ if sys.version_info < (3, 8): def parse_qsl(qs: str, keep_blank_values: bool = ..., strict_parsing: bool = ...) -> list[tuple[str, str]]: ... def parse_multipart( - fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = 'utf-8', errors: str = 'replace', separator: str = '&' + fp: IO[Any], pdict: SupportsGetItem[str, bytes], encoding: str = "utf-8", errors: str = "replace", separator: str = "&" ) -> dict[str, list[Any]]: ... class _Environ(Protocol): @@ -100,10 +100,10 @@ class FieldStorage: keep_blank_values: int = 0, strict_parsing: int = 0, limit: int | None = None, - encoding: str = 'utf-8', - errors: str = 'replace', + encoding: str = "utf-8", + errors: str = "replace", max_num_fields: int | None = None, - separator: str = '&', + separator: str = "&", ) -> None: ... def __enter__(self: Self) -> Self: ... def __exit__(self, *args: Unused) -> None: ... diff --git a/stdlib/cgitb.pyi b/stdlib/cgitb.pyi index c0cc8719f82e..04bcbfb0d13d 100644 --- a/stdlib/cgitb.pyi +++ b/stdlib/cgitb.pyi @@ -23,10 +23,10 @@ class Hook: # undocumented logdir: StrOrBytesPath | None = None, context: int = 5, file: IO[str] | None = None, - format: str = 'html', + format: str = "html", ) -> None: ... def __call__(self, etype: type[BaseException] | None, evalue: BaseException | None, etb: TracebackType | None) -> None: ... def handle(self, info: OptExcInfo | None = None) -> None: ... def handler(info: OptExcInfo | None = None) -> None: ... -def enable(display: int = 1, logdir: StrOrBytesPath | None = None, context: int = 5, format: str = 'html') -> None: ... +def enable(display: int = 1, logdir: StrOrBytesPath | None = None, context: int = 5, format: str = "html") -> None: ... diff --git a/stdlib/cmd.pyi b/stdlib/cmd.pyi index 36edcb1f2161..b658a873410b 100644 --- a/stdlib/cmd.pyi +++ b/stdlib/cmd.pyi @@ -23,7 +23,7 @@ class Cmd: stdout: IO[str] cmdqueue: list[str] completekey: str - def __init__(self, completekey: str = 'tab', stdin: IO[str] | None = None, stdout: IO[str] | None = None) -> None: ... + def __init__(self, completekey: str = "tab", stdin: IO[str] | None = None, stdout: IO[str] | None = None) -> None: ... old_completer: Callable[[str, int], str | None] | None def cmdloop(self, intro: Any | None = None) -> None: ... def precmd(self, line: str) -> str: ... diff --git a/stdlib/code.pyi b/stdlib/code.pyi index 450152d9976a..4715bd866ddc 100644 --- a/stdlib/code.pyi +++ b/stdlib/code.pyi @@ -9,7 +9,7 @@ class InteractiveInterpreter: locals: Mapping[str, Any] # undocumented compile: CommandCompiler # undocumented def __init__(self, locals: Mapping[str, Any] | None = None) -> None: ... - def runsource(self, source: str, filename: str = '', symbol: str = 'single') -> bool: ... + def runsource(self, source: str, filename: str = "", symbol: str = "single") -> bool: ... def runcode(self, code: CodeType) -> None: ... def showsyntaxerror(self, filename: str | None = None) -> None: ... def showtraceback(self) -> None: ... @@ -18,11 +18,11 @@ class InteractiveInterpreter: class InteractiveConsole(InteractiveInterpreter): buffer: list[str] # undocumented filename: str # undocumented - def __init__(self, locals: Mapping[str, Any] | None = None, filename: str = '') -> None: ... + def __init__(self, locals: Mapping[str, Any] | None = None, filename: str = "") -> None: ... def interact(self, banner: str | None = None, exitmsg: str | None = None) -> None: ... def push(self, line: str) -> bool: ... def resetbuffer(self) -> None: ... - def raw_input(self, prompt: str = '') -> str: ... + def raw_input(self, prompt: str = "") -> str: ... def interact( banner: str | None = None, @@ -30,4 +30,4 @@ def interact( local: Mapping[str, Any] | None = None, exitmsg: str | None = None, ) -> None: ... -def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... +def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index d8e3e2cf9e8b..17d26ec89020 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -128,11 +128,11 @@ def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ... def getreader(encoding: str) -> _StreamReader: ... def getwriter(encoding: str) -> _StreamWriter: ... def open( - filename: str, mode: str = 'r', encoding: str | None = None, errors: str = 'strict', buffering: int = -1 + filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1 ) -> StreamReaderWriter: ... -def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = 'strict') -> StreamRecoder: ... -def iterencode(iterator: Iterable[str], encoding: str, errors: str = 'strict') -> Generator[bytes, None, None]: ... -def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = 'strict') -> Generator[str, None, None]: ... +def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = "strict") -> StreamRecoder: ... +def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes, None, None]: ... +def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = "strict") -> Generator[str, None, None]: ... BOM: Literal[b"\xff\xfe", b"\xfe\xff"] # depends on `sys.byteorder` BOM_BE: Literal[b"\xfe\xff"] @@ -155,12 +155,12 @@ def namereplace_errors(exception: UnicodeError) -> tuple[str | bytes, int]: ... class Codec: # These are sort of @abstractmethod but sort of not. # The StreamReader and StreamWriter subclasses only implement one. - def encode(self, input: str, errors: str = 'strict') -> tuple[bytes, int]: ... - def decode(self, input: bytes, errors: str = 'strict') -> tuple[str, int]: ... + def encode(self, input: str, errors: str = "strict") -> tuple[bytes, int]: ... + def decode(self, input: bytes, errors: str = "strict") -> tuple[str, int]: ... class IncrementalEncoder: errors: str - def __init__(self, errors: str = 'strict') -> None: ... + def __init__(self, errors: str = "strict") -> None: ... @abstractmethod def encode(self, input: str, final: bool = False) -> bytes: ... def reset(self) -> None: ... @@ -170,7 +170,7 @@ class IncrementalEncoder: class IncrementalDecoder: errors: str - def __init__(self, errors: str = 'strict') -> None: ... + def __init__(self, errors: str = "strict") -> None: ... @abstractmethod def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... def reset(self) -> None: ... @@ -180,14 +180,14 @@ class IncrementalDecoder: # These are not documented but used in encodings/*.py implementations. class BufferedIncrementalEncoder(IncrementalEncoder): buffer: str - def __init__(self, errors: str = 'strict') -> None: ... + def __init__(self, errors: str = "strict") -> None: ... @abstractmethod def _buffer_encode(self, input: str, errors: str, final: bool) -> bytes: ... def encode(self, input: str, final: bool = False) -> bytes: ... class BufferedIncrementalDecoder(IncrementalDecoder): buffer: bytes - def __init__(self, errors: str = 'strict') -> None: ... + def __init__(self, errors: str = "strict") -> None: ... @abstractmethod def _buffer_decode(self, input: ReadableBuffer, errors: str, final: bool) -> tuple[str, int]: ... def decode(self, input: ReadableBuffer, final: bool = False) -> str: ... @@ -197,7 +197,7 @@ class BufferedIncrementalDecoder(IncrementalDecoder): class StreamWriter(Codec): stream: _WritableStream errors: str - def __init__(self, stream: _WritableStream, errors: str = 'strict') -> None: ... + def __init__(self, stream: _WritableStream, errors: str = "strict") -> None: ... def write(self, object: str) -> None: ... def writelines(self, list: Iterable[str]) -> None: ... def reset(self) -> None: ... @@ -208,7 +208,7 @@ class StreamWriter(Codec): class StreamReader(Codec): stream: _ReadableStream errors: str - def __init__(self, stream: _ReadableStream, errors: str = 'strict') -> None: ... + def __init__(self, stream: _ReadableStream, errors: str = "strict") -> None: ... def read(self, size: int = -1, chars: int = -1, firstline: bool = False) -> str: ... def readline(self, size: int | None = None, keepends: bool = True) -> str: ... def readlines(self, sizehint: int | None = None, keepends: bool = True) -> list[str]: ... @@ -223,7 +223,7 @@ class StreamReader(Codec): # and delegates attributes to the underlying binary stream with __getattr__. class StreamReaderWriter(TextIO): stream: _Stream - def __init__(self, stream: _Stream, Reader: _StreamReader, Writer: _StreamWriter, errors: str = 'strict') -> None: ... + def __init__(self, stream: _Stream, Reader: _StreamReader, Writer: _StreamWriter, errors: str = "strict") -> None: ... def read(self, size: int = -1) -> str: ... def readline(self, size: int | None = None) -> str: ... def readlines(self, sizehint: int | None = None) -> list[str]: ... @@ -250,7 +250,13 @@ class StreamReaderWriter(TextIO): class StreamRecoder(BinaryIO): def __init__( - self, stream: _Stream, encode: _Encoder, decode: _Decoder, Reader: _StreamReader, Writer: _StreamWriter, errors: str = 'strict' + self, + stream: _Stream, + encode: _Encoder, + decode: _Decoder, + Reader: _StreamReader, + Writer: _StreamWriter, + errors: str = "strict", ) -> None: ... def read(self, size: int = -1) -> bytes: ... def readline(self, size: int | None = None) -> bytes: ... diff --git a/stdlib/codeop.pyi b/stdlib/codeop.pyi index 6bb3a79e6765..6a51b7786384 100644 --- a/stdlib/codeop.pyi +++ b/stdlib/codeop.pyi @@ -2,7 +2,7 @@ from types import CodeType __all__ = ["compile_command", "Compile", "CommandCompiler"] -def compile_command(source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... +def compile_command(source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... class Compile: flags: int @@ -10,4 +10,4 @@ class Compile: class CommandCompiler: compiler: Compile - def __call__(self, source: str, filename: str = '', symbol: str = 'single') -> CodeType | None: ... + def __call__(self, source: str, filename: str = "", symbol: str = "single") -> CodeType | None: ... diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index 89d986ab3e2a..52748527e022 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -84,7 +84,9 @@ class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]): @overload def __getitem__(self, __s: slice) -> DoneAndNotDoneFutures[_T]: ... -def wait(fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = 'ALL_COMPLETED') -> DoneAndNotDoneFutures[_T]: ... +def wait( + fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = "ALL_COMPLETED" +) -> DoneAndNotDoneFutures[_T]: ... class _Waiter: event: threading.Event diff --git a/stdlib/concurrent/futures/thread.pyi b/stdlib/concurrent/futures/thread.pyi index ba685723d75d..e43dd3dfa33a 100644 --- a/stdlib/concurrent/futures/thread.pyi +++ b/stdlib/concurrent/futures/thread.pyi @@ -51,7 +51,7 @@ class ThreadPoolExecutor(Executor): def __init__( self, max_workers: int | None = None, - thread_name_prefix: str = '', + thread_name_prefix: str = "", initializer: Callable[..., object] | None = None, initargs: tuple[Any, ...] = ..., ) -> None: ... diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index 156c47c9a3cd..0587e56c20d2 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -74,7 +74,7 @@ class RawConfigParser(_Parser): inline_comment_prefixes: Sequence[str] | None = None, strict: bool = True, empty_lines_in_values: bool = True, - default_section: str = 'DEFAULT', + default_section: str = "DEFAULT", interpolation: Interpolation | None = ..., converters: _ConvertersMap = ..., ) -> None: ... @@ -90,7 +90,7 @@ class RawConfigParser(_Parser): inline_comment_prefixes: Sequence[str] | None = None, strict: bool = True, empty_lines_in_values: bool = True, - default_section: str = 'DEFAULT', + default_section: str = "DEFAULT", interpolation: Interpolation | None = ..., converters: _ConvertersMap = ..., ) -> None: ... @@ -108,8 +108,8 @@ class RawConfigParser(_Parser): def has_option(self, section: str, option: str) -> bool: ... def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str]: ... def read_file(self, f: Iterable[str], source: str | None = None) -> None: ... - def read_string(self, string: str, source: str = '') -> None: ... - def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = '') -> None: ... + def read_string(self, string: str, source: str = "") -> None: ... + def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = "") -> None: ... def readfp(self, fp: Iterable[str], filename: str | None = None) -> None: ... # These get* methods are partially applied (with the same names) in # SectionProxy; the stubs should be kept updated together @@ -145,7 +145,9 @@ class RawConfigParser(_Parser): @overload # type: ignore[override] def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str | Any: ... @overload - def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T) -> str | _T | Any: ... + def get( + self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T + ) -> str | _T | Any: ... @overload def items(self, *, raw: bool = False, vars: _Section | None = None) -> ItemsView[str, SectionProxy]: ... @overload @@ -216,7 +218,7 @@ class ConverterMapping(MutableMapping[str, _ConverterCallback | None]): class Error(Exception): message: str - def __init__(self, msg: str = '') -> None: ... + def __init__(self, msg: str = "") -> None: ... class NoSectionError(Error): section: str diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 60255c2d7b1c..13b483b219d5 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -78,7 +78,7 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]): fieldnames: Sequence[_T], restkey: str | None = None, restval: str | None = None, - dialect: _DialectLike = 'excel', + dialect: _DialectLike = "excel", *, delimiter: str = ..., quotechar: str | None = ..., @@ -96,7 +96,7 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]): fieldnames: Sequence[str] | None = None, restkey: str | None = None, restval: str | None = None, - dialect: _DialectLike = 'excel', + dialect: _DialectLike = "excel", *, delimiter: str = ..., quotechar: str | None = ..., @@ -121,9 +121,9 @@ class DictWriter(Generic[_T]): self, f: SupportsWrite[str], fieldnames: Collection[_T], - restval: Any | None = '', - extrasaction: Literal["raise", "ignore"] = 'raise', - dialect: _DialectLike = 'excel', + restval: Any | None = "", + extrasaction: Literal["raise", "ignore"] = "raise", + dialect: _DialectLike = "excel", *, delimiter: str = ..., quotechar: str | None = ..., diff --git a/stdlib/dbm/__init__.pyi b/stdlib/dbm/__init__.pyi index 88778cf95873..5c44553dd668 100644 --- a/stdlib/dbm/__init__.pyi +++ b/stdlib/dbm/__init__.pyi @@ -92,4 +92,4 @@ class _error(Exception): ... error: tuple[type[_error], type[OSError]] def whichdb(filename: str) -> str: ... -def open(file: str, flag: _TFlags = 'r', mode: int = 438) -> _Database: ... +def open(file: str, flag: _TFlags = "r", mode: int = 438) -> _Database: ... diff --git a/stdlib/dbm/dumb.pyi b/stdlib/dbm/dumb.pyi index 598f344989c3..7cdb5d42b0dd 100644 --- a/stdlib/dbm/dumb.pyi +++ b/stdlib/dbm/dumb.pyi @@ -14,7 +14,7 @@ error = OSError # any of the three implementations of dbm (dumb, gnu, ndbm), and this # class is intended to represent the common interface supported by all three. class _Database(MutableMapping[_KeyType, bytes]): - def __init__(self, filebasename: str, mode: str, flag: str = 'c') -> None: ... + def __init__(self, filebasename: str, mode: str, flag: str = "c") -> None: ... def sync(self) -> None: ... def iterkeys(self) -> Iterator[bytes]: ... # undocumented def close(self) -> None: ... @@ -29,4 +29,4 @@ class _Database(MutableMapping[_KeyType, bytes]): self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None ) -> None: ... -def open(file: str, flag: str = 'c', mode: int = 438) -> _Database: ... +def open(file: str, flag: str = "c", mode: int = 438) -> _Database: ... diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index f26daed3e900..4be1a8a89c0a 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -36,8 +36,8 @@ class SequenceMatcher(Generic[_T]): def __init__( self: SequenceMatcher[str], isjunk: Callable[[str], bool] | None = None, - a: Sequence[str] = '', - b: Sequence[str] = '', + a: Sequence[str] = "", + b: Sequence[str] = "", autojunk: bool = True, ) -> None: ... def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ... @@ -70,29 +70,32 @@ class Differ: def compare(self, a: Sequence[str], b: Sequence[str]) -> Iterator[str]: ... def IS_LINE_JUNK(line: str, pat: Any = ...) -> bool: ... # pat is undocumented -def IS_CHARACTER_JUNK(ch: str, ws: str = ' \t') -> bool: ... # ws is undocumented +def IS_CHARACTER_JUNK(ch: str, ws: str = " \t") -> bool: ... # ws is undocumented def unified_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = '', - tofile: str = '', - fromfiledate: str = '', - tofiledate: str = '', + fromfile: str = "", + tofile: str = "", + fromfiledate: str = "", + tofiledate: str = "", n: int = 3, - lineterm: str = '\n', + lineterm: str = "\n", ) -> Iterator[str]: ... def context_diff( a: Sequence[str], b: Sequence[str], - fromfile: str = '', - tofile: str = '', - fromfiledate: str = '', - tofiledate: str = '', + fromfile: str = "", + tofile: str = "", + fromfiledate: str = "", + tofiledate: str = "", n: int = 3, - lineterm: str = '\n', + lineterm: str = "\n", ) -> Iterator[str]: ... def ndiff( - a: Sequence[str], b: Sequence[str], linejunk: Callable[[str], bool] | None = None, charjunk: Callable[[str], bool] | None = ... + a: Sequence[str], + b: Sequence[str], + linejunk: Callable[[str], bool] | None = None, + charjunk: Callable[[str], bool] | None = ..., ) -> Iterator[str]: ... class HtmlDiff: @@ -107,19 +110,19 @@ class HtmlDiff: self, fromlines: Sequence[str], tolines: Sequence[str], - fromdesc: str = '', - todesc: str = '', + fromdesc: str = "", + todesc: str = "", context: bool = False, numlines: int = 5, *, - charset: str = 'utf-8', + charset: str = "utf-8", ) -> str: ... def make_table( self, fromlines: Sequence[str], tolines: Sequence[str], - fromdesc: str = '', - todesc: str = '', + fromdesc: str = "", + todesc: str = "", context: bool = False, numlines: int = 5, ) -> str: ... diff --git a/stdlib/distutils/archive_util.pyi b/stdlib/distutils/archive_util.pyi index d2723d60ca1b..a8947ce35c60 100644 --- a/stdlib/distutils/archive_util.pyi +++ b/stdlib/distutils/archive_util.pyi @@ -11,7 +11,7 @@ def make_archive( def make_tarball( base_name: str, base_dir: str, - compress: str | None = 'gzip', + compress: str | None = "gzip", verbose: int = 0, dry_run: int = 0, owner: str | None = None, diff --git a/stdlib/distutils/ccompiler.pyi b/stdlib/distutils/ccompiler.pyi index 0b8864748496..e17b96bcc39e 100644 --- a/stdlib/distutils/ccompiler.pyi +++ b/stdlib/distutils/ccompiler.pyi @@ -139,10 +139,10 @@ class CCompiler: extra_preargs: list[str] | None = None, extra_postargs: list[str] | None = None, ) -> None: ... - def executable_filename(self, basename: str, strip_dir: int = 0, output_dir: str = '') -> str: ... - def library_filename(self, libname: str, lib_type: str = 'static', strip_dir: int = 0, output_dir: str = '') -> str: ... - def object_filenames(self, source_filenames: list[str], strip_dir: int = 0, output_dir: str = '') -> list[str]: ... - def shared_object_filename(self, basename: str, strip_dir: int = 0, output_dir: str = '') -> str: ... + def executable_filename(self, basename: str, strip_dir: int = 0, output_dir: str = "") -> str: ... + def library_filename(self, libname: str, lib_type: str = "static", strip_dir: int = 0, output_dir: str = "") -> str: ... + def object_filenames(self, source_filenames: list[str], strip_dir: int = 0, output_dir: str = "") -> list[str]: ... + def shared_object_filename(self, basename: str, strip_dir: int = 0, output_dir: str = "") -> str: ... def execute(self, func: Callable[..., object], args: tuple[Any, ...], msg: str | None = None, level: int = 1) -> None: ... def spawn(self, cmd: list[str]) -> None: ... def mkpath(self, name: str, mode: int = 511) -> None: ... diff --git a/stdlib/distutils/cmd.pyi b/stdlib/distutils/cmd.pyi index b71d8b1f2ceb..2f6efaedbfd6 100644 --- a/stdlib/distutils/cmd.pyi +++ b/stdlib/distutils/cmd.pyi @@ -28,13 +28,7 @@ class Command: def execute(self, func: Callable[..., object], args: Iterable[Any], msg: str | None = None, level: int = 1) -> None: ... def mkpath(self, name: str, mode: int = 511) -> None: ... def copy_file( - self, - infile: str, - outfile: str, - preserve_mode: int = 1, - preserve_times: int = 1, - link: str | None = None, - level: Any = 1, + self, infile: str, outfile: str, preserve_mode: int = 1, preserve_times: int = 1, link: str | None = None, level: Any = 1 ) -> tuple[str, bool]: ... # level is not used def copy_tree( self, diff --git a/stdlib/distutils/command/config.pyi b/stdlib/distutils/command/config.pyi index 1bdb3a9023aa..81fdf76b2b59 100644 --- a/stdlib/distutils/command/config.pyi +++ b/stdlib/distutils/command/config.pyi @@ -27,7 +27,7 @@ class config(Command): body: str | None = None, headers: Sequence[str] | None = None, include_dirs: Sequence[str] | None = None, - lang: str = 'c', + lang: str = "c", ) -> bool: ... def search_cpp( self, @@ -35,10 +35,10 @@ class config(Command): body: str | None = None, headers: Sequence[str] | None = None, include_dirs: Sequence[str] | None = None, - lang: str = 'c', + lang: str = "c", ) -> bool: ... def try_compile( - self, body: str, headers: Sequence[str] | None = None, include_dirs: Sequence[str] | None = None, lang: str = 'c' + self, body: str, headers: Sequence[str] | None = None, include_dirs: Sequence[str] | None = None, lang: str = "c" ) -> bool: ... def try_link( self, @@ -47,7 +47,7 @@ class config(Command): include_dirs: Sequence[str] | None = None, libraries: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, - lang: str = 'c', + lang: str = "c", ) -> bool: ... def try_run( self, @@ -56,7 +56,7 @@ class config(Command): include_dirs: Sequence[str] | None = None, libraries: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, - lang: str = 'c', + lang: str = "c", ) -> bool: ... def check_func( self, @@ -77,7 +77,7 @@ class config(Command): other_libraries: list[str] = ..., ) -> bool: ... def check_header( - self, header: str, include_dirs: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, lang: str = 'c' + self, header: str, include_dirs: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, lang: str = "c" ) -> bool: ... def dump_file(filename: str, head: Any | None = None) -> None: ... diff --git a/stdlib/distutils/core.pyi b/stdlib/distutils/core.pyi index 98639068f635..56081f921378 100644 --- a/stdlib/distutils/core.pyi +++ b/stdlib/distutils/core.pyi @@ -46,4 +46,4 @@ def setup( fullname: str = ..., **attrs: Any, ) -> None: ... -def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = 'run') -> Distribution: ... +def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = "run") -> Distribution: ... diff --git a/stdlib/distutils/dep_util.pyi b/stdlib/distutils/dep_util.pyi index 4fb898c6581b..096ce19d4859 100644 --- a/stdlib/distutils/dep_util.pyi +++ b/stdlib/distutils/dep_util.pyi @@ -1,3 +1,3 @@ def newer(source: str, target: str) -> bool: ... def newer_pairwise(sources: list[str], targets: list[str]) -> list[tuple[str, str]]: ... -def newer_group(sources: list[str], target: str, missing: str = 'error') -> bool: ... +def newer_group(sources: list[str], target: str, missing: str = "error") -> bool: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index 2dbbfef9fbaf..18fc501f26ad 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -9,7 +9,7 @@ class FileList: files: list[str] def __init__(self, warn: None = None, debug_print: None = None) -> None: ... def set_allfiles(self, allfiles: Iterable[str]) -> None: ... - def findall(self, dir: str = '.') -> None: ... + def findall(self, dir: str = ".") -> None: ... def debug_print(self, msg: str) -> None: ... def append(self, item: str) -> None: ... def extend(self, items: Iterable[str]) -> None: ... @@ -37,7 +37,7 @@ class FileList: self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0 ) -> bool: ... -def findall(dir: str = '.') -> list[str]: ... +def findall(dir: str = ".") -> list[str]: ... def glob_to_re(pattern: str) -> str: ... @overload def translate_pattern( diff --git a/stdlib/doctest.pyi b/stdlib/doctest.pyi index e7f239ed3a65..88d066fdc23c 100644 --- a/stdlib/doctest.pyi +++ b/stdlib/doctest.pyi @@ -107,9 +107,9 @@ class DocTest: def __eq__(self, other: object) -> bool: ... class DocTestParser: - def parse(self, string: str, name: str = '') -> list[str | Example]: ... + def parse(self, string: str, name: str = "") -> list[str | Example]: ... def get_doctest(self, string: str, globs: dict[str, Any], name: str, filename: str | None, lineno: int | None) -> DocTest: ... - def get_examples(self, string: str, name: str = '') -> list[Example]: ... + def get_examples(self, string: str, name: str = "") -> list[Example]: ... class DocTestFinder: def __init__( @@ -190,7 +190,12 @@ def testfile( encoding: str | None = None, ) -> TestResults: ... def run_docstring_examples( - f: object, globs: dict[str, Any], verbose: bool = False, name: str = 'NoName', compileflags: int | None = None, optionflags: int = 0 + f: object, + globs: dict[str, Any], + verbose: bool = False, + name: str = "NoName", + compileflags: int | None = None, + optionflags: int = 0, ) -> None: ... def set_unittest_reportflags(flags: int) -> int: ... diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index 04f51a97d4b3..0e422294e77a 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -39,8 +39,8 @@ class TokenList(list[TokenList | Terminal]): @property def comments(self) -> list[str]: ... def fold(self, *, policy: Policy) -> str: ... - def pprint(self, indent: str = '') -> None: ... - def ppstr(self, indent: str = '') -> str: ... + def pprint(self, indent: str = "") -> None: ... + def ppstr(self, indent: str = "") -> str: ... class WhiteSpaceTokenList(TokenList): ... diff --git a/stdlib/email/base64mime.pyi b/stdlib/email/base64mime.pyi index 2c49ba7192ad..563cd7f669a2 100644 --- a/stdlib/email/base64mime.pyi +++ b/stdlib/email/base64mime.pyi @@ -3,10 +3,10 @@ __all__ = ["body_decode", "body_encode", "decode", "decodestring", "header_encod from _typeshed import ReadableBuffer def header_length(bytearray: str | bytes | bytearray) -> int: ... -def header_encode(header_bytes: str | ReadableBuffer, charset: str = 'iso-8859-1') -> str: ... +def header_encode(header_bytes: str | ReadableBuffer, charset: str = "iso-8859-1") -> str: ... # First argument should be a buffer that supports slicing and len(). -def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = '\n') -> str: ... +def body_encode(s: bytes | bytearray, maxlinelen: int = 76, eol: str = "\n") -> str: ... def decode(string: str | ReadableBuffer) -> bytes: ... body_decode = decode diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index 1dd1fa25f383..24b8fd768b7b 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -13,7 +13,7 @@ class Charset: output_charset: str | None input_codec: str | None output_codec: str | None - def __init__(self, input_charset: str = 'us-ascii') -> None: ... + def __init__(self, input_charset: str = "us-ascii") -> None: ... def get_body_encoding(self) -> str: ... def get_output_charset(self) -> str | None: ... def header_encode(self, string: str) -> str: ... diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index 7171191b3dcc..c6f0c6fbf6fc 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -11,11 +11,11 @@ class Header: charset: Charset | str | None = None, maxlinelen: int | None = None, header_name: str | None = None, - continuation_ws: str = ' ', - errors: str = 'strict', + continuation_ws: str = " ", + errors: str = "strict", ) -> None: ... - def append(self, s: bytes | bytearray | str, charset: Charset | str | None = None, errors: str = 'strict') -> None: ... - def encode(self, splitchars: str = ';, \t', maxlinelen: int | None = None, linesep: str = '\n') -> str: ... + def append(self, s: bytes | bytearray | str, charset: Charset | str | None = None, errors: str = "strict") -> None: ... + def encode(self, splitchars: str = ";, \t", maxlinelen: int | None = None, linesep: str = "\n") -> str: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, __other: object) -> bool: ... @@ -27,5 +27,5 @@ def make_header( decoded_seq: Iterable[tuple[bytes | bytearray | str, str | None]], maxlinelen: int | None = None, header_name: str | None = None, - continuation_ws: str = ' ', + continuation_ws: str = " ", ) -> Header: ... diff --git a/stdlib/email/headerregistry.pyi b/stdlib/email/headerregistry.pyi index c0dfd2ac4176..df07e2458e81 100644 --- a/stdlib/email/headerregistry.pyi +++ b/stdlib/email/headerregistry.pyi @@ -169,7 +169,7 @@ class Address: @property def addr_spec(self) -> str: ... def __init__( - self, display_name: str = '', username: str | None = '', domain: str | None = '', addr_spec: str | None = None + self, display_name: str = "", username: str | None = "", domain: str | None = "", addr_spec: str | None = None ) -> None: ... def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/email/iterators.pyi b/stdlib/email/iterators.pyi index 67e782c3d436..d964d6843833 100644 --- a/stdlib/email/iterators.pyi +++ b/stdlib/email/iterators.pyi @@ -5,7 +5,7 @@ from email.message import Message __all__ = ["body_line_iterator", "typed_subpart_iterator", "walk"] def body_line_iterator(msg: Message, decode: bool = False) -> Iterator[str]: ... -def typed_subpart_iterator(msg: Message, maintype: str = 'text', subtype: str | None = None) -> Iterator[str]: ... +def typed_subpart_iterator(msg: Message, maintype: str = "text", subtype: str | None = None) -> Iterator[str]: ... def walk(self: Message) -> Iterator[Message]: ... # We include the seemingly private function because it is documented in the stdlib documentation. diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index ea339f67833f..5eef05828699 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -47,10 +47,14 @@ class Message: def get_content_subtype(self) -> str: ... def get_default_type(self) -> str: ... def set_default_type(self, ctype: str) -> None: ... - def get_params(self, failobj: _T = None, header: str = 'content-type', unquote: bool = True) -> list[tuple[str, str]] | _T: ... - def get_param(self, param: str, failobj: _T = None, header: str = 'content-type', unquote: bool = True) -> _T | _ParamType: ... - def del_param(self, param: str, header: str = 'content-type', requote: bool = True) -> None: ... - def set_type(self, type: str, header: str = 'Content-Type', requote: bool = True) -> None: ... + def get_params( + self, failobj: _T = None, header: str = "content-type", unquote: bool = True + ) -> list[tuple[str, str]] | _T: ... + def get_param( + self, param: str, failobj: _T = None, header: str = "content-type", unquote: bool = True + ) -> _T | _ParamType: ... + def del_param(self, param: str, header: str = "content-type", requote: bool = True) -> None: ... + def set_type(self, type: str, header: str = "Content-Type", requote: bool = True) -> None: ... def get_filename(self, failobj: _T = None) -> _T | str: ... def get_boundary(self, failobj: _T = None) -> _T | str: ... def set_boundary(self, boundary: str) -> None: ... @@ -68,10 +72,10 @@ class Message: self, param: str, value: str, - header: str = 'Content-Type', + header: str = "Content-Type", requote: bool = True, charset: str | None = None, - language: str = '', + language: str = "", replace: bool = False, ) -> None: ... def __init__(self, policy: Policy = ...) -> None: ... diff --git a/stdlib/email/mime/application.pyi b/stdlib/email/mime/application.pyi index 9266687f218b..a7ab9dc75ce2 100644 --- a/stdlib/email/mime/application.pyi +++ b/stdlib/email/mime/application.pyi @@ -9,7 +9,7 @@ class MIMEApplication(MIMENonMultipart): def __init__( self, _data: str | bytes | bytearray, - _subtype: str = 'octet-stream', + _subtype: str = "octet-stream", _encoder: Callable[[MIMEApplication], object] = ..., *, policy: Policy | None = None, diff --git a/stdlib/email/mime/message.pyi b/stdlib/email/mime/message.pyi index 4e21fbae7934..23cf58619ad9 100644 --- a/stdlib/email/mime/message.pyi +++ b/stdlib/email/mime/message.pyi @@ -5,4 +5,4 @@ from email.policy import Policy __all__ = ["MIMEMessage"] class MIMEMessage(MIMENonMultipart): - def __init__(self, _msg: Message, _subtype: str = 'rfc822', *, policy: Policy | None = None) -> None: ... + def __init__(self, _msg: Message, _subtype: str = "rfc822", *, policy: Policy | None = None) -> None: ... diff --git a/stdlib/email/mime/multipart.pyi b/stdlib/email/mime/multipart.pyi index 7beffbf61c3b..6163810ed94a 100644 --- a/stdlib/email/mime/multipart.pyi +++ b/stdlib/email/mime/multipart.pyi @@ -9,7 +9,7 @@ __all__ = ["MIMEMultipart"] class MIMEMultipart(MIMEBase): def __init__( self, - _subtype: str = 'mixed', + _subtype: str = "mixed", boundary: str | None = None, _subparts: Sequence[Message] | None = None, *, diff --git a/stdlib/email/mime/text.pyi b/stdlib/email/mime/text.pyi index 13308597c293..74d5ef4c5cae 100644 --- a/stdlib/email/mime/text.pyi +++ b/stdlib/email/mime/text.pyi @@ -4,4 +4,6 @@ from email.policy import Policy __all__ = ["MIMEText"] class MIMEText(MIMENonMultipart): - def __init__(self, _text: str, _subtype: str = 'plain', _charset: str | None = None, *, policy: Policy | None = None) -> None: ... + def __init__( + self, _text: str, _subtype: str = "plain", _charset: str | None = None, *, policy: Policy | None = None + ) -> None: ... diff --git a/stdlib/email/quoprimime.pyi b/stdlib/email/quoprimime.pyi index 2e38d8313a87..87d08eecc70c 100644 --- a/stdlib/email/quoprimime.pyi +++ b/stdlib/email/quoprimime.pyi @@ -19,9 +19,9 @@ def header_length(bytearray: Iterable[int]) -> int: ... def body_length(bytearray: Iterable[int]) -> int: ... def unquote(s: str | bytes | bytearray) -> str: ... def quote(c: str | bytes | bytearray) -> str: ... -def header_encode(header_bytes: bytes | bytearray, charset: str = 'iso-8859-1') -> str: ... -def body_encode(body: str, maxlinelen: int = 76, eol: str = '\n') -> str: ... -def decode(encoded: str, eol: str = '\n') -> str: ... +def header_encode(header_bytes: bytes | bytearray, charset: str = "iso-8859-1") -> str: ... +def body_encode(body: str, maxlinelen: int = 76, eol: str = "\n") -> str: ... +def decode(encoded: str, eol: str = "\n") -> str: ... def header_decode(s: str) -> str: ... body_decode = decode diff --git a/stdlib/email/utils.pyi b/stdlib/email/utils.pyi index e30673472efc..090ddf9e31bc 100644 --- a/stdlib/email/utils.pyi +++ b/stdlib/email/utils.pyi @@ -28,7 +28,7 @@ _PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None def quote(str: str) -> str: ... def unquote(str: str) -> str: ... def parseaddr(addr: str | None) -> tuple[str, str]: ... -def formataddr(pair: tuple[str | None, str], charset: str | Charset = 'utf-8') -> str: ... +def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") -> str: ... def getaddresses(fieldvalues: list[str]) -> list[tuple[str, str]]: ... @overload def parsedate(data: None) -> None: ... @@ -55,5 +55,5 @@ def localtime(dt: datetime.datetime | None = None, isdst: int = -1) -> datetime. def make_msgid(idstring: str | None = None, domain: str | None = None) -> str: ... def decode_rfc2231(s: str) -> tuple[str | None, str | None, str]: ... def encode_rfc2231(s: str, charset: str | None = None, language: str | None = None) -> str: ... -def collapse_rfc2231_value(value: _ParamType, errors: str = 'replace', fallback_charset: str = 'us-ascii') -> str: ... +def collapse_rfc2231_value(value: _ParamType, errors: str = "replace", fallback_charset: str = "us-ascii") -> str: ... def decode_params(params: list[tuple[str, str]]) -> list[tuple[str, _ParamType]]: ... diff --git a/stdlib/encodings/utf_8.pyi b/stdlib/encodings/utf_8.pyi index 82503e0aa4f7..0a420118e2ba 100644 --- a/stdlib/encodings/utf_8.pyi +++ b/stdlib/encodings/utf_8.pyi @@ -18,4 +18,4 @@ class StreamReader(codecs.StreamReader): def getregentry() -> codecs.CodecInfo: ... def encode(__str: str, __errors: str | None = ...) -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... diff --git a/stdlib/encodings/utf_8_sig.pyi b/stdlib/encodings/utf_8_sig.pyi index 9db6334de1b4..150fe22f8f6e 100644 --- a/stdlib/encodings/utf_8_sig.pyi +++ b/stdlib/encodings/utf_8_sig.pyi @@ -2,21 +2,21 @@ import codecs from _typeshed import ReadableBuffer class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors: str = 'strict') -> None: ... + def __init__(self, errors: str = "strict") -> None: ... def encode(self, input: str, final: bool = False) -> bytes: ... def getstate(self) -> int: ... # type: ignore[override] def setstate(self, state: int) -> None: ... # type: ignore[override] class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def __init__(self, errors: str = 'strict') -> None: ... + def __init__(self, errors: str = "strict") -> None: ... def _buffer_decode(self, input: ReadableBuffer, errors: str | None, final: bool) -> tuple[str, int]: ... class StreamWriter(codecs.StreamWriter): - def encode(self, input: str, errors: str | None = 'strict') -> tuple[bytes, int]: ... + def encode(self, input: str, errors: str | None = "strict") -> tuple[bytes, int]: ... class StreamReader(codecs.StreamReader): - def decode(self, input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... + def decode(self, input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... def getregentry() -> codecs.CodecInfo: ... -def encode(input: str, errors: str | None = 'strict') -> tuple[bytes, int]: ... -def decode(input: ReadableBuffer, errors: str | None = 'strict') -> tuple[str, int]: ... +def encode(input: str, errors: str | None = "strict") -> tuple[bytes, int]: ... +def decode(input: ReadableBuffer, errors: str | None = "strict") -> tuple[str, int]: ... diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index 495938c75b48..da83ffa96204 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -65,7 +65,7 @@ class FTP: ) -> None: ... def connect( - self, host: str = '', port: int = 0, timeout: float = -999, source_address: tuple[str, int] | None = None + self, host: str = "", port: int = 0, timeout: float = -999, source_address: tuple[str, int] | None = None ) -> str: ... def getwelcome(self) -> str: ... def set_debuglevel(self, level: int) -> None: ... @@ -85,7 +85,7 @@ class FTP: def sendeprt(self, host: str, port: int) -> str: ... def makeport(self) -> socket: ... def makepasv(self) -> tuple[str, int]: ... - def login(self, user: str = '', passwd: str = '', acct: str = '') -> str: ... + def login(self, user: str = "", passwd: str = "", acct: str = "") -> str: ... # In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers. def ntransfercmd(self, cmd: str, rest: int | str | None = None) -> tuple[socket, int]: ... def transfercmd(self, cmd: str, rest: int | str | None = None) -> socket: ... @@ -106,7 +106,7 @@ class FTP: def nlst(self, *args: str) -> list[str]: ... # Technically only the last arg can be a Callable but ... def dir(self, *args: str | Callable[[str], object]) -> None: ... - def mlsd(self, path: str = '', facts: Iterable[str] = ...) -> Iterator[tuple[str, dict[str, str]]]: ... + def mlsd(self, path: str = "", facts: Iterable[str] = ...) -> Iterator[tuple[str, dict[str, str]]]: ... def rename(self, fromname: str, toname: str) -> str: ... def delete(self, filename: str) -> str: ... def cwd(self, dirname: str) -> str: ... @@ -150,7 +150,7 @@ class FTP_TLS(FTP): keyfile: str | None certfile: str | None context: SSLContext - def login(self, user: str = '', passwd: str = '', acct: str = '', secure: bool = True) -> str: ... + def login(self, user: str = "", passwd: str = "", acct: str = "", secure: bool = True) -> str: ... def auth(self) -> str: ... def prot_p(self) -> str: ... def prot_c(self) -> str: ... @@ -161,5 +161,5 @@ def parse227(resp: str) -> tuple[str, int]: ... # undocumented def parse229(resp: str, peer: Any) -> tuple[str, int]: ... # undocumented def parse257(resp: str) -> str: ... # undocumented def ftpcp( - source: FTP, sourcename: str, target: FTP, targetname: str = '', type: Literal["A", "I"] = 'I' + source: FTP, sourcename: str, target: FTP, targetname: str = "", type: Literal["A", "I"] = "I" ) -> None: ... # undocumented diff --git a/stdlib/getopt.pyi b/stdlib/getopt.pyi index 6b7c6a33f017..14d63dbd6f99 100644 --- a/stdlib/getopt.pyi +++ b/stdlib/getopt.pyi @@ -6,6 +6,6 @@ def gnu_getopt(args: list[str], shortopts: str, longopts: list[str] = ...) -> tu class GetoptError(Exception): msg: str opt: str - def __init__(self, msg: str, opt: str = '') -> None: ... + def __init__(self, msg: str, opt: str = "") -> None: ... error = GetoptError diff --git a/stdlib/getpass.pyi b/stdlib/getpass.pyi index bfa48bdcab18..6104e0dedfee 100644 --- a/stdlib/getpass.pyi +++ b/stdlib/getpass.pyi @@ -2,7 +2,7 @@ from typing import TextIO __all__ = ["getpass", "getuser", "GetPassWarning"] -def getpass(prompt: str = 'Password: ', stream: TextIO | None = None) -> str: ... +def getpass(prompt: str = "Password: ", stream: TextIO | None = None) -> str: ... def getuser() -> str: ... class GetPassWarning(UserWarning): ... diff --git a/stdlib/hmac.pyi b/stdlib/hmac.pyi index cbb13e844e55..98fdfce561fe 100644 --- a/stdlib/hmac.pyi +++ b/stdlib/hmac.pyi @@ -30,7 +30,7 @@ class HMAC: block_size: int @property def name(self) -> str: ... - def __init__(self, key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod = '') -> None: ... + def __init__(self, key: bytes | bytearray, msg: ReadableBuffer | None = None, digestmod: _DigestMod = "") -> None: ... def update(self, msg: ReadableBuffer) -> None: ... def digest(self) -> bytes: ... def hexdigest(self) -> str: ... diff --git a/stdlib/http/cookies.pyi b/stdlib/http/cookies.pyi index 2a9dd61fb35a..e24ef9cbdd2e 100644 --- a/stdlib/http/cookies.pyi +++ b/stdlib/http/cookies.pyi @@ -38,7 +38,7 @@ class Morsel(dict[str, Any], Generic[_T]): @overload def update(self, values: Iterable[tuple[str, str]]) -> None: ... def isReservedKey(self, K: str) -> bool: ... - def output(self, attrs: list[str] | None = None, header: str = 'Set-Cookie:') -> str: ... + def output(self, attrs: list[str] | None = None, header: str = "Set-Cookie:") -> str: ... __str__ = output def js_output(self, attrs: list[str] | None = None) -> str: ... def OutputString(self, attrs: list[str] | None = None) -> str: ... @@ -51,7 +51,7 @@ class BaseCookie(dict[str, Morsel[_T]], Generic[_T]): def __init__(self, input: _DataType | None = None) -> None: ... def value_decode(self, val: str) -> _T: ... def value_encode(self, val: _T) -> str: ... - def output(self, attrs: list[str] | None = None, header: str = 'Set-Cookie:', sep: str = '\r\n') -> str: ... + def output(self, attrs: list[str] | None = None, header: str = "Set-Cookie:", sep: str = "\r\n") -> str: ... __str__ = output def js_output(self, attrs: list[str] | None = None) -> str: ... def load(self, rawdata: _DataType) -> None: ... diff --git a/stdlib/http/server.pyi b/stdlib/http/server.pyi index 9d6f526235d5..c9700f70e791 100644 --- a/stdlib/http/server.pyi +++ b/stdlib/http/server.pyi @@ -41,7 +41,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler): def send_response_only(self, code: int, message: str | None = None) -> None: ... def end_headers(self) -> None: ... def flush_headers(self) -> None: ... - def log_request(self, code: int | str = '-', size: int | str = '-') -> None: ... + def log_request(self, code: int | str = "-", size: int | str = "-") -> None: ... def log_error(self, format: str, *args: Any) -> None: ... def log_message(self, format: str, *args: Any) -> None: ... def version_string(self) -> str: ... diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 035b4c32306f..075e5185958d 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -77,11 +77,11 @@ class IMAP4: def getannotation(self, mailbox: str, entry: str, attribute: str) -> _CommandResults: ... def getquota(self, root: str) -> _CommandResults: ... def getquotaroot(self, mailbox: str) -> _CommandResults: ... - def list(self, directory: str = '""', pattern: str = '*') -> tuple[str, _AnyResponseData]: ... + def list(self, directory: str = '""', pattern: str = "*") -> tuple[str, _AnyResponseData]: ... def login(self, user: str, password: str) -> tuple[Literal["OK"], _list[bytes]]: ... def login_cram_md5(self, user: str, password: str) -> _CommandResults: ... def logout(self) -> tuple[str, _AnyResponseData]: ... - def lsub(self, directory: str = '""', pattern: str = '*') -> _CommandResults: ... + def lsub(self, directory: str = '""', pattern: str = "*") -> _CommandResults: ... def myrights(self, mailbox: str) -> _CommandResults: ... def namespace(self) -> _CommandResults: ... def noop(self) -> tuple[str, _list[bytes]]: ... @@ -89,7 +89,7 @@ class IMAP4: def proxyauth(self, user: str) -> _CommandResults: ... def rename(self, oldmailbox: str, newmailbox: str) -> _CommandResults: ... def search(self, charset: str | None, *criteria: str) -> _CommandResults: ... - def select(self, mailbox: str = 'INBOX', readonly: bool = False) -> tuple[str, _list[bytes | None]]: ... + def select(self, mailbox: str = "INBOX", readonly: bool = False) -> tuple[str, _list[bytes | None]]: ... def setacl(self, mailbox: str, who: str, what: str) -> _CommandResults: ... def setannotation(self, *args: str) -> _CommandResults: ... def setquota(self, root: str, limits: str) -> _CommandResults: ... diff --git a/stdlib/importlib/abc.pyi b/stdlib/importlib/abc.pyi index e9136c948511..78b79267d06e 100644 --- a/stdlib/importlib/abc.pyi +++ b/stdlib/importlib/abc.pyi @@ -52,7 +52,7 @@ class InspectLoader(Loader): def get_source(self, fullname: str) -> str | None: ... def exec_module(self, module: types.ModuleType) -> None: ... @staticmethod - def source_to_code(data: ReadableBuffer | str, path: str = '') -> types.CodeType: ... + def source_to_code(data: ReadableBuffer | str, path: str = "") -> types.CodeType: ... class ExecutionLoader(InspectLoader): @abstractmethod @@ -123,7 +123,7 @@ if sys.version_info >= (3, 9): @abstractmethod def open( self, - mode: OpenTextMode = 'r', + mode: OpenTextMode = "r", buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., diff --git a/stdlib/importlib/metadata/__init__.pyi b/stdlib/importlib/metadata/__init__.pyi index 8c4a747c5813..cc93aaeca365 100644 --- a/stdlib/importlib/metadata/__init__.pyi +++ b/stdlib/importlib/metadata/__init__.pyi @@ -106,7 +106,7 @@ if sys.version_info >= (3, 10): ) -> EntryPoints: ... class PackagePath(pathlib.PurePosixPath): - def read_text(self, encoding: str = 'utf-8') -> str: ... + def read_text(self, encoding: str = "utf-8") -> str: ... def read_binary(self) -> bytes: ... def locate(self) -> PathLike[str]: ... # The following attributes are not defined on PackagePath, but are dynamically added by Distribution.files: diff --git a/stdlib/importlib/resources.pyi b/stdlib/importlib/resources.pyi index 999bd65cd7bf..ba3d9b087754 100644 --- a/stdlib/importlib/resources.pyi +++ b/stdlib/importlib/resources.pyi @@ -23,9 +23,9 @@ else: Resource: TypeAlias = str | os.PathLike[Any] def open_binary(package: Package, resource: Resource) -> BinaryIO: ... -def open_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> TextIO: ... +def open_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> TextIO: ... def read_binary(package: Package, resource: Resource) -> bytes: ... -def read_text(package: Package, resource: Resource, encoding: str = 'utf-8', errors: str = 'strict') -> str: ... +def read_text(package: Package, resource: Resource, encoding: str = "utf-8", errors: str = "strict") -> str: ... def path(package: Package, resource: Resource) -> AbstractContextManager[Path]: ... def is_resource(package: Package, name: str) -> bool: ... def contents(package: Package) -> Iterator[str]: ... diff --git a/stdlib/lib2to3/pgen2/driver.pyi b/stdlib/lib2to3/pgen2/driver.pyi index 95b7eeb74d3c..9f6e4d6774ad 100644 --- a/stdlib/lib2to3/pgen2/driver.pyi +++ b/stdlib/lib2to3/pgen2/driver.pyi @@ -20,5 +20,5 @@ class Driver: def parse_string(self, text: str, debug: bool = False) -> _NL: ... def load_grammar( - gt: str = 'Grammar.txt', gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None + gt: str = "Grammar.txt", gp: str | None = None, save: bool = True, force: bool = False, logger: Logger | None = None ) -> Grammar: ... diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 7ac72abe96ee..d346739d4d58 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -43,4 +43,4 @@ class DFAState: def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override] -def generate_grammar(filename: StrPath = 'Grammar.txt') -> PgenGrammar: ... +def generate_grammar(filename: StrPath = "Grammar.txt") -> PgenGrammar: ... diff --git a/stdlib/lib2to3/refactor.pyi b/stdlib/lib2to3/refactor.pyi index a14ccaec8476..f1d89679aee7 100644 --- a/stdlib/lib2to3/refactor.pyi +++ b/stdlib/lib2to3/refactor.pyi @@ -68,4 +68,6 @@ class MultiprocessingUnsupported(Exception): ... class MultiprocessRefactoringTool(RefactoringTool): queue: Any | None output_lock: Any | None - def refactor(self, items: Iterable[str], write: bool = False, doctests_only: bool = False, num_processes: int = 1) -> None: ... + def refactor( + self, items: Iterable[str], write: bool = False, doctests_only: bool = False, num_processes: int = 1 + ) -> None: ... diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index 3f924fac76d4..06745cfaa1dd 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -369,7 +369,7 @@ class BufferingFormatter: class Filter: name: str # undocumented nlen: int # undocumented - def __init__(self, name: str = '') -> None: ... + def __init__(self, name: str = "") -> None: ... def filter(self, record: LogRecord) -> bool: ... class LogRecord: diff --git a/stdlib/logging/handlers.pyi b/stdlib/logging/handlers.pyi index adb6a1262123..f216d7b0d2d9 100644 --- a/stdlib/logging/handlers.pyi +++ b/stdlib/logging/handlers.pyi @@ -185,7 +185,7 @@ class SysLogHandler(Handler): def mapPriority(self, levelName: str) -> str: ... class NTEventLogHandler(Handler): - def __init__(self, appname: str, dllname: str | None = None, logtype: str = 'Application') -> None: ... + def __init__(self, appname: str, dllname: str | None = None, logtype: str = "Application") -> None: ... def getEventCategory(self, record: LogRecord) -> int: ... # TODO correct return value? def getEventType(self, record: LogRecord) -> int: ... @@ -238,7 +238,7 @@ class HTTPHandler(Handler): self, host: str, url: str, - method: str = 'GET', + method: str = "GET", secure: bool = False, credentials: tuple[str, str] | None = None, context: ssl.SSLContext | None = None, diff --git a/stdlib/lzma.pyi b/stdlib/lzma.pyi index 2e10074de85d..0f1fa8de4193 100644 --- a/stdlib/lzma.pyi +++ b/stdlib/lzma.pyi @@ -108,7 +108,7 @@ class LZMAFile(io.BufferedIOBase, IO[bytes]): def __init__( self, filename: _PathOrFile | None = None, - mode: str = 'r', + mode: str = "r", *, format: int | None = None, check: int = -1, diff --git a/stdlib/mailcap.pyi b/stdlib/mailcap.pyi index 0acf924e674b..5905f5826bf7 100644 --- a/stdlib/mailcap.pyi +++ b/stdlib/mailcap.pyi @@ -6,6 +6,6 @@ _Cap: TypeAlias = dict[str, str | int] __all__ = ["getcaps", "findmatch"] def findmatch( - caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = 'view', filename: str = '/dev/null', plist: Sequence[str] = ... + caps: Mapping[str, list[_Cap]], MIMEtype: str, key: str = "view", filename: str = "/dev/null", plist: Sequence[str] = ... ) -> tuple[str | None, _Cap | None]: ... def getcaps() -> dict[str, list[_Cap]]: ... diff --git a/stdlib/multiprocessing/dummy/__init__.pyi b/stdlib/multiprocessing/dummy/__init__.pyi index 43529c706349..5b2a33772de6 100644 --- a/stdlib/multiprocessing/dummy/__init__.pyi +++ b/stdlib/multiprocessing/dummy/__init__.pyi @@ -69,7 +69,9 @@ class Value: def Array(typecode: Any, sequence: Sequence[Any], lock: Any = True) -> array.array[Any]: ... def Manager() -> Any: ... -def Pool(processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ...) -> Any: ... +def Pool( + processes: int | None = None, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ... +) -> Any: ... def active_children() -> list[Any]: ... current_process = threading.current_thread diff --git a/stdlib/multiprocessing/pool.pyi b/stdlib/multiprocessing/pool.pyi index 0f109993f0bb..3e2d0c3cd51e 100644 --- a/stdlib/multiprocessing/pool.pyi +++ b/stdlib/multiprocessing/pool.pyi @@ -96,9 +96,7 @@ class Pool: error_callback: Callable[[BaseException], object] | None = None, ) -> MapResult[_T]: ... def imap(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = 1) -> IMapIterator[_T]: ... - def imap_unordered( - self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = 1 - ) -> IMapIterator[_T]: ... + def imap_unordered(self, func: Callable[[_S], _T], iterable: Iterable[_S], chunksize: int | None = 1) -> IMapIterator[_T]: ... def starmap(self, func: Callable[..., _T], iterable: Iterable[Iterable[Any]], chunksize: int | None = None) -> list[_T]: ... def starmap_async( self, diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 14f74ca7fe02..a8c1c4cfb93e 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -177,8 +177,8 @@ class Values: def _update_careful(self, dict: Mapping[str, Any]) -> None: ... def _update_loose(self, dict: Mapping[str, Any]) -> None: ... def ensure_value(self, attr: str, value: Any) -> Any: ... - def read_file(self, filename: str, mode: str = 'careful') -> None: ... - def read_module(self, modname: str, mode: str = 'careful') -> None: ... + def read_file(self, filename: str, mode: str = "careful") -> None: ... + def read_module(self, modname: str, mode: str = "careful") -> None: ... def __getattr__(self, name: str) -> Any: ... def __setattr__(self, __name: str, __value: Any) -> None: ... def __eq__(self, other: object) -> bool: ... @@ -203,7 +203,7 @@ class OptionParser(OptionContainer): option_list: Iterable[Option] | None = None, option_class: type[Option] = ..., version: str | None = None, - conflict_handler: str = 'error', + conflict_handler: str = "error", description: str | None = None, formatter: HelpFormatter | None = None, add_help_option: bool = True, diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index f3f49b9e8338..eea6d88b5467 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -726,7 +726,9 @@ def remove(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... def removedirs(name: StrOrBytesPath) -> None: ... def rename(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... def renames(old: StrOrBytesPath, new: StrOrBytesPath) -> None: ... -def replace(src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None) -> None: ... +def replace( + src: StrOrBytesPath, dst: StrOrBytesPath, *, src_dir_fd: int | None = None, dst_dir_fd: int | None = None +) -> None: ... def rmdir(path: StrOrBytesPath, *, dir_fd: int | None = None) -> None: ... class _ScandirIterator(Iterator[DirEntry[AnyStr]], AbstractContextManager[_ScandirIterator[AnyStr]]): @@ -745,7 +747,9 @@ def stat(path: FileDescriptorOrPath, *, dir_fd: int | None = None, follow_symlin if sys.platform != "win32": def statvfs(path: FileDescriptorOrPath) -> statvfs_result: ... # Unix only -def symlink(src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None) -> None: ... +def symlink( + src: StrOrBytesPath, dst: StrOrBytesPath, target_is_directory: bool = False, *, dir_fd: int | None = None +) -> None: ... if sys.platform != "win32": def sync() -> None: ... # Unix only @@ -850,7 +854,7 @@ class _wrap_close(_TextIOWrapper): def __init__(self, stream: _TextIOWrapper, proc: Popen[str]) -> None: ... def close(self) -> int | None: ... # type: ignore[override] -def popen(cmd: str, mode: str = 'r', buffering: int = -1) -> _wrap_close: ... +def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ... def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index de434f56285a..084ff45577ed 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -106,7 +106,7 @@ class Path(PurePath): @overload def open( self, - mode: OpenTextMode = 'r', + mode: OpenTextMode = "r", buffering: int = -1, encoding: str | None = None, errors: str | None = None, diff --git a/stdlib/pdb.pyi b/stdlib/pdb.pyi index 36b81ccbc988..a2b6636d8665 100644 --- a/stdlib/pdb.pyi +++ b/stdlib/pdb.pyi @@ -47,7 +47,7 @@ class Pdb(Bdb, Cmd): curframe_locals: Mapping[str, Any] def __init__( self, - completekey: str = 'tab', + completekey: str = "tab", stdin: IO[str] | None = None, stdout: IO[str] | None = None, skip: Iterable[str] | None = None, @@ -66,7 +66,7 @@ class Pdb(Bdb, Cmd): def checkline(self, filename: str, lineno: int) -> int: ... def _getval(self, arg: str) -> object: ... def print_stack_trace(self) -> None: ... - def print_stack_entry(self, frame_lineno: tuple[FrameType, int], prompt_prefix: str = '\n-> ') -> None: ... + def print_stack_entry(self, frame_lineno: tuple[FrameType, int], prompt_prefix: str = "\n-> ") -> None: ... def lookupmodule(self, filename: str) -> str | None: ... if sys.version_info < (3, 11): def _runscript(self, filename: str) -> None: ... diff --git a/stdlib/pickle.pyi b/stdlib/pickle.pyi index 7e005012321b..7ebab5a24d1f 100644 --- a/stdlib/pickle.pyi +++ b/stdlib/pickle.pyi @@ -119,16 +119,16 @@ if sys.version_info >= (3, 8): file: _ReadableFileobj, *, fix_imports: bool = True, - encoding: str = 'ASCII', - errors: str = 'strict', + encoding: str = "ASCII", + errors: str = "strict", buffers: Iterable[Any] | None = ..., ) -> Any: ... def loads( __data: ReadableBuffer, *, fix_imports: bool = True, - encoding: str = 'ASCII', - errors: str = 'strict', + encoding: str = "ASCII", + errors: str = "strict", buffers: Iterable[Any] | None = ..., ) -> Any: ... diff --git a/stdlib/pkgutil.pyi b/stdlib/pkgutil.pyi index cb4da81679f2..f9808c9e5de8 100644 --- a/stdlib/pkgutil.pyi +++ b/stdlib/pkgutil.pyi @@ -37,11 +37,11 @@ class ImpLoader: def find_loader(fullname: str) -> Loader | None: ... def get_importer(path_item: str) -> PathEntryFinder | None: ... def get_loader(module_or_name: str) -> Loader | None: ... -def iter_importers(fullname: str = '') -> Iterator[MetaPathFinder | PathEntryFinder]: ... -def iter_modules(path: Iterable[str] | None = None, prefix: str = '') -> Iterator[ModuleInfo]: ... +def iter_importers(fullname: str = "") -> Iterator[MetaPathFinder | PathEntryFinder]: ... +def iter_modules(path: Iterable[str] | None = None, prefix: str = "") -> Iterator[ModuleInfo]: ... def read_code(stream: SupportsRead[bytes]) -> Any: ... # undocumented def walk_packages( - path: Iterable[str] | None = None, prefix: str = '', onerror: Callable[[str], object] | None = None + path: Iterable[str] | None = None, prefix: str = "", onerror: Callable[[str], object] | None = None ) -> Iterator[ModuleInfo]: ... def get_data(package: str, resource: str) -> bytes | None: ... diff --git a/stdlib/platform.pyi b/stdlib/platform.pyi index f8fa5ea5c603..3dc408116005 100644 --- a/stdlib/platform.pyi +++ b/stdlib/platform.pyi @@ -7,7 +7,7 @@ if sys.version_info < (3, 8): from typing import NamedTuple if sys.version_info >= (3, 8): - def libc_ver(executable: str | None = None, lib: str = '', version: str = '', chunksize: int = 16384) -> tuple[str, str]: ... + def libc_ver(executable: str | None = None, lib: str = "", version: str = "", chunksize: int = 16384) -> tuple[str, str]: ... else: def libc_ver(executable: str = ..., lib: str = ..., version: str = ..., chunksize: int = ...) -> tuple[str, str]: ... @@ -24,20 +24,22 @@ if sys.version_info < (3, 8): distname: str = ..., version: str = ..., id: str = ..., supported_dists: tuple[str, ...] = ... ) -> tuple[str, str, str]: ... -def win32_ver(release: str = '', version: str = '', csd: str = '', ptype: str = '') -> tuple[str, str, str, str]: ... +def win32_ver(release: str = "", version: str = "", csd: str = "", ptype: str = "") -> tuple[str, str, str, str]: ... if sys.version_info >= (3, 8): def win32_edition() -> str: ... def win32_is_iot() -> bool: ... def mac_ver( - release: str = '', versioninfo: tuple[str, str, str] = ..., machine: str = '' + release: str = "", versioninfo: tuple[str, str, str] = ..., machine: str = "" ) -> tuple[str, tuple[str, str, str], str]: ... def java_ver( - release: str = '', vendor: str = '', vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... + release: str = "", vendor: str = "", vminfo: tuple[str, str, str] = ..., osinfo: tuple[str, str, str] = ... ) -> tuple[str, str, tuple[str, str, str], tuple[str, str, str]]: ... def system_alias(system: str, release: str, version: str) -> tuple[str, str, str]: ... -def architecture(executable: str = '/Users/jelle/py/venvs/py311/bin/python', bits: str = '', linkage: str = '') -> tuple[str, str]: ... +def architecture( + executable: str = "/Users/jelle/py/venvs/py311/bin/python", bits: str = "", linkage: str = "" +) -> tuple[str, str]: ... class uname_result(NamedTuple): system: str diff --git a/stdlib/plistlib.pyi b/stdlib/plistlib.pyi index 576dcfb7cf30..583c89ab4ca8 100644 --- a/stdlib/plistlib.pyi +++ b/stdlib/plistlib.pyi @@ -104,4 +104,4 @@ if sys.version_info >= (3, 8): def __eq__(self, other: object) -> bool: ... class InvalidFileException(ValueError): - def __init__(self, message: str = 'Invalid file') -> None: ... + def __init__(self, message: str = "Invalid file") -> None: ... diff --git a/stdlib/pstats.pyi b/stdlib/pstats.pyi index 60d7a40623c2..f4f331934565 100644 --- a/stdlib/pstats.pyi +++ b/stdlib/pstats.pyi @@ -74,6 +74,6 @@ class Stats: def print_callees(self: Self, *amount: _Selector) -> Self: ... def print_callers(self: Self, *amount: _Selector) -> Self: ... def print_call_heading(self, name_size: int, column_title: str) -> None: ... - def print_call_line(self, name_size: int, source: str, call_dict: dict[str, Any], arrow: str = '->') -> None: ... + def print_call_line(self, name_size: int, source: str, call_dict: dict[str, Any], arrow: str = "->") -> None: ... def print_title(self) -> None: ... def print_line(self, func: str) -> None: ... diff --git a/stdlib/py_compile.pyi b/stdlib/py_compile.pyi index f20b78c12f3b..80222021fbc2 100644 --- a/stdlib/py_compile.pyi +++ b/stdlib/py_compile.pyi @@ -9,7 +9,7 @@ class PyCompileError(Exception): exc_value: BaseException file: str msg: str - def __init__(self, exc_type: type[BaseException], exc_value: BaseException, file: str, msg: str = '') -> None: ... + def __init__(self, exc_type: type[BaseException], exc_value: BaseException, file: str, msg: str = "") -> None: ... class PycInvalidationMode(enum.Enum): TIMESTAMP: int diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 873f32e0c745..9319aef1233a 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -58,7 +58,7 @@ class Doc: def docproperty(self, object: object, name: str | None = None, *args: Any) -> str: ... @abstractmethod def docdata(self, object: object, name: str | None = None, *args: Any) -> str: ... - def getdocloc(self, object: object, basedir: str = '/Users/jelle/.pyenv/versions/3.11.1/lib/python3.11') -> str | None: ... + def getdocloc(self, object: object, basedir: str = "/Users/jelle/.pyenv/versions/3.11.1/lib/python3.11") -> str | None: ... class HTMLRepr(Repr): def escape(self, text: str) -> str: ... @@ -157,10 +157,10 @@ class TextDoc(Doc): _repr_instance: TextRepr = ... repr = _repr_instance.repr def bold(self, text: str) -> str: ... - def indent(self, text: str, prefix: str = ' ') -> str: ... + def indent(self, text: str, prefix: str = " ") -> str: ... def section(self, title: str, contents: str) -> str: ... def formattree( - self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = None, prefix: str = '' + self, tree: list[tuple[type, tuple[type, ...]] | list[Any]], modname: str, parent: type | None = None, prefix: str = "" ) -> str: ... def docmodule(self, object: object, name: str | None = None, mod: Any | None = None) -> str: ... # type: ignore[override] def docclass(self, object: object, name: str | None = None, mod: str | None = None, *ignored: Any) -> str: ... @@ -192,10 +192,17 @@ text: TextDoc html: HTMLDoc def resolve(thing: str | object, forceload: bool = ...) -> tuple[object, str] | None: ... -def render_doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = ..., renderer: Doc | None = None) -> str: ... -def doc(thing: str | object, title: str = 'Python Library Documentation: %s', forceload: bool = ..., output: SupportsWrite[str] | None = None) -> None: ... +def render_doc( + thing: str | object, title: str = "Python Library Documentation: %s", forceload: bool = ..., renderer: Doc | None = None +) -> str: ... +def doc( + thing: str | object, + title: str = "Python Library Documentation: %s", + forceload: bool = ..., + output: SupportsWrite[str] | None = None, +) -> None: ... def writedoc(thing: str | object, forceload: bool = ...) -> None: ... -def writedocs(dir: str, pkgpath: str = '', done: Any | None = None) -> None: ... +def writedocs(dir: str, pkgpath: str = "", done: Any | None = None) -> None: ... class Helper: keywords: dict[str, str | tuple[str, str]] @@ -215,9 +222,9 @@ class Helper: def listkeywords(self) -> None: ... def listsymbols(self) -> None: ... def listtopics(self) -> None: ... - def showtopic(self, topic: str, more_xrefs: str = '') -> None: ... + def showtopic(self, topic: str, more_xrefs: str = "") -> None: ... def showsymbol(self, symbol: str) -> None: ... - def listmodules(self, key: str = '') -> None: ... + def listmodules(self, key: str = "") -> None: ... help: Helper diff --git a/stdlib/re.pyi b/stdlib/re.pyi index a1a2656baa6f..a6094d457575 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -115,15 +115,21 @@ class Pattern(Generic[AnyStr]): @overload def search(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... @overload - def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Match[bytes] | None: ... + def search( + self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 + ) -> Match[bytes] | None: ... @overload def match(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... @overload - def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Match[bytes] | None: ... + def match( + self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 + ) -> Match[bytes] | None: ... @overload def fullmatch(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... @overload - def fullmatch(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Match[bytes] | None: ... + def fullmatch( + self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 + ) -> Match[bytes] | None: ... @overload def split(self: Pattern[str], string: str, maxsplit: int = 0) -> list[str | Any]: ... @overload @@ -136,7 +142,9 @@ class Pattern(Generic[AnyStr]): @overload def finditer(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Iterator[Match[str]]: ... @overload - def finditer(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> Iterator[Match[bytes]]: ... + def finditer( + self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 + ) -> Iterator[Match[bytes]]: ... @overload def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> str: ... @overload diff --git a/stdlib/reprlib.pyi b/stdlib/reprlib.pyi index 4f2126d1e32e..21c8a5cd4e0c 100644 --- a/stdlib/reprlib.pyi +++ b/stdlib/reprlib.pyi @@ -8,7 +8,7 @@ __all__ = ["Repr", "repr", "recursive_repr"] _ReprFunc: TypeAlias = Callable[[Any], str] -def recursive_repr(fillvalue: str = '...') -> Callable[[_ReprFunc], _ReprFunc]: ... +def recursive_repr(fillvalue: str = "...") -> Callable[[_ReprFunc], _ReprFunc]: ... class Repr: maxlevel: int diff --git a/stdlib/shelve.pyi b/stdlib/shelve.pyi index ec48c51c8216..d55e08bffa16 100644 --- a/stdlib/shelve.pyi +++ b/stdlib/shelve.pyi @@ -11,7 +11,7 @@ _VT = TypeVar("_VT") class Shelf(MutableMapping[str, _VT]): def __init__( - self, dict: MutableMapping[bytes, bytes], protocol: int | None = None, writeback: bool = False, keyencoding: str = 'utf-8' + self, dict: MutableMapping[bytes, bytes], protocol: int | None = None, writeback: bool = False, keyencoding: str = "utf-8" ) -> None: ... def __iter__(self) -> Iterator[str]: ... def __len__(self) -> int: ... @@ -38,6 +38,6 @@ class BsdDbShelf(Shelf[_VT]): def last(self) -> tuple[str, _VT]: ... class DbfilenameShelf(Shelf[_VT]): - def __init__(self, filename: str, flag: _TFlags = 'c', protocol: int | None = None, writeback: bool = False) -> None: ... + def __init__(self, filename: str, flag: _TFlags = "c", protocol: int | None = None, writeback: bool = False) -> None: ... -def open(filename: str, flag: _TFlags = 'c', protocol: int | None = None, writeback: bool = False) -> Shelf[Any]: ... +def open(filename: str, flag: _TFlags = "c", protocol: int | None = None, writeback: bool = False) -> Shelf[Any]: ... diff --git a/stdlib/smtplib.pyi b/stdlib/smtplib.pyi index ab7e7390494a..b58808f453fe 100644 --- a/stdlib/smtplib.pyi +++ b/stdlib/smtplib.pyi @@ -89,7 +89,7 @@ class SMTP: local_hostname: str def __init__( self, - host: str = '', + host: str = "", port: int = 0, local_hostname: str | None = None, timeout: float = ..., @@ -100,15 +100,15 @@ class SMTP: self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None ) -> None: ... def set_debuglevel(self, debuglevel: int) -> None: ... - def connect(self, host: str = 'localhost', port: int = 0, source_address: _SourceAddress | None = None) -> _Reply: ... + def connect(self, host: str = "localhost", port: int = 0, source_address: _SourceAddress | None = None) -> _Reply: ... def send(self, s: ReadableBuffer | str) -> None: ... - def putcmd(self, cmd: str, args: str = '') -> None: ... + def putcmd(self, cmd: str, args: str = "") -> None: ... def getreply(self) -> _Reply: ... - def docmd(self, cmd: str, args: str = '') -> _Reply: ... - def helo(self, name: str = '') -> _Reply: ... - def ehlo(self, name: str = '') -> _Reply: ... + def docmd(self, cmd: str, args: str = "") -> _Reply: ... + def helo(self, name: str = "") -> _Reply: ... + def ehlo(self, name: str = "") -> _Reply: ... def has_extn(self, opt: str) -> bool: ... - def help(self, args: str = '') -> bytes: ... + def help(self, args: str = "") -> bytes: ... def rset(self) -> _Reply: ... def noop(self) -> _Reply: ... def mail(self, sender: str, options: Sequence[str] = ...) -> _Reply: ... @@ -154,7 +154,7 @@ class SMTP_SSL(SMTP): context: SSLContext def __init__( self, - host: str = '', + host: str = "", port: int = 0, local_hostname: str | None = None, keyfile: str | None = None, diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index 5334ef1842e1..66a99d67df06 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -716,7 +716,7 @@ class socket(_socket.socket): @overload def makefile( self, - mode: Literal["r", "w", "rw", "wr", ""] = 'r', + mode: Literal["r", "w", "rw", "wr", ""] = "r", buffering: int | None = None, *, encoding: str | None = None, @@ -760,7 +760,7 @@ class SocketIO(RawIOBase): @property def mode(self) -> Literal["rb", "wb", "rwb"]: ... -def getfqdn(name: str = '') -> str: ... +def getfqdn(name: str = "") -> str: ... if sys.version_info >= (3, 11): def create_connection( @@ -784,10 +784,5 @@ if sys.version_info >= (3, 8): # the 5th tuple item is an address def getaddrinfo( - host: bytes | str | None, - port: bytes | str | int | None, - family: int = 0, - type: int = 0, - proto: int = 0, - flags: int = 0, + host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0 ) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index 714ef41fc2a0..d4799e62d54b 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -348,7 +348,7 @@ class Connection: *, pages: int = -1, progress: Callable[[int, int, int], object] | None = None, - name: str = 'main', + name: str = "main", sleep: float = ..., ) -> None: ... if sys.version_info >= (3, 11): diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index ddcfcfb91a8c..2795522f9ba1 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -340,7 +340,7 @@ class SSLSocket(socket.socket): def cipher(self) -> tuple[str, str, int] | None: ... def shared_ciphers(self) -> list[tuple[str, str, int]] | None: ... def compression(self) -> str | None: ... - def get_channel_binding(self, cb_type: str = 'tls-unique') -> bytes | None: ... + def get_channel_binding(self, cb_type: str = "tls-unique") -> bytes | None: ... def selected_alpn_protocol(self) -> str | None: ... def selected_npn_protocol(self) -> str | None: ... def accept(self) -> tuple[SSLSocket, socket._RetAddress]: ... @@ -385,7 +385,10 @@ class SSLContext: ) -> None: ... def load_default_certs(self, purpose: Purpose = ...) -> None: ... def load_verify_locations( - self, cafile: StrOrBytesPath | None = None, capath: StrOrBytesPath | None = None, cadata: str | ReadableBuffer | None = None + self, + cafile: StrOrBytesPath | None = None, + capath: StrOrBytesPath | None = None, + cadata: str | ReadableBuffer | None = None, ) -> None: ... @overload def get_ca_certs(self, binary_form: Literal[False] = False) -> list[_PeerCertRetDictType]: ... @@ -447,7 +450,7 @@ class SSLObject: def do_handshake(self) -> None: ... def unwrap(self) -> None: ... def version(self) -> str | None: ... - def get_channel_binding(self, cb_type: str = 'tls-unique') -> bytes | None: ... + def get_channel_binding(self, cb_type: str = "tls-unique") -> bytes | None: ... if sys.version_info >= (3, 8): def verify_client_post_handshake(self) -> None: ... diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index d4c83376177b..99dba9a58217 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -73,7 +73,7 @@ def pvariance(data: Iterable[_NumberT], mu: _NumberT | None = None) -> _NumberT: if sys.version_info >= (3, 8): def quantiles( - data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = 'exclusive' + data: Iterable[_NumberT], *, n: int = 4, method: Literal["inclusive", "exclusive"] = "exclusive" ) -> list[_NumberT]: ... def stdev(data: Iterable[_NumberT], xbar: _NumberT | None = None) -> _NumberT: ... diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index 712f15d4a28a..9b2a9ec706b7 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -1822,7 +1822,9 @@ DEVNULL: int class SubprocessError(Exception): ... class TimeoutExpired(SubprocessError): - def __init__(self, cmd: _CMD, timeout: float, output: str | bytes | None = None, stderr: str | bytes | None = None) -> None: ... + def __init__( + self, cmd: _CMD, timeout: float, output: str | bytes | None = None, stderr: str | bytes | None = None + ) -> None: ... # morally: _CMD cmd: Any timeout: float diff --git a/stdlib/sysconfig.pyi b/stdlib/sysconfig.pyi index ed6c14e2ec91..a1ce173cc4f9 100644 --- a/stdlib/sysconfig.pyi +++ b/stdlib/sysconfig.pyi @@ -28,8 +28,8 @@ if sys.version_info >= (3, 10): def get_preferred_scheme(key: Literal["prefix", "home", "user"]) -> str: ... def get_path_names() -> tuple[str, ...]: ... -def get_path(name: str, scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... -def get_paths(scheme: str = 'venv', vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... +def get_path(name: str, scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> str: ... +def get_paths(scheme: str = "venv", vars: dict[str, Any] | None = None, expand: bool = True) -> dict[str, str]: ... def get_python_version() -> str: ... def get_platform() -> str: ... diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index 0071ebe217f3..a465df6cb1f8 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -90,7 +90,7 @@ ENCODING: str def open( name: StrOrBytesPath | None = None, - mode: str = 'r', + mode: str = "r", fileobj: IO[bytes] | None = None, # depends on mode bufsize: int = 10240, *, @@ -128,14 +128,14 @@ class TarFile: def __init__( self, name: StrOrBytesPath | None = None, - mode: Literal["r", "a", "w", "x"] = 'r', + mode: Literal["r", "a", "w", "x"] = "r", fileobj: _Fileobj | None = None, format: int | None = None, tarinfo: type[TarInfo] | None = None, dereference: bool | None = None, ignore_zeros: bool | None = None, encoding: str | None = None, - errors: str = 'surrogateescape', + errors: str = "surrogateescape", pax_headers: Mapping[str, str] | None = None, debug: int | None = None, errorlevel: int | None = None, @@ -150,7 +150,7 @@ class TarFile: def open( cls: type[Self], name: StrOrBytesPath | None = None, - mode: str = 'r', + mode: str = "r", fileobj: IO[bytes] | None = None, # depends on mode bufsize: int = 10240, *, @@ -168,7 +168,7 @@ class TarFile: def taropen( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r", "a", "w", "x"] = 'r', + mode: Literal["r", "a", "w", "x"] = "r", fileobj: _Fileobj | None = None, *, compresslevel: int = ..., @@ -186,7 +186,7 @@ class TarFile: def gzopen( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r"] = 'r', + mode: Literal["r"] = "r", fileobj: _GzipReadableFileobj | None = None, compresslevel: int = 9, *, @@ -240,7 +240,7 @@ class TarFile: def bz2open( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r"] = 'r', + mode: Literal["r"] = "r", fileobj: _Bz2ReadableFileobj | None = None, compresslevel: int = 9, *, @@ -257,7 +257,7 @@ class TarFile: def xzopen( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r", "w", "x"] = 'r', + mode: Literal["r", "w", "x"] = "r", fileobj: IO[bytes] | None = None, preset: int | None = None, *, @@ -276,10 +276,10 @@ class TarFile: def list(self, verbose: bool = True, *, members: _list[TarInfo] | None = None) -> None: ... def next(self) -> TarInfo | None: ... def extractall( - self, path: StrOrBytesPath = '.', members: Iterable[TarInfo] | None = None, *, numeric_owner: bool = False + self, path: StrOrBytesPath = ".", members: Iterable[TarInfo] | None = None, *, numeric_owner: bool = False ) -> None: ... def extract( - self, member: str | TarInfo, path: StrOrBytesPath = '', set_attrs: bool = True, *, numeric_owner: bool = False + self, member: str | TarInfo, path: StrOrBytesPath = "", set_attrs: bool = True, *, numeric_owner: bool = False ) -> None: ... def _extract_member( self, tarinfo: TarInfo, targetpath: str, set_attrs: bool = True, numeric_owner: bool = False @@ -344,7 +344,7 @@ class TarInfo: uname: str gname: str pax_headers: Mapping[str, str] - def __init__(self, name: str = '') -> None: ... + def __init__(self, name: str = "") -> None: ... @classmethod def frombuf(cls: Type[Self], buf: bytes | bytearray, encoding: str, errors: str) -> Self: ... @classmethod @@ -354,7 +354,7 @@ class TarInfo: @linkpath.setter def linkpath(self, linkname: str) -> None: ... def get_info(self) -> Mapping[str, str | int | bytes | Mapping[str, str]]: ... - def tobuf(self, format: int | None = 2, encoding: str | None = 'utf-8', errors: str = 'surrogateescape') -> bytes: ... + def tobuf(self, format: int | None = 2, encoding: str | None = "utf-8", errors: str = "surrogateescape") -> bytes: ... def create_ustar_header( self, info: Mapping[str, str | int | bytes | Mapping[str, str]], encoding: str, errors: str ) -> bytes: ... diff --git a/stdlib/tempfile.pyi b/stdlib/tempfile.pyi index 1d5feb26d9af..49162c444c78 100644 --- a/stdlib/tempfile.pyi +++ b/stdlib/tempfile.pyi @@ -399,7 +399,7 @@ def mkstemp( def mkdtemp(suffix: str | None = ..., prefix: str | None = ..., dir: StrPath | None = ...) -> str: ... # type: ignore[misc] @overload def mkdtemp(suffix: bytes | None = ..., prefix: bytes | None = ..., dir: BytesPath | None = ...) -> bytes: ... -def mktemp(suffix: str = '', prefix: str = 'tmp', dir: StrPath | None = None) -> str: ... +def mktemp(suffix: str = "", prefix: str = "tmp", dir: StrPath | None = None) -> str: ... def gettempdirb() -> bytes: ... def gettempprefixb() -> bytes: ... def gettempdir() -> str: ... diff --git a/stdlib/textwrap.pyi b/stdlib/textwrap.pyi index f3017d12cd7e..e4a5b7899e8e 100644 --- a/stdlib/textwrap.pyi +++ b/stdlib/textwrap.pyi @@ -28,8 +28,8 @@ class TextWrapper: def __init__( self, width: int = 70, - initial_indent: str = '', - subsequent_indent: str = '', + initial_indent: str = "", + subsequent_indent: str = "", expand_tabs: bool = True, replace_whitespace: bool = True, fix_sentence_endings: bool = False, @@ -39,7 +39,7 @@ class TextWrapper: tabsize: int = 8, *, max_lines: int | None = None, - placeholder: str = ' [...]', + placeholder: str = " [...]", ) -> None: ... # Private methods *are* part of the documented API for subclasses. def _munge_whitespace(self, text: str) -> str: ... diff --git a/stdlib/timeit.pyi b/stdlib/timeit.pyi index 01a9d6da34f3..a5da943c8484 100644 --- a/stdlib/timeit.pyi +++ b/stdlib/timeit.pyi @@ -11,7 +11,7 @@ default_timer: _Timer class Timer: def __init__( - self, stmt: _Stmt = 'pass', setup: _Stmt = 'pass', timer: _Timer = ..., globals: dict[str, Any] | None = None + self, stmt: _Stmt = "pass", setup: _Stmt = "pass", timer: _Timer = ..., globals: dict[str, Any] | None = None ) -> None: ... def print_exc(self, file: IO[str] | None = None) -> None: ... def timeit(self, number: int = 1000000) -> float: ... @@ -19,11 +19,11 @@ class Timer: def autorange(self, callback: Callable[[int, float], object] | None = None) -> tuple[int, float]: ... def timeit( - stmt: _Stmt = 'pass', setup: _Stmt = 'pass', timer: _Timer = ..., number: int = 1000000, globals: dict[str, Any] | None = None + stmt: _Stmt = "pass", setup: _Stmt = "pass", timer: _Timer = ..., number: int = 1000000, globals: dict[str, Any] | None = None ) -> float: ... def repeat( - stmt: _Stmt = 'pass', - setup: _Stmt = 'pass', + stmt: _Stmt = "pass", + setup: _Stmt = "pass", timer: _Timer = ..., repeat: int = 5, number: int = 1000000, diff --git a/stdlib/tracemalloc.pyi b/stdlib/tracemalloc.pyi index b551fb113d39..17a86196077f 100644 --- a/stdlib/tracemalloc.pyi +++ b/stdlib/tracemalloc.pyi @@ -23,7 +23,12 @@ class Filter(BaseFilter): def filename_pattern(self) -> str: ... all_frames: bool def __init__( - self, inclusive: bool, filename_pattern: str, lineno: int | None = None, all_frames: bool = False, domain: int | None = None + self, + inclusive: bool, + filename_pattern: str, + lineno: int | None = None, + all_frames: bool = False, + domain: int | None = None, ) -> None: ... class Statistic: diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 6153ac193fb7..f6526a44a4ef 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -215,7 +215,9 @@ if sys.version_info >= (3, 10): __bound__: Any | None __covariant__: bool __contravariant__: bool - def __init__(self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False) -> None: ... + def __init__( + self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False + ) -> None: ... @property def args(self) -> ParamSpecArgs: ... @property diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index f645640838ea..723fe0c30b8c 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -94,7 +94,7 @@ class TestCase: _testMethodName: str # undocumented _testMethodDoc: str - def __init__(self, methodName: str = 'runTest') -> None: ... + def __init__(self, methodName: str = "runTest") -> None: ... def __eq__(self, other: object) -> bool: ... def setUp(self) -> None: ... def tearDown(self) -> None: ... diff --git a/stdlib/unittest/loader.pyi b/stdlib/unittest/loader.pyi index ab8b70dbd58f..f3850c939d07 100644 --- a/stdlib/unittest/loader.pyi +++ b/stdlib/unittest/loader.pyi @@ -22,7 +22,9 @@ class TestLoader: def loadTestsFromName(self, name: str, module: ModuleType | None = None) -> unittest.suite.TestSuite: ... def loadTestsFromNames(self, names: Sequence[str], module: ModuleType | None = None) -> unittest.suite.TestSuite: ... def getTestCaseNames(self, testCaseClass: type[unittest.case.TestCase]) -> Sequence[str]: ... - def discover(self, start_dir: str, pattern: str = 'test*.py', top_level_dir: str | None = None) -> unittest.suite.TestSuite: ... + def discover( + self, start_dir: str, pattern: str = "test*.py", top_level_dir: str | None = None + ) -> unittest.suite.TestSuite: ... def _match_path(self, path: str, full_path: str, pattern: str) -> bool: ... defaultTestLoader: TestLoader @@ -35,10 +37,10 @@ def getTestCaseNames( ) -> Sequence[str]: ... def makeSuite( testCaseClass: type[unittest.case.TestCase], - prefix: str = 'test', + prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ..., ) -> unittest.suite.TestSuite: ... def findTestCases( - module: ModuleType, prefix: str = 'test', sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... + module: ModuleType, prefix: str = "test", sortUsing: _SortComparisonMethod = ..., suiteClass: _SuiteClass = ... ) -> unittest.suite.TestSuite: ... diff --git a/stdlib/unittest/main.pyi b/stdlib/unittest/main.pyi index d32098f89aad..6d970c920096 100644 --- a/stdlib/unittest/main.pyi +++ b/stdlib/unittest/main.pyi @@ -25,7 +25,7 @@ class TestProgram: testNamePatterns: list[str] | None def __init__( self, - module: None | str | ModuleType = '__main__', + module: None | str | ModuleType = "__main__", defaultTest: str | Iterable[str] | None = None, argv: list[str] | None = None, testRunner: type[_TestRunner] | _TestRunner | None = None, diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 3e87a687a191..d86afc7dc8f7 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -70,7 +70,7 @@ class _Call(tuple[Any, ...]): def __new__( cls: type[Self], value: _CallValue = ..., - name: str | None = '', + name: str | None = "", parent: Any | None = None, two: bool = False, from_kall: bool = True, @@ -79,7 +79,12 @@ class _Call(tuple[Any, ...]): parent: Any from_kall: Any def __init__( - self, value: _CallValue = ..., name: str | None = None, parent: Any | None = None, two: bool = False, from_kall: bool = True + self, + value: _CallValue = ..., + name: str | None = None, + parent: Any | None = None, + two: bool = False, + from_kall: bool = True, ) -> None: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, __other: object) -> bool: ... @@ -112,7 +117,7 @@ class NonCallableMock(Base, Any): spec_set: list[str] | object | type[object] | None = None, parent: NonCallableMock | None = None, _spec_state: Any | None = None, - _new_name: str = '', + _new_name: str = "", _new_parent: NonCallableMock | None = None, _spec_as_instance: bool = False, _eat_self: bool | None = None, @@ -173,7 +178,7 @@ class CallableMixin(Base): spec_set: Any | None = None, parent: Any | None = None, _spec_state: Any | None = None, - _new_name: Any = '', + _new_name: Any = "", _new_parent: Any | None = None, **kwargs: Any, ) -> None: ... @@ -423,7 +428,7 @@ class _SpecState: instance: Any = False, ) -> None: ... -def mock_open(mock: Any | None = None, read_data: Any = '') -> Any: ... +def mock_open(mock: Any | None = None, read_data: Any = "") -> Any: ... class PropertyMock(Mock): if sys.version_info >= (3, 8): diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 6a963d17fd98..5aec2b3133cc 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -43,10 +43,10 @@ class _ResultMixinBase(Generic[AnyStr]): def geturl(self) -> AnyStr: ... class _ResultMixinStr(_ResultMixinBase[str]): - def encode(self, encoding: str = 'ascii', errors: str = 'strict') -> _ResultMixinBytes: ... + def encode(self, encoding: str = "ascii", errors: str = "strict") -> _ResultMixinBytes: ... class _ResultMixinBytes(_ResultMixinBase[bytes]): - def decode(self, encoding: str = 'ascii', errors: str = 'strict') -> _ResultMixinStr: ... + def decode(self, encoding: str = "ascii", errors: str = "strict") -> _ResultMixinStr: ... class _NetlocResultMixinBase(Generic[AnyStr]): @property @@ -117,38 +117,38 @@ def parse_qs( qs: AnyStr | None, keep_blank_values: bool = False, strict_parsing: bool = False, - encoding: str = 'utf-8', - errors: str = 'replace', + encoding: str = "utf-8", + errors: str = "replace", max_num_fields: int | None = None, - separator: str = '&', + separator: str = "&", ) -> dict[AnyStr, list[AnyStr]]: ... def parse_qsl( qs: AnyStr | None, keep_blank_values: bool = False, strict_parsing: bool = False, - encoding: str = 'utf-8', - errors: str = 'replace', + encoding: str = "utf-8", + errors: str = "replace", max_num_fields: int | None = None, - separator: str = '&', + separator: str = "&", ) -> list[tuple[AnyStr, AnyStr]]: ... @overload def quote(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... -def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = '/') -> str: ... +def quote_from_bytes(bs: bytes | bytearray, safe: str | Iterable[int] = "/") -> str: ... @overload def quote_plus(string: str, safe: str | Iterable[int] = ..., encoding: str | None = ..., errors: str | None = ...) -> str: ... @overload def quote_plus(string: bytes | bytearray, safe: str | Iterable[int] = ...) -> str: ... if sys.version_info >= (3, 9): - def unquote(string: str | bytes, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... + def unquote(string: str | bytes, encoding: str = "utf-8", errors: str = "replace") -> str: ... else: def unquote(string: str, encoding: str = ..., errors: str = ...) -> str: ... def unquote_to_bytes(string: str | bytes | bytearray) -> bytes: ... -def unquote_plus(string: str, encoding: str = 'utf-8', errors: str = 'replace') -> str: ... +def unquote_plus(string: str, encoding: str = "utf-8", errors: str = "replace") -> str: ... @overload def urldefrag(url: str) -> DefragResult: ... @overload @@ -159,7 +159,7 @@ _Q = TypeVar("_Q", bound=str | Iterable[int]) def urlencode( query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]], doseq: bool = False, - safe: _Q = '', + safe: _Q = "", encoding: str | None = None, errors: str | None = None, quote_via: Callable[[AnyStr, _Q, str, str], str] = ..., diff --git a/stdlib/urllib/robotparser.pyi b/stdlib/urllib/robotparser.pyi index 2a59561998ba..d218c3dc6c0f 100644 --- a/stdlib/urllib/robotparser.pyi +++ b/stdlib/urllib/robotparser.pyi @@ -9,7 +9,7 @@ class RequestRate(NamedTuple): seconds: int class RobotFileParser: - def __init__(self, url: str = '') -> None: ... + def __init__(self, url: str = "") -> None: ... def set_url(self, url: str) -> None: ... def read(self) -> None: ... def parse(self, lines: Iterable[str]) -> None: ... diff --git a/stdlib/uu.pyi b/stdlib/uu.pyi index 363439a80e0a..20e79bf3fec9 100644 --- a/stdlib/uu.pyi +++ b/stdlib/uu.pyi @@ -7,5 +7,7 @@ _File: TypeAlias = str | BinaryIO class Error(Exception): ... -def encode(in_file: _File, out_file: _File, name: str | None = None, mode: int | None = None, *, backtick: bool = False) -> None: ... +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: ... diff --git a/stdlib/warnings.pyi b/stdlib/warnings.pyi index 2fa978004ca8..a1717bc252a4 100644 --- a/stdlib/warnings.pyi +++ b/stdlib/warnings.pyi @@ -22,16 +22,18 @@ _ActionKind: TypeAlias = Literal["default", "error", "ignore", "always", "module filters: Sequence[tuple[str, str | None, type[Warning], str | None, int]] # undocumented, do not mutate def showwarning( - message: Warning | str, category: type[Warning], filename: str, lineno: int, file: TextIO | None = None, line: str | None = None + message: Warning | str, + category: type[Warning], + filename: str, + lineno: int, + file: TextIO | None = None, + line: str | None = None, ) -> None: ... -def formatwarning(message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = None) -> str: ... +def formatwarning( + message: Warning | str, category: type[Warning], filename: str, lineno: int, line: str | None = None +) -> str: ... def filterwarnings( - action: _ActionKind, - message: str = '', - category: type[Warning] = ..., - module: str = '', - lineno: int = 0, - append: bool = False, + action: _ActionKind, message: str = "", category: type[Warning] = ..., module: str = "", lineno: int = 0, append: bool = False ) -> None: ... def simplefilter(action: _ActionKind, category: type[Warning] = ..., lineno: int = 0, append: bool = False) -> None: ... def resetwarnings() -> None: ... diff --git a/stdlib/webbrowser.pyi b/stdlib/webbrowser.pyi index 6511999d437b..9f4eea3bd651 100644 --- a/stdlib/webbrowser.pyi +++ b/stdlib/webbrowser.pyi @@ -19,7 +19,7 @@ class BaseBrowser: args: list[str] name: str basename: str - def __init__(self, name: str = '') -> None: ... + def __init__(self, name: str = "") -> None: ... @abstractmethod def open(self, url: str, new: int = 0, autoraise: bool = True) -> bool: ... def open_new(self, url: str) -> bool: ... diff --git a/stdlib/xml/dom/domreg.pyi b/stdlib/xml/dom/domreg.pyi index 75b7796c4718..a46d3ff090e6 100644 --- a/stdlib/xml/dom/domreg.pyi +++ b/stdlib/xml/dom/domreg.pyi @@ -5,4 +5,6 @@ well_known_implementations: dict[str, str] registered: dict[str, Callable[[], DOMImplementation]] def registerDOMImplementation(name: str, factory: Callable[[], DOMImplementation]) -> None: ... -def getDOMImplementation(name: str | None = None, features: str | Iterable[tuple[str, str | None]] = ...) -> DOMImplementation: ... +def getDOMImplementation( + name: str | None = None, features: str | Iterable[tuple[str, str | None]] = ... +) -> DOMImplementation: ... diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index c045ae9bb20d..6cdbdbf2e226 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -143,7 +143,7 @@ class Element(Node): def hasAttributeNS(self, namespaceURI: str, localName) -> bool: ... def getElementsByTagName(self, name: str): ... def getElementsByTagNameNS(self, namespaceURI: str, localName): ... - def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = "", addindent: str = "", newl: str = "") -> None: ... def hasAttributes(self) -> bool: ... def setIdAttribute(self, name) -> None: ... def setIdAttributeNS(self, namespaceURI: str, localName) -> None: ... @@ -170,7 +170,7 @@ class ProcessingInstruction(Childless, Node): def __init__(self, target, data) -> None: ... nodeValue: Incomplete nodeName: Incomplete - def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = "", addindent: str = "", newl: str = "") -> None: ... class CharacterData(Childless, Node): ownerDocument: Incomplete @@ -193,7 +193,7 @@ class Text(CharacterData): attributes: Incomplete data: Incomplete def splitText(self, offset): ... - def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = "", addindent: str = "", newl: str = "") -> None: ... def replaceWholeText(self, content): ... @property def isWhitespaceInElementContent(self) -> bool: ... @@ -204,12 +204,12 @@ class Comment(CharacterData): nodeType: int nodeName: str def __init__(self, data) -> None: ... - def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = "", addindent: str = "", newl: str = "") -> None: ... class CDATASection(Text): nodeType: int nodeName: str - def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = "", addindent: str = "", newl: str = "") -> None: ... class ReadOnlySequentialNamedNodeMap: def __init__(self, seq=...) -> None: ... @@ -239,7 +239,7 @@ class DocumentType(Identified, Childless, Node): nodeName: Incomplete def __init__(self, qualifiedName: str) -> None: ... def cloneNode(self, deep): ... - def writexml(self, writer: SupportsWrite[str], indent: str = '', addindent: str = '', newl: str = '') -> None: ... + def writexml(self, writer: SupportsWrite[str], indent: str = "", addindent: str = "", newl: str = "") -> None: ... class Entity(Identified, Node): attributes: Incomplete diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index d991ce54fe12..9a05279f770d 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -261,7 +261,7 @@ else: def dump(elem: Element) -> None: ... if sys.version_info >= (3, 9): - def indent(tree: Element | ElementTree, space: str = ' ', level: int = 0) -> None: ... + def indent(tree: Element | ElementTree, space: str = " ", level: int = 0) -> None: ... def parse(source: _FileRead, parser: XMLParser | None = None) -> ElementTree: ... def iterparse( diff --git a/stdlib/xml/sax/saxutils.pyi b/stdlib/xml/sax/saxutils.pyi index c90d56dc9823..67a06d2fcda2 100644 --- a/stdlib/xml/sax/saxutils.pyi +++ b/stdlib/xml/sax/saxutils.pyi @@ -12,7 +12,7 @@ class XMLGenerator(handler.ContentHandler): def __init__( self, out: TextIOBase | RawIOBase | StreamWriter | StreamReaderWriter | SupportsWrite[str] | None = None, - encoding: str = 'iso-8859-1', + encoding: str = "iso-8859-1", short_empty_elements: bool = False, ) -> None: ... def startDocument(self): ... @@ -57,4 +57,4 @@ class XMLFilterBase(xmlreader.XMLReader): def getParent(self): ... def setParent(self, parent): ... -def prepare_input_source(source, base=''): ... +def prepare_input_source(source, base=""): ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index a6169324fda8..ffb436dc00be 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -208,7 +208,9 @@ def dumps( encoding: str | None = None, allow_none: bool = False, ) -> str: ... -def loads(data: str, use_datetime: bool = False, use_builtin_types: bool = False) -> tuple[tuple[_Marshallable, ...], str | None]: ... +def loads( + data: str, use_datetime: bool = False, use_builtin_types: bool = False +) -> tuple[tuple[_Marshallable, ...], str | None]: ... def gzip_encode(data: ReadableBuffer) -> bytes: ... # undocumented def gzip_decode(data: ReadableBuffer, max_decode: int = 20971520) -> bytes: ... # undocumented diff --git a/stdlib/zipfile.pyi b/stdlib/zipfile.pyi index a3dcb52914e3..31e4a9bc6de7 100644 --- a/stdlib/zipfile.pyi +++ b/stdlib/zipfile.pyi @@ -159,7 +159,7 @@ class ZipFile: def infolist(self) -> list[ZipInfo]: ... def namelist(self) -> list[str]: ... def open( - self, name: str | ZipInfo, mode: _ReadWriteMode = 'r', pwd: bytes | None = None, *, force_zip64: bool = False + self, name: str | ZipInfo, mode: _ReadWriteMode = "r", pwd: bytes | None = None, *, force_zip64: bool = False ) -> IO[bytes]: ... def extract(self, member: str | ZipInfo, path: StrPath | None = None, pwd: bytes | None = None) -> str: ... def extractall( @@ -170,7 +170,11 @@ class ZipFile: def read(self, name: str | ZipInfo, pwd: bytes | None = None) -> bytes: ... def testzip(self) -> str | None: ... def write( - self, filename: StrPath, arcname: StrPath | None = None, compress_type: int | None = None, compresslevel: int | None = None + self, + filename: StrPath, + arcname: StrPath | None = None, + compress_type: int | None = None, + compresslevel: int | None = None, ) -> None: ... def writestr( self, @@ -184,9 +188,9 @@ class ZipFile: class PyZipFile(ZipFile): def __init__( - self, file: str | IO[bytes], mode: _ZipFileMode = 'r', compression: int = 0, allowZip64: bool = True, optimize: int = -1 + self, file: str | IO[bytes], mode: _ZipFileMode = "r", compression: int = 0, allowZip64: bool = True, optimize: int = -1 ) -> None: ... - def writepy(self, pathname: str, basename: str = '', filterfunc: Callable[[str], bool] | None = None) -> None: ... + def writepy(self, pathname: str, basename: str = "", filterfunc: Callable[[str], bool] | None = None) -> None: ... class ZipInfo: filename: str @@ -207,7 +211,7 @@ class ZipInfo: compress_size: int file_size: int orig_filename: str # undocumented - def __init__(self, filename: str = 'NoName', date_time: _DateTuple = ...) -> None: ... + def __init__(self, filename: str = "NoName", date_time: _DateTuple = ...) -> None: ... if sys.version_info >= (3, 8): @classmethod def from_file( @@ -240,7 +244,7 @@ if sys.version_info >= (3, 8): @property def stem(self) -> str: ... - def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = '') -> None: ... + def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = "") -> None: ... if sys.version_info >= (3, 9): def open(self, mode: _ReadWriteBinaryMode = ..., *args: Any, pwd: bytes | None = ..., **kwargs: Any) -> IO[bytes]: ... else: diff --git a/stdlib/zlib.pyi b/stdlib/zlib.pyi index 13d0f33c5728..3f77dd958021 100644 --- a/stdlib/zlib.pyi +++ b/stdlib/zlib.pyi @@ -49,12 +49,7 @@ else: def compress(__data: ReadableBuffer, level: int = ...) -> bytes: ... def compressobj( - level: int = -1, - method: int = 8, - wbits: int = 15, - memLevel: int = 8, - strategy: int = 0, - zdict: ReadableBuffer | None = None, + level: int = -1, method: int = 8, wbits: int = 15, memLevel: int = 8, strategy: int = 0, zdict: ReadableBuffer | None = None ) -> _Compress: ... def crc32(__data: ReadableBuffer, __value: int = ...) -> int: ... def decompress(__data: ReadableBuffer, wbits: int = 15, bufsize: int = 16384) -> bytes: ... From edc3c94a30aa0ea33c2e676447c12999c4b46c2b Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 17 Jan 2023 22:05:23 -0800 Subject: [PATCH 12/16] better method support --- stdlib/_weakrefset.pyi | 2 +- stdlib/argparse.pyi | 44 +++++++++---------- stdlib/asyncio/base_events.pyi | 36 ++++++++-------- stdlib/asyncio/events.pyi | 54 ++++++++++++------------ stdlib/asyncio/futures.pyi | 2 +- stdlib/asyncio/locks.pyi | 4 +- stdlib/asyncio/proactor_events.pyi | 8 ++-- stdlib/asyncio/queues.pyi | 2 +- stdlib/asyncio/sslproto.pyi | 12 +++--- stdlib/asyncio/streams.pyi | 2 +- stdlib/asyncore.pyi | 2 +- stdlib/builtins.pyi | 28 ++++++------ stdlib/collections/__init__.pyi | 8 ++-- stdlib/concurrent/futures/_base.pyi | 2 +- stdlib/concurrent/futures/process.pyi | 12 +++--- stdlib/configparser.pyi | 50 +++++++++++----------- stdlib/contextlib.pyi | 2 +- stdlib/csv.pyi | 14 +++--- stdlib/ctypes/__init__.pyi | 10 ++--- stdlib/datetime.pyi | 2 +- stdlib/difflib.pyi | 14 +++--- stdlib/dis.pyi | 10 ++--- stdlib/distutils/fancy_getopt.pyi | 2 +- stdlib/distutils/filelist.pyi | 12 +++--- stdlib/email/feedparser.pyi | 4 +- stdlib/enum.pyi | 6 +-- stdlib/fractions.pyi | 6 +-- stdlib/ftplib.pyi | 30 ++++++------- stdlib/functools.pyi | 10 ++--- stdlib/graphlib.pyi | 2 +- stdlib/gzip.pyi | 34 +++++++-------- stdlib/http/cookiejar.pyi | 28 ++++++------ stdlib/imaplib.pyi | 20 ++++----- stdlib/importlib/abc.pyi | 2 +- stdlib/inspect.pyi | 8 ++-- stdlib/logging/__init__.pyi | 32 +++++++------- stdlib/logging/handlers.pyi | 32 +++++++------- stdlib/mailbox.pyi | 10 ++--- stdlib/mimetypes.pyi | 2 +- stdlib/modulefinder.pyi | 8 ++-- stdlib/multiprocessing/context.pyi | 16 +++---- stdlib/multiprocessing/heap.pyi | 2 +- stdlib/multiprocessing/managers.pyi | 8 ++-- stdlib/multiprocessing/shared_memory.pyi | 4 +- stdlib/numbers.pyi | 2 +- stdlib/optparse.pyi | 4 +- stdlib/pathlib.pyi | 48 ++++++++++----------- stdlib/pprint.pyi | 14 +++--- stdlib/pyclbr.pyi | 10 ++--- stdlib/pydoc.pyi | 10 ++--- stdlib/random.pyi | 4 +- stdlib/re.pyi | 40 +++++++----------- stdlib/smtplib.pyi | 10 ++--- stdlib/socket.pyi | 46 ++++++++++---------- stdlib/sqlite3/dbapi2.pyi | 8 ++-- stdlib/sre_parse.pyi | 2 +- stdlib/ssl.pyi | 10 ++--- stdlib/symtable.pyi | 2 +- stdlib/tarfile.pyi | 20 ++++----- stdlib/threading.pyi | 2 +- stdlib/traceback.pyi | 30 ++++++------- stdlib/tracemalloc.pyi | 2 +- stdlib/types.pyi | 36 ++++++++-------- stdlib/typing.pyi | 2 +- stdlib/unittest/case.pyi | 48 ++++++++++----------- stdlib/unittest/mock.pyi | 8 ++-- stdlib/urllib/request.pyi | 2 +- stdlib/venv/__init__.pyi | 14 +++--- stdlib/weakref.pyi | 2 +- stdlib/wsgiref/headers.pyi | 2 +- stdlib/xml/dom/minidom.pyi | 16 ++++--- stdlib/xml/etree/ElementTree.pyi | 10 ++--- stdlib/xmlrpc/client.pyi | 22 +++++----- stdlib/zipfile.pyi | 14 +++--- stdlib/zipimport.pyi | 2 +- 75 files changed, 518 insertions(+), 522 deletions(-) diff --git a/stdlib/_weakrefset.pyi b/stdlib/_weakrefset.pyi index fdf26641bbeb..da09442e855b 100644 --- a/stdlib/_weakrefset.pyi +++ b/stdlib/_weakrefset.pyi @@ -13,7 +13,7 @@ _T = TypeVar("_T") class WeakSet(MutableSet[_T], Generic[_T]): @overload - def __init__(self, data: None = None) -> None: ... + def __init__(self, data: None = ...) -> None: ... @overload def __init__(self, data: Iterable[_T]) -> None: ... def add(self, item: _T) -> None: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index ba1beb3c1318..01a3f01b9751 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -131,19 +131,19 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): if sys.version_info >= (3, 9): def __init__( self, - prog: str | None = ..., - usage: str | None = ..., - description: str | None = ..., - epilog: str | None = ..., + prog: str | None = None, + usage: str | None = None, + description: str | None = None, + epilog: str | None = None, parents: Sequence[ArgumentParser] = ..., formatter_class: _FormatterClass = ..., - prefix_chars: str = ..., - fromfile_prefix_chars: str | None = ..., - argument_default: Any = ..., - conflict_handler: str = ..., - add_help: bool = ..., - allow_abbrev: bool = ..., - exit_on_error: bool = ..., + prefix_chars: str = "-", + fromfile_prefix_chars: str | None = None, + argument_default: Any = None, + conflict_handler: str = "error", + add_help: bool = True, + allow_abbrev: bool = True, + exit_on_error: bool = True, ) -> None: ... else: def __init__( @@ -164,7 +164,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): # The type-ignores in these overloads should be temporary. See: # https://github.com/python/typeshed/pull/2643#issuecomment-442280277 @overload - def parse_args(self, args: Sequence[str] | None = None) -> Namespace: ... + def parse_args(self, args: Sequence[str] | None = ...) -> Namespace: ... @overload def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore[misc] @overload @@ -366,11 +366,11 @@ class _StoreConstAction(Action): self, option_strings: Sequence[str], dest: str, - const: Any | None = ..., - default: Any = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | tuple[str, ...] | None = ..., + const: Any | None = None, + default: Any = None, + required: bool = False, + help: str | None = None, + metavar: str | tuple[str, ...] | None = None, ) -> None: ... else: def __init__( @@ -410,11 +410,11 @@ class _AppendConstAction(Action): self, option_strings: Sequence[str], dest: str, - const: Any | None = ..., - default: Any = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | tuple[str, ...] | None = ..., + const: Any | None = None, + default: Any = None, + required: bool = False, + help: str | None = None, + metavar: str | tuple[str, ...] | None = None, ) -> None: ... else: def __init__( diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 1dc5d0779b59..7d8b2a84c25b 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -34,7 +34,7 @@ class Server(AbstractServer): ssl_context: _SSLContext, backlog: int, ssl_handshake_timeout: float | None, - ssl_shutdown_timeout: float | None = ..., + ssl_shutdown_timeout: float | None = None, ) -> None: ... else: def __init__( @@ -87,7 +87,7 @@ class BaseEventLoop(AbstractEventLoop): # Tasks methods if sys.version_info >= (3, 11): def create_task( - self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = ..., context: Context | None = ... + self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = None, context: Context | None = None ) -> Task[_T]: ... elif sys.version_info >= (3, 8): def create_task(self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, name: object = ...) -> Task[_T]: ... @@ -264,19 +264,19 @@ class BaseEventLoop(AbstractEventLoop): protocol: BaseProtocol, sslcontext: ssl.SSLContext, *, - server_side: bool = ..., - server_hostname: str | None = ..., - ssl_handshake_timeout: float | None = ..., - ssl_shutdown_timeout: float | None = ..., + server_side: bool = False, + server_hostname: str | None = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, ) -> Transport: ... async def connect_accepted_socket( self, protocol_factory: Callable[[], _ProtocolT], sock: socket, *, - ssl: _SSLContext = ..., - ssl_handshake_timeout: float | None = ..., - ssl_shutdown_timeout: float | None = ..., + ssl: _SSLContext = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, ) -> tuple[Transport, _ProtocolT]: ... else: @overload @@ -342,15 +342,15 @@ class BaseEventLoop(AbstractEventLoop): async def create_datagram_endpoint( # type: ignore[override] self, protocol_factory: Callable[[], _ProtocolT], - local_addr: tuple[str, int] | None = ..., - remote_addr: tuple[str, int] | None = ..., + local_addr: tuple[str, int] | None = None, + remote_addr: tuple[str, int] | None = None, *, - family: int = ..., - proto: int = ..., - flags: int = ..., - reuse_port: bool | None = ..., - allow_broadcast: bool | None = ..., - sock: socket | None = ..., + family: int = 0, + proto: int = 0, + flags: int = 0, + reuse_port: bool | None = None, + allow_broadcast: bool | None = None, + sock: socket | None = None, ) -> tuple[DatagramTransport, _ProtocolT]: ... else: async def create_datagram_endpoint( @@ -418,7 +418,7 @@ class BaseEventLoop(AbstractEventLoop): async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ... if sys.version_info >= (3, 11): async def sock_recvfrom(self, sock: socket, bufsize: int) -> bytes: ... - async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = ...) -> int: ... + async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> int: ... async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> None: ... # Signal handling. def add_signal_handler(self, sig: int, callback: Callable[..., Any], *args: Any) -> None: ... diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index 67850f928db7..86ea9cf9210f 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -132,14 +132,14 @@ class AbstractEventLoop: # Methods scheduling callbacks. All these return Handles. if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2 @abstractmethod - def call_soon(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... + def call_soon(self, callback: Callable[..., object], *args: Any, context: Context | None = None) -> Handle: ... @abstractmethod def call_later( - self, delay: float, callback: Callable[..., object], *args: Any, context: Context | None = ... + self, delay: float, callback: Callable[..., object], *args: Any, context: Context | None = None ) -> TimerHandle: ... @abstractmethod def call_at( - self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = ... + self, when: float, callback: Callable[..., object], *args: Any, context: Context | None = None ) -> TimerHandle: ... else: @abstractmethod @@ -161,8 +161,8 @@ class AbstractEventLoop: self, coro: Coroutine[Any, Any, _T] | Generator[Any, None, _T], *, - name: str | None = ..., - context: Context | None = ..., + name: str | None = None, + context: Context | None = None, ) -> Task[_T]: ... elif sys.version_info >= (3, 8): @abstractmethod @@ -180,7 +180,7 @@ class AbstractEventLoop: # Methods for interacting with threads if sys.version_info >= (3, 9): # "context" added in 3.9.10/3.10.2 @abstractmethod - def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any, context: Context | None = ...) -> Handle: ... + def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any, context: Context | None = None) -> Handle: ... else: @abstractmethod def call_soon_threadsafe(self, callback: Callable[..., object], *args: Any) -> Handle: ... @@ -364,22 +364,22 @@ class AbstractEventLoop: protocol: BaseProtocol, sslcontext: ssl.SSLContext, *, - server_side: bool = ..., - server_hostname: str | None = ..., - ssl_handshake_timeout: float | None = ..., - ssl_shutdown_timeout: float | None = ..., + server_side: bool = False, + server_hostname: str | None = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, ) -> Transport: ... async def create_unix_server( self, protocol_factory: _ProtocolFactory, - path: StrPath | None = ..., + path: StrPath | None = None, *, - sock: socket | None = ..., - backlog: int = ..., - ssl: _SSLContext = ..., - ssl_handshake_timeout: float | None = ..., - ssl_shutdown_timeout: float | None = ..., - start_serving: bool = ..., + sock: socket | None = None, + backlog: int = 100, + ssl: _SSLContext = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, + start_serving: bool = True, ) -> Server: ... else: @overload @@ -446,9 +446,9 @@ class AbstractEventLoop: protocol_factory: Callable[[], _ProtocolT], sock: socket, *, - ssl: _SSLContext = ..., - ssl_handshake_timeout: float | None = ..., - ssl_shutdown_timeout: float | None = ..., + ssl: _SSLContext = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, ) -> tuple[Transport, _ProtocolT]: ... elif sys.version_info >= (3, 10): async def connect_accepted_socket( @@ -463,13 +463,13 @@ class AbstractEventLoop: async def create_unix_connection( self, protocol_factory: Callable[[], _ProtocolT], - path: str | None = ..., + path: str | None = None, *, - ssl: _SSLContext = ..., - sock: socket | None = ..., - server_hostname: str | None = ..., - ssl_handshake_timeout: float | None = ..., - ssl_shutdown_timeout: float | None = ..., + ssl: _SSLContext = None, + sock: socket | None = None, + server_hostname: str | None = None, + ssl_handshake_timeout: float | None = None, + ssl_shutdown_timeout: float | None = None, ) -> tuple[Transport, _ProtocolT]: ... else: async def create_unix_connection( @@ -571,7 +571,7 @@ class AbstractEventLoop: @abstractmethod async def sock_recvfrom(self, sock: socket, bufsize: int) -> bytes: ... @abstractmethod - async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = ...) -> int: ... + async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> int: ... @abstractmethod async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> None: ... # Signal handling. diff --git a/stdlib/asyncio/futures.pyi b/stdlib/asyncio/futures.pyi index 3040280e9c45..9ae1fe6bd50e 100644 --- a/stdlib/asyncio/futures.pyi +++ b/stdlib/asyncio/futures.pyi @@ -46,7 +46,7 @@ class Future(Awaitable[_T], Iterable[_T]): def _callbacks(self: Self) -> list[tuple[Callable[[Self], Any], Context]]: ... def add_done_callback(self: Self, __fn: Callable[[Self], object], *, context: Context | None = ...) -> None: ... if sys.version_info >= (3, 9): - def cancel(self, msg: Any | None = ...) -> bool: ... + def cancel(self, msg: Any | None = None) -> bool: ... else: def cancel(self) -> bool: ... diff --git a/stdlib/asyncio/locks.pyi b/stdlib/asyncio/locks.pyi index 3a260145a4db..76aad7be2d46 100644 --- a/stdlib/asyncio/locks.pyi +++ b/stdlib/asyncio/locks.pyi @@ -67,7 +67,7 @@ class Event: class Condition(_ContextManagerMixin): if sys.version_info >= (3, 11): - def __init__(self, lock: Lock | None = ...) -> None: ... + def __init__(self, lock: Lock | None = None) -> None: ... else: def __init__(self, lock: Lock | None = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... @@ -83,7 +83,7 @@ class Semaphore(_ContextManagerMixin): _value: int _waiters: deque[Future[Any]] if sys.version_info >= (3, 11): - def __init__(self, value: int = ...) -> None: ... + def __init__(self, value: int = 1) -> None: ... else: def __init__(self, value: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... diff --git a/stdlib/asyncio/proactor_events.pyi b/stdlib/asyncio/proactor_events.pyi index a543cf4eb8ac..7fa1af0ca457 100644 --- a/stdlib/asyncio/proactor_events.pyi +++ b/stdlib/asyncio/proactor_events.pyi @@ -36,10 +36,10 @@ class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTran loop: events.AbstractEventLoop, sock: socket, protocol: streams.StreamReaderProtocol, - waiter: futures.Future[Any] | None = ..., - extra: Mapping[Any, Any] | None = ..., - server: events.AbstractServer | None = ..., - buffer_size: int = ..., + waiter: futures.Future[Any] | None = None, + extra: Mapping[Any, Any] | None = None, + server: events.AbstractServer | None = None, + buffer_size: int = 65536, ) -> None: ... else: def __init__( diff --git a/stdlib/asyncio/queues.pyi b/stdlib/asyncio/queues.pyi index 90ba39aebb96..6c64f6aa4dc2 100644 --- a/stdlib/asyncio/queues.pyi +++ b/stdlib/asyncio/queues.pyi @@ -14,7 +14,7 @@ _T = TypeVar("_T") class Queue(Generic[_T]): if sys.version_info >= (3, 11): - def __init__(self, maxsize: int = ...) -> None: ... + def __init__(self, maxsize: int = 0) -> None: ... else: def __init__(self, maxsize: int = ..., *, loop: AbstractEventLoop | None = ...) -> None: ... diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index 46ca40f0138a..cf4761745c8a 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -79,7 +79,7 @@ class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): if sys.version_info >= (3, 11): def get_write_buffer_limits(self) -> tuple[int, int]: ... def get_read_buffer_limits(self) -> tuple[int, int]: ... - def set_read_buffer_limits(self, high: int | None = ..., low: int | None = ...) -> None: ... + def set_read_buffer_limits(self, high: int | None = None, low: int | None = None) -> None: ... def get_read_buffer_size(self) -> int: ... if sys.version_info >= (3, 11): @@ -118,11 +118,11 @@ class SSLProtocol(_SSLProtocolBase): app_protocol: protocols.BaseProtocol, sslcontext: ssl.SSLContext, waiter: futures.Future[Any], - server_side: bool = ..., - server_hostname: str | None = ..., - call_connection_made: bool = ..., - ssl_handshake_timeout: int | None = ..., - ssl_shutdown_timeout: float | None = ..., + server_side: bool = False, + server_hostname: str | None = None, + call_connection_made: bool = True, + ssl_handshake_timeout: int | None = None, + ssl_shutdown_timeout: float | None = None, ) -> None: ... else: def __init__( diff --git a/stdlib/asyncio/streams.pyi b/stdlib/asyncio/streams.pyi index 68d6f64a5d30..091ad521bd2f 100644 --- a/stdlib/asyncio/streams.pyi +++ b/stdlib/asyncio/streams.pyi @@ -150,7 +150,7 @@ class StreamWriter: async def drain(self) -> None: ... if sys.version_info >= (3, 11): async def start_tls( - self, sslcontext: ssl.SSLContext, *, server_hostname: str | None = ..., ssl_handshake_timeout: float | None = ... + self, sslcontext: ssl.SSLContext, *, server_hostname: str | None = None, ssl_handshake_timeout: float | None = None ) -> None: ... class StreamReader(AsyncIterator[bytes]): diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index c92bfe0a8ab2..9c91ddaf2618 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -77,7 +77,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 = None) -> int: ... + def getsockopt(self, level: int, optname: int, buflen: None = ...) -> int: ... @overload def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ... def read(self, bufsize: int, flags: int = ...) -> bytes: ... diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 931b6c6c35b0..f74951a46ab1 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -217,15 +217,15 @@ class int: if sys.version_info >= (3, 11): def to_bytes( - self, length: SupportsIndex = ..., byteorder: Literal["little", "big"] = ..., *, signed: bool = ... + self, length: SupportsIndex = 1, byteorder: Literal["little", "big"] = "big", *, signed: bool = False ) -> bytes: ... @classmethod def from_bytes( cls: type[Self], bytes: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer, - byteorder: Literal["little", "big"] = ..., + byteorder: Literal["little", "big"] = "big", *, - signed: bool = ..., + signed: bool = False, ) -> Self: ... else: def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ... @@ -507,21 +507,21 @@ class str(Sequence[str]): @overload def rpartition(self, __sep: str) -> tuple[str, str, str]: ... # type: ignore[misc] @overload - def rsplit(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ... + def rsplit(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ... @overload - def rsplit(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc] + def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc] @overload def rstrip(self: LiteralString, __chars: LiteralString | None = ...) -> LiteralString: ... @overload def rstrip(self, __chars: str | None = ...) -> str: ... # type: ignore[misc] @overload - def split(self: LiteralString, sep: LiteralString | None = None, maxsplit: SupportsIndex = -1) -> list[LiteralString]: ... + def split(self: LiteralString, sep: LiteralString | None = ..., maxsplit: SupportsIndex = ...) -> list[LiteralString]: ... @overload - def split(self, sep: str | None = None, maxsplit: SupportsIndex = -1) -> list[str]: ... # type: ignore[misc] + def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ... # type: ignore[misc] @overload - def splitlines(self: LiteralString, keepends: bool = False) -> list[LiteralString]: ... + def splitlines(self: LiteralString, keepends: bool = ...) -> list[LiteralString]: ... @overload - def splitlines(self, keepends: bool = False) -> list[str]: ... # type: ignore[misc] + def splitlines(self, keepends: bool = ...) -> list[str]: ... # type: ignore[misc] def startswith( self, __prefix: str | tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ... ) -> bool: ... @@ -604,7 +604,7 @@ class bytes(ByteString): __end: SupportsIndex | None = ..., ) -> bool: ... if sys.version_info >= (3, 8): - def expandtabs(self, tabsize: SupportsIndex = ...) -> bytes: ... + def expandtabs(self, tabsize: SupportsIndex = 8) -> bytes: ... else: def expandtabs(self, tabsize: int = ...) -> bytes: ... @@ -709,7 +709,7 @@ class bytearray(MutableSequence[int], ByteString): __end: SupportsIndex | None = ..., ) -> bool: ... if sys.version_info >= (3, 8): - def expandtabs(self, tabsize: SupportsIndex = ...) -> bytearray: ... + def expandtabs(self, tabsize: SupportsIndex = 8) -> bytearray: ... else: def expandtabs(self, tabsize: int = ...) -> bytearray: ... @@ -847,7 +847,7 @@ class memoryview(Sequence[int]): @overload def __setitem__(self, __i: SupportsIndex, __o: SupportsIndex) -> None: ... if sys.version_info >= (3, 8): - def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ... + def tobytes(self, order: Literal["C", "F", "A"] | None = "C") -> bytes: ... else: def tobytes(self) -> bytes: ... @@ -976,9 +976,9 @@ class list(MutableSequence[_T], Generic[_T]): # Use list[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison] # to work around invariance @overload - def sort(self: list[SupportsRichComparisonT], *, key: None = None, reverse: bool = False) -> None: ... + def sort(self: list[SupportsRichComparisonT], *, key: None = ..., reverse: bool = ...) -> None: ... @overload - def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = False) -> None: ... + def sort(self, *, key: Callable[[_T], SupportsRichComparison], reverse: bool = ...) -> None: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... __hash__: ClassVar[None] # type: ignore[assignment] diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 0ef9d9ca4a6a..8c8154b80ed6 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -76,7 +76,7 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. @classmethod @overload - def fromkeys(cls, iterable: Iterable[_T], value: None = None) -> UserDict[_T, Any | None]: ... + def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> UserDict[_T, Any | None]: ... @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S) -> UserDict[_T, _S]: ... @@ -92,7 +92,7 @@ class UserDict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): class UserList(MutableSequence[_T]): data: list[_T] @overload - def __init__(self, initlist: None = None) -> None: ... + def __init__(self, initlist: None = ...) -> None: ... @overload def __init__(self, initlist: Iterable[_T]) -> None: ... def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ... @@ -165,7 +165,7 @@ class UserString(Sequence[UserString]): def center(self: Self, width: int, *args: Any) -> Self: ... def count(self, sub: str | UserString, start: int = 0, end: int = 9223372036854775807) -> int: ... if sys.version_info >= (3, 8): - def encode(self: UserString, encoding: str | None = ..., errors: str | None = ...) -> bytes: ... + def encode(self: UserString, encoding: str | None = "utf-8", errors: str | None = "strict") -> bytes: ... else: def encode(self: Self, encoding: str | None = ..., errors: str | None = ...) -> Self: ... @@ -353,7 +353,7 @@ class OrderedDict(dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]): # See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963. @classmethod @overload - def fromkeys(cls, iterable: Iterable[_T], value: None = None) -> OrderedDict[_T, Any | None]: ... + def fromkeys(cls, iterable: Iterable[_T], value: None = ...) -> OrderedDict[_T, Any | None]: ... @classmethod @overload def fromkeys(cls, iterable: Iterable[_T], value: _S) -> OrderedDict[_T, _S]: ... diff --git a/stdlib/concurrent/futures/_base.pyi b/stdlib/concurrent/futures/_base.pyi index 52748527e022..4a044bc761a3 100644 --- a/stdlib/concurrent/futures/_base.pyi +++ b/stdlib/concurrent/futures/_base.pyi @@ -58,7 +58,7 @@ class Executor: self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: float | None = None, chunksize: int = 1 ) -> Iterator[_T]: ... if sys.version_info >= (3, 9): - def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ... + def shutdown(self, wait: bool = True, *, cancel_futures: bool = False) -> None: ... else: def shutdown(self, wait: bool = ...) -> None: ... diff --git a/stdlib/concurrent/futures/process.pyi b/stdlib/concurrent/futures/process.pyi index e5f12a05b529..f3ce4e6d68b8 100644 --- a/stdlib/concurrent/futures/process.pyi +++ b/stdlib/concurrent/futures/process.pyi @@ -55,7 +55,7 @@ class _ResultItem: if sys.version_info >= (3, 11): exit_pid: int | None def __init__( - self, work_id: int, exception: Exception | None = ..., result: Any | None = ..., exit_pid: int | None = ... + self, work_id: int, exception: Exception | None = None, result: Any | None = None, exit_pid: int | None = None ) -> None: ... else: def __init__(self, work_id: int, exception: Exception | None = ..., result: Any | None = ...) -> None: ... @@ -74,7 +74,7 @@ class _SafeQueue(Queue[Future[Any]]): if sys.version_info >= (3, 9): def __init__( self, - max_size: int | None = ..., + max_size: int | None = 0, *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]], @@ -171,12 +171,12 @@ class ProcessPoolExecutor(Executor): if sys.version_info >= (3, 11): def __init__( self, - max_workers: int | None = ..., - mp_context: BaseContext | None = ..., - initializer: Callable[..., object] | None = ..., + max_workers: int | None = None, + mp_context: BaseContext | None = None, + initializer: Callable[..., object] | None = None, initargs: tuple[Any, ...] = ..., *, - max_tasks_per_child: int | None = ..., + max_tasks_per_child: int | None = None, ) -> None: ... else: def __init__( diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index 0587e56c20d2..89dcaf18ce6e 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -65,32 +65,32 @@ class RawConfigParser(_Parser): @overload def __init__( self, - defaults: Mapping[str, str | None] | None = None, + defaults: Mapping[str, str | None] | None = ..., dict_type: type[Mapping[str, str]] = ..., - allow_no_value: Literal[True] = False, + allow_no_value: Literal[True] = ..., *, delimiters: Sequence[str] = ..., comment_prefixes: Sequence[str] = ..., - inline_comment_prefixes: Sequence[str] | None = None, - strict: bool = True, - empty_lines_in_values: bool = True, - default_section: str = "DEFAULT", + inline_comment_prefixes: Sequence[str] | None = ..., + strict: bool = ..., + empty_lines_in_values: bool = ..., + default_section: str = ..., interpolation: Interpolation | None = ..., converters: _ConvertersMap = ..., ) -> None: ... @overload def __init__( self, - defaults: _Section | None = None, + defaults: _Section | None = ..., dict_type: type[Mapping[str, str]] = ..., - allow_no_value: bool = False, + allow_no_value: bool = ..., *, delimiters: Sequence[str] = ..., comment_prefixes: Sequence[str] = ..., - inline_comment_prefixes: Sequence[str] | None = None, - strict: bool = True, - empty_lines_in_values: bool = True, - default_section: str = "DEFAULT", + inline_comment_prefixes: Sequence[str] | None = ..., + strict: bool = ..., + empty_lines_in_values: bool = ..., + default_section: str = ..., interpolation: Interpolation | None = ..., converters: _ConvertersMap = ..., ) -> None: ... @@ -114,22 +114,22 @@ class RawConfigParser(_Parser): # These get* methods are partially applied (with the same names) in # SectionProxy; the stubs should be kept updated together @overload - def getint(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> int: ... + def getint(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> int: ... @overload def getint( - self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ... + self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... ) -> int | _T: ... @overload - def getfloat(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> float: ... + def getfloat(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> float: ... @overload def getfloat( - self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ... + self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... ) -> float | _T: ... @overload - def getboolean(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> bool: ... + def getboolean(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> bool: ... @overload def getboolean( - self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T = ... + self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T = ... ) -> bool | _T: ... def _get_conv( self, @@ -143,15 +143,13 @@ class RawConfigParser(_Parser): ) -> _T: ... # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore[override] - def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str | Any: ... + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str | Any: ... @overload - def get( - self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T - ) -> str | _T | Any: ... + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T | Any: ... @overload - def items(self, *, raw: bool = False, vars: _Section | None = None) -> ItemsView[str, SectionProxy]: ... + def items(self, *, raw: bool = ..., vars: _Section | None = ...) -> ItemsView[str, SectionProxy]: ... @overload - def items(self, section: str, raw: bool = False, vars: _Section | None = None) -> list[tuple[str, str]]: ... + def items(self, section: str, raw: bool = ..., vars: _Section | None = ...) -> list[tuple[str, str]]: ... def set(self, section: str, option: str, value: str | None = None) -> None: ... def write(self, fp: SupportsWrite[str], space_around_delimiters: bool = True) -> None: ... def remove_option(self, section: str, option: str) -> bool: ... @@ -161,9 +159,9 @@ class RawConfigParser(_Parser): class ConfigParser(RawConfigParser): # This is incompatible with MutableMapping so we ignore the type @overload # type: ignore[override] - def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None) -> str: ... + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ...) -> str: ... @overload - def get(self, section: str, option: str, *, raw: bool = False, vars: _Section | None = None, fallback: _T) -> str | _T: ... + def get(self, section: str, option: str, *, raw: bool = ..., vars: _Section | None = ..., fallback: _T) -> str | _T: ... if sys.version_info < (3, 12): class SafeConfigParser(ConfigParser): ... # deprecated alias diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 440347d99fc3..bc32ce0ffac5 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -174,7 +174,7 @@ if sys.version_info >= (3, 10): class nullcontext(AbstractContextManager[_T], AbstractAsyncContextManager[_T]): enter_result: _T @overload - def __init__(self: nullcontext[None], enter_result: None = None) -> None: ... + def __init__(self: nullcontext[None], enter_result: None = ...) -> None: ... @overload def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... def __enter__(self) -> _T: ... diff --git a/stdlib/csv.pyi b/stdlib/csv.pyi index 13b483b219d5..5a72648a3d20 100644 --- a/stdlib/csv.pyi +++ b/stdlib/csv.pyi @@ -76,9 +76,9 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]): self, f: Iterable[str], fieldnames: Sequence[_T], - restkey: str | None = None, - restval: str | None = None, - dialect: _DialectLike = "excel", + restkey: str | None = ..., + restval: str | None = ..., + dialect: _DialectLike = ..., *, delimiter: str = ..., quotechar: str | None = ..., @@ -93,10 +93,10 @@ class DictReader(Generic[_T], Iterator[_DictReadMapping[_T | Any, str | Any]]): def __init__( self: DictReader[str], f: Iterable[str], - fieldnames: Sequence[str] | None = None, - restkey: str | None = None, - restval: str | None = None, - dialect: _DialectLike = "excel", + fieldnames: Sequence[str] | None = ..., + restkey: str | None = ..., + restval: str | None = ..., + dialect: _DialectLike = ..., *, delimiter: str = ..., quotechar: str | None = ..., diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index e1e84afb7dde..d0bb8a98b0e6 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -25,11 +25,11 @@ class CDLL: def __init__( self, name: str | None, - mode: int = ..., - handle: int | None = ..., - use_errno: bool = ..., - use_last_error: bool = ..., - winmode: int | None = ..., + mode: int = 4, + handle: int | None = None, + use_errno: bool = False, + use_last_error: bool = False, + winmode: int | None = None, ) -> None: ... else: def __init__( diff --git a/stdlib/datetime.pyi b/stdlib/datetime.pyi index 43f5902c3c06..d9ef2dbd236e 100644 --- a/stdlib/datetime.pyi +++ b/stdlib/datetime.pyi @@ -261,7 +261,7 @@ class datetime(date): def utcfromtimestamp(cls: type[Self], __t: float) -> Self: ... if sys.version_info >= (3, 8): @classmethod - def now(cls: type[Self], tz: _TzInfo | None = ...) -> Self: ... + def now(cls: type[Self], tz: _TzInfo | None = None) -> Self: ... else: @overload @classmethod diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 4be1a8a89c0a..9e7aeb40021f 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -29,22 +29,22 @@ class Match(NamedTuple): class SequenceMatcher(Generic[_T]): @overload - def __init__(self, isjunk: Callable[[_T], bool] | None, a: Sequence[_T], b: Sequence[_T], autojunk: bool = True) -> None: ... + def __init__(self, isjunk: Callable[[_T], bool] | None, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ... @overload - def __init__(self, *, a: Sequence[_T], b: Sequence[_T], autojunk: bool = True) -> None: ... + def __init__(self, *, a: Sequence[_T], b: Sequence[_T], autojunk: bool = ...) -> None: ... @overload def __init__( self: SequenceMatcher[str], - isjunk: Callable[[str], bool] | None = None, - a: Sequence[str] = "", - b: Sequence[str] = "", - autojunk: bool = True, + isjunk: Callable[[str], bool] | None = ..., + a: Sequence[str] = ..., + b: Sequence[str] = ..., + autojunk: bool = ..., ) -> None: ... def set_seqs(self, a: Sequence[_T], b: Sequence[_T]) -> None: ... def set_seq1(self, a: Sequence[_T]) -> None: ... def set_seq2(self, b: Sequence[_T]) -> None: ... if sys.version_info >= (3, 9): - def find_longest_match(self, alo: int = ..., ahi: int | None = ..., blo: int = ..., bhi: int | None = ...) -> Match: ... + def find_longest_match(self, alo: int = 0, ahi: int | None = None, blo: int = 0, bhi: int | None = None) -> Match: ... else: def find_longest_match(self, alo: int, ahi: int, blo: int, bhi: int) -> Match: ... diff --git a/stdlib/dis.pyi b/stdlib/dis.pyi index 6f88eccaf8da..4d39a54d41dd 100644 --- a/stdlib/dis.pyi +++ b/stdlib/dis.pyi @@ -76,14 +76,14 @@ class Bytecode: self, x: _HaveCodeType | str, *, - first_line: int | None = ..., - current_offset: int | None = ..., - show_caches: bool = ..., - adaptive: bool = ..., + first_line: int | None = None, + current_offset: int | None = None, + show_caches: bool = False, + adaptive: bool = False, ) -> None: ... @classmethod def from_traceback( - cls: type[Self], tb: types.TracebackType, *, show_caches: bool = ..., adaptive: bool = ... + cls: type[Self], tb: types.TracebackType, *, show_caches: bool = False, adaptive: bool = False ) -> Self: ... else: def __init__(self, x: _HaveCodeType | str, *, first_line: int | None = ..., current_offset: int | None = ...) -> None: ... diff --git a/stdlib/distutils/fancy_getopt.pyi b/stdlib/distutils/fancy_getopt.pyi index 153583be6b5d..e72e7996aaa0 100644 --- a/stdlib/distutils/fancy_getopt.pyi +++ b/stdlib/distutils/fancy_getopt.pyi @@ -14,7 +14,7 @@ class FancyGetopt: def __init__(self, option_table: list[_Option] | None = None) -> None: ... # TODO kinda wrong, `getopt(object=object())` is invalid @overload - def getopt(self, args: list[str] | None = None) -> _GR: ... + def getopt(self, args: list[str] | None = ...) -> _GR: ... @overload def getopt(self, args: list[str] | None, object: Any) -> list[str]: ... def get_option_order(self) -> list[tuple[str, str]]: ... diff --git a/stdlib/distutils/filelist.pyi b/stdlib/distutils/filelist.pyi index 18fc501f26ad..4bd9d3a331eb 100644 --- a/stdlib/distutils/filelist.pyi +++ b/stdlib/distutils/filelist.pyi @@ -18,23 +18,23 @@ class FileList: def process_template_line(self, line: str) -> None: ... @overload def include_pattern( - self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0 + self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... ) -> bool: ... @overload - def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = 0) -> bool: ... + def include_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... @overload def include_pattern( - self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0 + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... ) -> bool: ... @overload def exclude_pattern( - self, pattern: str, anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: Literal[0, False] = 0 + self, pattern: str, anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: Literal[0, False] = ... ) -> bool: ... @overload - def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = 0) -> bool: ... + def exclude_pattern(self, pattern: str | Pattern[str], *, is_regex: Literal[True, 1] = ...) -> bool: ... @overload def exclude_pattern( - self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = 1, prefix: str | None = None, is_regex: int = 0 + self, pattern: str | Pattern[str], anchor: bool | Literal[0, 1] = ..., prefix: str | None = ..., is_regex: int = ... ) -> bool: ... def findall(dir: str = ".") -> list[str]: ... diff --git a/stdlib/email/feedparser.pyi b/stdlib/email/feedparser.pyi index 4b7f73b9c015..809f0b0e112b 100644 --- a/stdlib/email/feedparser.pyi +++ b/stdlib/email/feedparser.pyi @@ -9,7 +9,7 @@ _MessageT = TypeVar("_MessageT", bound=Message) class FeedParser(Generic[_MessageT]): @overload - def __init__(self: FeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ... + def __init__(self: FeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ... @overload def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ... def feed(self, data: str) -> None: ... @@ -17,7 +17,7 @@ class FeedParser(Generic[_MessageT]): class BytesFeedParser(Generic[_MessageT]): @overload - def __init__(self: BytesFeedParser[Message], _factory: None = None, *, policy: Policy = ...) -> None: ... + def __init__(self: BytesFeedParser[Message], _factory: None = ..., *, policy: Policy = ...) -> None: ... @overload def __init__(self, _factory: Callable[[], _MessageT], *, policy: Policy = ...) -> None: ... def feed(self, data: bytes | bytearray) -> None: ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index c7b6060739b0..b51b51c0e672 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -85,8 +85,8 @@ class EnumMeta(ABCMeta): bases: tuple[type, ...], classdict: _EnumDict, *, - boundary: FlagBoundary | None = ..., - _simple: bool = ..., + boundary: FlagBoundary | None = None, + _simple: bool = False, **kwds: Any, ) -> Self: ... elif sys.version_info >= (3, 9): @@ -112,7 +112,7 @@ class EnumMeta(ABCMeta): def __dir__(self) -> list[str]: ... # Simple value lookup @overload # type: ignore[override] - def __call__(cls: type[_EnumMemberT], value: Any, names: None = None) -> _EnumMemberT: ... + def __call__(cls: type[_EnumMemberT], value: Any, names: None = ...) -> _EnumMemberT: ... # Functional Enum API if sys.version_info >= (3, 11): @overload diff --git a/stdlib/fractions.pyi b/stdlib/fractions.pyi index 95e4aad0f9ca..1cad2353ed8d 100644 --- a/stdlib/fractions.pyi +++ b/stdlib/fractions.pyi @@ -24,10 +24,10 @@ else: class Fraction(Rational): @overload def __new__( - cls: type[Self], numerator: int | Rational = 0, denominator: int | Rational | None = None, *, _normalize: bool = True + cls: type[Self], numerator: int | Rational = ..., denominator: int | Rational | None = ..., *, _normalize: bool = ... ) -> Self: ... @overload - def __new__(cls: type[Self], __value: float | Decimal | str, *, _normalize: bool = True) -> Self: ... + def __new__(cls: type[Self], __value: float | Decimal | str, *, _normalize: bool = ...) -> Self: ... @classmethod def from_float(cls: type[Self], f: float) -> Self: ... @classmethod @@ -129,7 +129,7 @@ class Fraction(Rational): def __floor__(a) -> int: ... def __ceil__(a) -> int: ... @overload - def __round__(self, ndigits: None = None) -> int: ... + def __round__(self, ndigits: None = ...) -> int: ... @overload def __round__(self, ndigits: int) -> Fraction: ... def __hash__(self) -> int: ... diff --git a/stdlib/ftplib.pyi b/stdlib/ftplib.pyi index da83ffa96204..4a735ab4bef6 100644 --- a/stdlib/ftplib.pyi +++ b/stdlib/ftplib.pyi @@ -44,14 +44,14 @@ class FTP: if sys.version_info >= (3, 9): def __init__( self, - host: str = ..., - user: str = ..., - passwd: str = ..., - acct: str = ..., + host: str = "", + user: str = "", + passwd: str = "", + acct: str = "", timeout: float = ..., - source_address: tuple[str, int] | None = ..., + source_address: tuple[str, int] | None = None, *, - encoding: str = ..., + encoding: str = "utf-8", ) -> None: ... else: def __init__( @@ -121,17 +121,17 @@ class FTP_TLS(FTP): if sys.version_info >= (3, 9): def __init__( self, - host: str = ..., - user: str = ..., - passwd: str = ..., - acct: str = ..., - keyfile: str | None = ..., - certfile: str | None = ..., - context: SSLContext | None = ..., + host: str = "", + user: str = "", + passwd: str = "", + acct: str = "", + keyfile: str | None = None, + certfile: str | None = None, + context: SSLContext | None = None, timeout: float = ..., - source_address: tuple[str, int] | None = ..., + source_address: tuple[str, int] | None = None, *, - encoding: str = ..., + encoding: str = "utf-8", ) -> None: ... else: def __init__( diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index 033aacd03990..2174e8c573bc 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -96,7 +96,7 @@ class partialmethod(Generic[_T]): @overload def __init__(self, __func: _Descriptor, *args: Any, **keywords: Any) -> None: ... if sys.version_info >= (3, 8): - def __get__(self, obj: Any, cls: type[Any] | None = ...) -> Callable[..., _T]: ... + def __get__(self, obj: Any, cls: type[Any] | None = None) -> Callable[..., _T]: ... else: def __get__(self, obj: Any, cls: type[Any] | None) -> Callable[..., _T]: ... @@ -132,9 +132,9 @@ if sys.version_info >= (3, 8): @property def __isabstractmethod__(self) -> bool: ... @overload - def register(self, cls: type[Any], method: None = None) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... + def register(self, cls: type[Any], method: None = ...) -> Callable[[Callable[..., _T]], Callable[..., _T]]: ... @overload - def register(self, cls: Callable[..., _T], method: None = None) -> Callable[..., _T]: ... + def register(self, cls: Callable[..., _T], method: None = ...) -> Callable[..., _T]: ... @overload def register(self, cls: type[Any], method: Callable[..., _T]) -> Callable[..., _T]: ... def __get__(self, obj: _S, cls: type[_S] | None = None) -> Callable[..., _T]: ... @@ -144,9 +144,9 @@ if sys.version_info >= (3, 8): attrname: str | None def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: type[Any] | None = None) -> cached_property[_T]: ... + def __get__(self, instance: None, owner: type[Any] | None = ...) -> cached_property[_T]: ... @overload - def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... + def __get__(self, instance: object, owner: type[Any] | None = ...) -> _T: ... def __set_name__(self, owner: type[Any], name: str) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... diff --git a/stdlib/graphlib.pyi b/stdlib/graphlib.pyi index c02d447ad501..4c6959decc4b 100644 --- a/stdlib/graphlib.pyi +++ b/stdlib/graphlib.pyi @@ -12,7 +12,7 @@ if sys.version_info >= (3, 11): class TopologicalSorter(Generic[_T]): @overload - def __init__(self, graph: None = None) -> None: ... + def __init__(self, graph: None = ...) -> None: ... @overload def __init__(self, graph: SupportsItems[_T, Iterable[_T]]) -> None: ... def add(self, node: _T, *predecessors: _T) -> None: ... diff --git a/stdlib/gzip.pyi b/stdlib/gzip.pyi index aaa3b79cd35b..01c285d94d9e 100644 --- a/stdlib/gzip.pyi +++ b/stdlib/gzip.pyi @@ -99,45 +99,45 @@ class GzipFile(_compression.BaseStream): self, filename: StrOrBytesPath | None, mode: _ReadBinaryMode, - compresslevel: int = 9, - fileobj: _ReadableFileobj | None = None, - mtime: float | None = None, + compresslevel: int = ..., + fileobj: _ReadableFileobj | None = ..., + mtime: float | None = ..., ) -> None: ... @overload def __init__( self, *, mode: _ReadBinaryMode, - compresslevel: int = 9, - fileobj: _ReadableFileobj | None = None, - mtime: float | None = None, + compresslevel: int = ..., + fileobj: _ReadableFileobj | None = ..., + mtime: float | None = ..., ) -> None: ... @overload def __init__( self, filename: StrOrBytesPath | None, mode: _WriteBinaryMode, - compresslevel: int = 9, - fileobj: _WritableFileobj | None = None, - mtime: float | None = None, + compresslevel: int = ..., + fileobj: _WritableFileobj | None = ..., + mtime: float | None = ..., ) -> None: ... @overload def __init__( self, *, mode: _WriteBinaryMode, - compresslevel: int = 9, - fileobj: _WritableFileobj | None = None, - mtime: float | None = None, + compresslevel: int = ..., + fileobj: _WritableFileobj | None = ..., + mtime: float | None = ..., ) -> None: ... @overload def __init__( self, - filename: StrOrBytesPath | None = None, - mode: str | None = None, - compresslevel: int = 9, - fileobj: _ReadableFileobj | _WritableFileobj | None = None, - mtime: float | None = None, + filename: StrOrBytesPath | None = ..., + mode: str | None = ..., + compresslevel: int = ..., + fileobj: _ReadableFileobj | _WritableFileobj | None = ..., + mtime: float | None = ..., ) -> None: ... @property def filename(self) -> str: ... diff --git a/stdlib/http/cookiejar.pyi b/stdlib/http/cookiejar.pyi index 9196c4ef0570..40cc5ab46ba6 100644 --- a/stdlib/http/cookiejar.pyi +++ b/stdlib/http/cookiejar.pyi @@ -45,7 +45,9 @@ class FileCookieJar(CookieJar): filename: str delayload: bool if sys.version_info >= (3, 8): - def __init__(self, filename: StrPath | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ... + def __init__( + self, filename: StrPath | None = None, delayload: bool = False, policy: CookiePolicy | None = None + ) -> None: ... else: def __init__(self, filename: str | None = ..., delayload: bool = ..., policy: CookiePolicy | None = ...) -> None: ... @@ -85,18 +87,18 @@ class DefaultCookiePolicy(CookiePolicy): if sys.version_info >= (3, 8): def __init__( self, - blocked_domains: Sequence[str] | None = ..., - allowed_domains: Sequence[str] | None = ..., - netscape: bool = ..., - rfc2965: bool = ..., - rfc2109_as_netscape: bool | None = ..., - hide_cookie2: bool = ..., - strict_domain: bool = ..., - strict_rfc2965_unverifiable: bool = ..., - strict_ns_unverifiable: bool = ..., - strict_ns_domain: int = ..., - strict_ns_set_initial_dollar: bool = ..., - strict_ns_set_path: bool = ..., + blocked_domains: Sequence[str] | None = None, + allowed_domains: Sequence[str] | None = None, + netscape: bool = True, + rfc2965: bool = False, + rfc2109_as_netscape: bool | None = None, + hide_cookie2: bool = False, + strict_domain: bool = False, + strict_rfc2965_unverifiable: bool = True, + strict_ns_unverifiable: bool = False, + strict_ns_domain: int = 0, + strict_ns_set_initial_dollar: bool = False, + strict_ns_set_path: bool = False, secure_protocols: Sequence[str] = ..., ) -> None: ... else: diff --git a/stdlib/imaplib.pyi b/stdlib/imaplib.pyi index 075e5185958d..f6ed8de48b8b 100644 --- a/stdlib/imaplib.pyi +++ b/stdlib/imaplib.pyi @@ -41,8 +41,8 @@ class IMAP4: capabilities: tuple[str, ...] PROTOCOL_VERSION: str if sys.version_info >= (3, 9): - def __init__(self, host: str = ..., port: int = ..., timeout: float | None = ...) -> None: ... - def open(self, host: str = ..., port: int = ..., timeout: float | None = ...) -> None: ... + def __init__(self, host: str = "", port: int = 143, timeout: float | None = None) -> None: ... + def open(self, host: str = "", port: int = 143, timeout: float | None = None) -> None: ... else: def __init__(self, host: str = ..., port: int = ...) -> None: ... def open(self, host: str = ..., port: int = ...) -> None: ... @@ -113,12 +113,12 @@ class IMAP4_SSL(IMAP4): if sys.version_info >= (3, 9): def __init__( self, - host: str = ..., - port: int = ..., - keyfile: str | None = ..., - certfile: str | None = ..., - ssl_context: SSLContext | None = ..., - timeout: float | None = ..., + host: str = "", + port: int = 993, + keyfile: str | None = None, + certfile: str | None = None, + ssl_context: SSLContext | None = None, + timeout: float | None = None, ) -> None: ... else: def __init__( @@ -132,7 +132,7 @@ class IMAP4_SSL(IMAP4): sslobj: SSLSocket file: IO[Any] if sys.version_info >= (3, 9): - def open(self, host: str = ..., port: int | None = ..., timeout: float | None = ...) -> None: ... + def open(self, host: str = "", port: int | None = 993, timeout: float | None = None) -> None: ... else: def open(self, host: str = ..., port: int | None = ...) -> None: ... @@ -146,7 +146,7 @@ class IMAP4_stream(IMAP4): writefile: IO[Any] readfile: IO[Any] if sys.version_info >= (3, 9): - def open(self, host: str | None = ..., port: int | None = ..., timeout: float | None = ...) -> None: ... + def open(self, host: str | None = None, port: int | None = None, timeout: float | None = None) -> None: ... else: def open(self, host: str | None = ..., port: int | None = ...) -> None: ... diff --git a/stdlib/importlib/abc.pyi b/stdlib/importlib/abc.pyi index 78b79267d06e..bac7b50c6737 100644 --- a/stdlib/importlib/abc.pyi +++ b/stdlib/importlib/abc.pyi @@ -123,7 +123,7 @@ if sys.version_info >= (3, 9): @abstractmethod def open( self, - mode: OpenTextMode = "r", + mode: OpenTextMode = ..., buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index 955331be0261..0e9c3bce9993 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -322,10 +322,10 @@ class Signature: cls: type[Self], obj: _IntrospectableCallable, *, - follow_wrapped: bool = ..., - globals: Mapping[str, Any] | None = ..., - locals: Mapping[str, Any] | None = ..., - eval_str: bool = ..., + follow_wrapped: bool = True, + globals: Mapping[str, Any] | None = None, + locals: Mapping[str, Any] | None = None, + eval_str: bool = False, ) -> Self: ... else: @classmethod diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index 06745cfaa1dd..a103aacd3e0e 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -161,7 +161,7 @@ class Logger(Filterer): self, msg: object, *args: object, - exc_info: _ExcInfoType = ..., + exc_info: _ExcInfoType = True, stack_info: bool = ..., stacklevel: int = ..., extra: Mapping[str, object] | None = ..., @@ -190,10 +190,10 @@ class Logger(Filterer): level: int, msg: object, args: _ArgsType, - exc_info: _ExcInfoType | None = ..., - extra: Mapping[str, object] | None = ..., - stack_info: bool = ..., - stacklevel: int = ..., + exc_info: _ExcInfoType | None = None, + extra: Mapping[str, object] | None = None, + stack_info: bool = False, + stacklevel: int = 1, ) -> None: ... # undocumented else: def debug( @@ -274,7 +274,7 @@ class Logger(Filterer): def addHandler(self, hdlr: Handler) -> None: ... def removeHandler(self, hdlr: Handler) -> None: ... if sys.version_info >= (3, 8): - def findCaller(self, stack_info: bool = ..., stacklevel: int = ...) -> tuple[str, int, str, str | None]: ... + def findCaller(self, stack_info: bool = False, stacklevel: int = 1) -> tuple[str, int, str, str | None]: ... else: def findCaller(self, stack_info: bool = ...) -> tuple[str, int, str, str | None]: ... @@ -338,12 +338,12 @@ class Formatter: if sys.version_info >= (3, 10): def __init__( self, - fmt: str | None = ..., - datefmt: str | None = ..., - style: _FormatStyle = ..., - validate: bool = ..., + fmt: str | None = None, + datefmt: str | None = None, + style: _FormatStyle = "%", + validate: bool = True, *, - defaults: Mapping[str, Any] | None = ..., + defaults: Mapping[str, Any] | None = None, ) -> None: ... elif sys.version_info >= (3, 8): def __init__( @@ -421,7 +421,7 @@ class LoggerAdapter(Generic[_L]): manager: Manager # undocumented if sys.version_info >= (3, 10): extra: Mapping[str, object] | None - def __init__(self, logger: _L, extra: Mapping[str, object] | None = ...) -> None: ... + def __init__(self, logger: _L, extra: Mapping[str, object] | None = None) -> None: ... else: extra: Mapping[str, object] def __init__(self, logger: _L, extra: Mapping[str, object]) -> None: ... @@ -482,7 +482,7 @@ class LoggerAdapter(Generic[_L]): self, msg: object, *args: object, - exc_info: _ExcInfoType = ..., + exc_info: _ExcInfoType = True, stack_info: bool = ..., stacklevel: int = ..., extra: Mapping[str, object] | None = ..., @@ -771,7 +771,7 @@ class StreamHandler(Handler, Generic[_StreamT]): stream: _StreamT # undocumented terminator: str @overload - def __init__(self: StreamHandler[TextIO], stream: None = None) -> None: ... + def __init__(self: StreamHandler[TextIO], stream: None = ...) -> None: ... @overload def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ... def setStream(self, stream: _StreamT) -> _StreamT | None: ... @@ -786,7 +786,7 @@ class FileHandler(StreamHandler[TextIOWrapper]): if sys.version_info >= (3, 9): errors: str | None # undocumented def __init__( - self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ..., errors: str | None = ... + self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False, errors: str | None = None ) -> None: ... else: def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ... @@ -815,7 +815,7 @@ class PercentStyle: # undocumented validation_pattern: Pattern[str] _fmt: str if sys.version_info >= (3, 10): - def __init__(self, fmt: str, *, defaults: Mapping[str, Any] | None = ...) -> None: ... + def __init__(self, fmt: str, *, defaults: Mapping[str, Any] | None = None) -> None: ... else: def __init__(self, fmt: str) -> None: ... diff --git a/stdlib/logging/handlers.pyi b/stdlib/logging/handlers.pyi index f216d7b0d2d9..ff9aaf8283e1 100644 --- a/stdlib/logging/handlers.pyi +++ b/stdlib/logging/handlers.pyi @@ -22,7 +22,7 @@ class WatchedFileHandler(FileHandler): ino: int # undocumented if sys.version_info >= (3, 9): def __init__( - self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ..., errors: str | None = ... + self, filename: StrPath, mode: str = "a", encoding: str | None = None, delay: bool = False, errors: str | None = None ) -> None: ... else: def __init__(self, filename: StrPath, mode: str = ..., encoding: str | None = ..., delay: bool = ...) -> None: ... @@ -35,7 +35,7 @@ class BaseRotatingHandler(FileHandler): rotator: Callable[[str, str], None] | None if sys.version_info >= (3, 9): def __init__( - self, filename: StrPath, mode: str, encoding: str | None = ..., delay: bool = ..., errors: str | None = ... + self, filename: StrPath, mode: str, encoding: str | None = None, delay: bool = False, errors: str | None = None ) -> None: ... else: def __init__(self, filename: StrPath, mode: str, encoding: str | None = ..., delay: bool = ...) -> None: ... @@ -50,12 +50,12 @@ class RotatingFileHandler(BaseRotatingHandler): def __init__( self, filename: StrPath, - mode: str = ..., - maxBytes: int = ..., - backupCount: int = ..., - encoding: str | None = ..., - delay: bool = ..., - errors: str | None = ..., + mode: str = "a", + maxBytes: int = 0, + backupCount: int = 0, + encoding: str | None = None, + delay: bool = False, + errors: str | None = None, ) -> None: ... else: def __init__( @@ -85,14 +85,14 @@ class TimedRotatingFileHandler(BaseRotatingHandler): def __init__( self, filename: StrPath, - when: str = ..., - interval: int = ..., - backupCount: int = ..., - encoding: str | None = ..., - delay: bool = ..., - utc: bool = ..., - atTime: datetime.time | None = ..., - errors: str | None = ..., + when: str = "h", + interval: int = 1, + backupCount: int = 0, + encoding: str | None = None, + delay: bool = False, + utc: bool = False, + atTime: datetime.time | None = None, + errors: str | None = None, ) -> None: ... else: def __init__( diff --git a/stdlib/mailbox.pyi b/stdlib/mailbox.pyi index 7af718d4191d..229052f91ecc 100644 --- a/stdlib/mailbox.pyi +++ b/stdlib/mailbox.pyi @@ -50,9 +50,9 @@ class Mailbox(Generic[_MessageT]): _path: str # undocumented _factory: Callable[[IO[Any]], _MessageT] | None # undocumented @overload - def __init__(self, path: StrPath, factory: Callable[[IO[Any]], _MessageT], create: bool = True) -> None: ... + def __init__(self, path: StrPath, factory: Callable[[IO[Any]], _MessageT], create: bool = ...) -> None: ... @overload - def __init__(self, path: StrPath, factory: None = None, create: bool = True) -> None: ... + def __init__(self, path: StrPath, factory: None = ..., create: bool = ...) -> None: ... @abstractmethod def add(self, message: _MessageData) -> str: ... @abstractmethod @@ -62,7 +62,7 @@ class Mailbox(Generic[_MessageT]): @abstractmethod def __setitem__(self, key: str, message: _MessageData) -> None: ... @overload - def get(self, key: str, default: None = None) -> _MessageT | None: ... + def get(self, key: str, default: None = ...) -> _MessageT | None: ... @overload def get(self, key: str, default: _T) -> _MessageT | _T: ... def __getitem__(self, key: str) -> _MessageT: ... @@ -88,9 +88,9 @@ class Mailbox(Generic[_MessageT]): def __len__(self) -> int: ... def clear(self) -> None: ... @overload - def pop(self, key: str, default: None = None) -> _MessageT | None: ... + def pop(self, key: str, default: None = ...) -> _MessageT | None: ... @overload - def pop(self, key: str, default: _T = None) -> _MessageT | _T: ... + def pop(self, key: str, default: _T = ...) -> _MessageT | _T: ... def popitem(self) -> tuple[str, _MessageT]: ... def update(self, arg: _HasIteritems | _HasItems | Iterable[tuple[str, _MessageData]] | None = None) -> None: ... @abstractmethod diff --git a/stdlib/mimetypes.pyi b/stdlib/mimetypes.pyi index 6aa2db067edd..decbf2fee19d 100644 --- a/stdlib/mimetypes.pyi +++ b/stdlib/mimetypes.pyi @@ -46,7 +46,7 @@ class MimeTypes: def __init__(self, filenames: tuple[str, ...] = ..., strict: bool = True) -> None: ... def guess_extension(self, type: str, strict: bool = True) -> str | None: ... if sys.version_info >= (3, 8): - def guess_type(self, url: StrPath, strict: bool = ...) -> tuple[str | None, str | None]: ... + def guess_type(self, url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ... else: def guess_type(self, url: str, strict: bool = ...) -> tuple[str | None, str | None]: ... diff --git a/stdlib/modulefinder.pyi b/stdlib/modulefinder.pyi index aab07fa7bd6a..601d374ed35a 100644 --- a/stdlib/modulefinder.pyi +++ b/stdlib/modulefinder.pyi @@ -35,10 +35,10 @@ class ModuleFinder: if sys.version_info >= (3, 8): def __init__( self, - path: list[str] | None = ..., - debug: int = ..., - excludes: Container[str] | None = ..., - replace_paths: Sequence[tuple[str, str]] | None = ..., + path: list[str] | None = None, + debug: int = 0, + excludes: Container[str] | None = None, + replace_paths: Sequence[tuple[str, str]] | None = None, ) -> None: ... else: def __init__( diff --git a/stdlib/multiprocessing/context.pyi b/stdlib/multiprocessing/context.pyi index f4e01ea34c9d..c462be5838f1 100644 --- a/stdlib/multiprocessing/context.pyi +++ b/stdlib/multiprocessing/context.pyi @@ -52,7 +52,7 @@ class BaseContext: # _ConnectionBase is the common base class of Connection and PipeConnection # and can be used in cross-platform code. if sys.platform != "win32": - def Pipe(self, duplex: bool = ...) -> tuple[Connection, Connection]: ... + def Pipe(self, duplex: bool = True) -> tuple[Connection, Connection]: ... else: def Pipe(self, duplex: bool = ...) -> tuple[PipeConnection, PipeConnection]: ... @@ -86,24 +86,24 @@ class BaseContext: @overload def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[False]) -> _CT: ... @overload - def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = True) -> SynchronizedBase[_CT]: ... + def Value(self, typecode_or_type: type[_CT], *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[_CT]: ... @overload - def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = True) -> SynchronizedBase[Any]: ... + def Value(self, typecode_or_type: str, *args: Any, lock: Literal[True] | _LockLike = ...) -> SynchronizedBase[Any]: ... @overload - def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True) -> Any: ... + def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = ...) -> Any: ... @overload def Array(self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False]) -> _CT: ... @overload def Array( - self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True + self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ... ) -> SynchronizedArray[_CT]: ... @overload def Array( - self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True + self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = ... ) -> SynchronizedArray[Any]: ... @overload def Array( - self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = True + self, typecode_or_type: str | type[_CData], size_or_initializer: int | Sequence[Any], *, lock: bool | _LockLike = ... ) -> Any: ... def freeze_support(self) -> None: ... def get_logger(self) -> Logger: ... @@ -131,7 +131,7 @@ class BaseContext: def get_context(self, method: str) -> BaseContext: ... @overload - def get_start_method(self, allow_none: Literal[False] = False) -> str: ... + def get_start_method(self, allow_none: Literal[False] = ...) -> str: ... @overload def get_start_method(self, allow_none: bool) -> str | None: ... def set_start_method(self, method: str | None, force: bool = False) -> None: ... diff --git a/stdlib/multiprocessing/heap.pyi b/stdlib/multiprocessing/heap.pyi index 87284f0e12a4..08ad0a6b8f52 100644 --- a/stdlib/multiprocessing/heap.pyi +++ b/stdlib/multiprocessing/heap.pyi @@ -15,7 +15,7 @@ class Arena: def __init__(self, size: int) -> None: ... else: fd: int - def __init__(self, size: int, fd: int = ...) -> None: ... + def __init__(self, size: int, fd: int = -1) -> None: ... _Block: TypeAlias = tuple[Arena, int, int] diff --git a/stdlib/multiprocessing/managers.pyi b/stdlib/multiprocessing/managers.pyi index be0b5863d034..efee27f91265 100644 --- a/stdlib/multiprocessing/managers.pyi +++ b/stdlib/multiprocessing/managers.pyi @@ -132,10 +132,10 @@ class BaseManager: if sys.version_info >= (3, 11): def __init__( self, - address: Any | None = ..., - authkey: bytes | None = ..., - serializer: str = ..., - ctx: BaseContext | None = ..., + address: Any | None = None, + authkey: bytes | None = None, + serializer: str = "pickle", + ctx: BaseContext | None = None, *, shutdown_timeout: float = ..., ) -> None: ... diff --git a/stdlib/multiprocessing/shared_memory.pyi b/stdlib/multiprocessing/shared_memory.pyi index 841c947360e8..84fb89d8d53f 100644 --- a/stdlib/multiprocessing/shared_memory.pyi +++ b/stdlib/multiprocessing/shared_memory.pyi @@ -24,9 +24,9 @@ class SharedMemory: class ShareableList(Generic[_SLT]): shm: SharedMemory @overload - def __init__(self, sequence: None = None, *, name: str | None = None) -> None: ... + def __init__(self, sequence: None = ..., *, name: str | None = ...) -> None: ... @overload - def __init__(self, sequence: Iterable[_SLT], *, name: str | None = None) -> None: ... + def __init__(self, sequence: Iterable[_SLT], *, name: str | None = ...) -> None: ... def __getitem__(self, position: int) -> _SLT: ... def __setitem__(self, position: int, value: _SLT) -> None: ... def __reduce__(self: Self) -> tuple[Self, tuple[_SLT, ...]]: ... diff --git a/stdlib/numbers.pyi b/stdlib/numbers.pyi index 55f21041ae44..eacd87c00bad 100644 --- a/stdlib/numbers.pyi +++ b/stdlib/numbers.pyi @@ -60,7 +60,7 @@ class Real(Complex, SupportsFloat): def __ceil__(self) -> int: ... @abstractmethod @overload - def __round__(self, ndigits: None = None) -> int: ... + def __round__(self, ndigits: None = ...) -> int: ... @abstractmethod @overload def __round__(self, ndigits: int) -> Any: ... diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index a8c1c4cfb93e..a049fdad71c7 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -240,9 +240,9 @@ class OptionParser(OptionContainer): def get_usage(self) -> str: ... def get_version(self) -> str: ... @overload - def parse_args(self, args: None = None, values: Values | None = None) -> tuple[Values, list[str]]: ... + def parse_args(self, args: None = ..., values: Values | None = ...) -> tuple[Values, list[str]]: ... @overload - def parse_args(self, args: Sequence[AnyStr], values: Values | None = None) -> tuple[Values, list[AnyStr]]: ... + def parse_args(self, args: Sequence[AnyStr], values: Values | None = ...) -> tuple[Values, list[AnyStr]]: ... def print_usage(self, file: IO[str] | None = None) -> None: ... def print_help(self, file: IO[str] | None = None) -> None: ... def print_version(self, file: IO[str] | None = None) -> None: ... diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index 084ff45577ed..fd23484009ff 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -81,8 +81,8 @@ class Path(PurePath): @classmethod def cwd(cls: type[Self]) -> Self: ... if sys.version_info >= (3, 10): - def stat(self, *, follow_symlinks: bool = ...) -> stat_result: ... - def chmod(self, mode: int, *, follow_symlinks: bool = ...) -> None: ... + def stat(self, *, follow_symlinks: bool = True) -> stat_result: ... + def chmod(self, mode: int, *, follow_symlinks: bool = True) -> None: ... else: def stat(self) -> stat_result: ... def chmod(self, mode: int) -> None: ... @@ -106,54 +106,54 @@ class Path(PurePath): @overload def open( self, - mode: OpenTextMode = "r", - buffering: int = -1, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, + mode: OpenTextMode = ..., + buffering: int = ..., + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., ) -> TextIOWrapper: ... # Unbuffered binary mode: returns a FileIO @overload def open( - self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = None, errors: None = None, newline: None = None + self, mode: OpenBinaryMode, buffering: Literal[0], encoding: None = ..., errors: None = ..., newline: None = ... ) -> FileIO: ... # Buffering is on: return BufferedRandom, BufferedReader, or BufferedWriter @overload def open( self, mode: OpenBinaryModeUpdating, - buffering: Literal[-1, 1] = -1, - encoding: None = None, - errors: None = None, - newline: None = None, + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + errors: None = ..., + newline: None = ..., ) -> BufferedRandom: ... @overload def open( self, mode: OpenBinaryModeWriting, - buffering: Literal[-1, 1] = -1, - encoding: None = None, - errors: None = None, - newline: None = None, + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + errors: None = ..., + newline: None = ..., ) -> BufferedWriter: ... @overload def open( self, mode: OpenBinaryModeReading, - buffering: Literal[-1, 1] = -1, - encoding: None = None, - errors: None = None, - newline: None = None, + buffering: Literal[-1, 1] = ..., + encoding: None = ..., + errors: None = ..., + newline: None = ..., ) -> BufferedReader: ... # Buffering cannot be determined: fall back to BinaryIO @overload def open( - self, mode: OpenBinaryMode, buffering: int = -1, encoding: None = None, errors: None = None, newline: None = None + self, mode: OpenBinaryMode, buffering: int = ..., encoding: None = ..., errors: None = ..., newline: None = ... ) -> BinaryIO: ... # Fallback if mode is not specified @overload def open( - self, mode: str, buffering: int = -1, encoding: str | None = None, errors: str | None = None, newline: str | None = None + self, mode: str, buffering: int = ..., encoding: str | None = ..., errors: str | None = ..., newline: str | None = ... ) -> IO[Any]: ... if sys.platform != "win32": # These methods do "exist" on Windows, but they always raise NotImplementedError, @@ -180,7 +180,7 @@ class Path(PurePath): def touch(self, mode: int = 438, exist_ok: bool = True) -> None: ... if sys.version_info >= (3, 8): - def unlink(self, missing_ok: bool = ...) -> None: ... + def unlink(self, missing_ok: bool = False) -> None: ... else: def unlink(self) -> None: ... @@ -194,7 +194,7 @@ class Path(PurePath): def write_bytes(self, data: ReadableBuffer) -> int: ... if sys.version_info >= (3, 10): def write_text( - self, data: str, encoding: str | None = ..., errors: str | None = ..., newline: str | None = ... + self, data: str, encoding: str | None = None, errors: str | None = None, newline: str | None = None ) -> int: ... else: def write_text(self, data: str, encoding: str | None = ..., errors: str | None = ...) -> int: ... diff --git a/stdlib/pprint.pyi b/stdlib/pprint.pyi index d29a24f2382f..c10f9a5a1662 100644 --- a/stdlib/pprint.pyi +++ b/stdlib/pprint.pyi @@ -101,14 +101,14 @@ class PrettyPrinter: if sys.version_info >= (3, 10): def __init__( self, - indent: int = ..., - width: int = ..., - depth: int | None = ..., - stream: IO[str] | None = ..., + indent: int = 1, + width: int = 80, + depth: int | None = None, + stream: IO[str] | None = None, *, - compact: bool = ..., - sort_dicts: bool = ..., - underscore_numbers: bool = ..., + compact: bool = False, + sort_dicts: bool = True, + underscore_numbers: bool = False, ) -> None: ... elif sys.version_info >= (3, 8): def __init__( diff --git a/stdlib/pyclbr.pyi b/stdlib/pyclbr.pyi index eadb7118e269..8b1d923a753f 100644 --- a/stdlib/pyclbr.pyi +++ b/stdlib/pyclbr.pyi @@ -25,9 +25,9 @@ class Class: super_: list[Class | str] | None, file: str, lineno: int, - parent: Class | None = ..., + parent: Class | None = None, *, - end_lineno: int | None = ..., + end_lineno: int | None = None, ) -> None: ... else: def __init__( @@ -54,10 +54,10 @@ class Function: name: str, file: str, lineno: int, - parent: Function | Class | None = ..., - is_async: bool = ..., + parent: Function | Class | None = None, + is_async: bool = False, *, - end_lineno: int | None = ..., + end_lineno: int | None = None, ) -> None: ... else: def __init__(self, module: str, name: str, file: str, lineno: int, parent: Function | Class | None = ...) -> None: ... diff --git a/stdlib/pydoc.pyi b/stdlib/pydoc.pyi index 9319aef1233a..3028c3a90326 100644 --- a/stdlib/pydoc.pyi +++ b/stdlib/pydoc.pyi @@ -75,16 +75,16 @@ class HTMLDoc(Doc): escape = _repr_instance.escape def page(self, title: str, contents: str) -> str: ... if sys.version_info >= (3, 11): - def heading(self, title: str, extras: str = ...) -> str: ... + def heading(self, title: str, extras: str = "") -> str: ... def section( self, title: str, cls: str, contents: str, - width: int = ..., - prelude: str = ..., - marginalia: str | None = ..., - gap: str = ..., + width: int = 6, + prelude: str = "", + marginalia: str | None = None, + gap: str = " ", ) -> str: ... def multicolumn(self, list: list[_T], format: Callable[[_T], str]) -> str: ... else: diff --git a/stdlib/random.pyi b/stdlib/random.pyi index bffb02897ef1..18a9e1813dae 100644 --- a/stdlib/random.pyi +++ b/stdlib/random.pyi @@ -44,7 +44,7 @@ class Random(_random.Random): # Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit # int better documents conventional usage of random.seed. if sys.version_info >= (3, 9): - def seed(self, a: int | float | str | bytes | bytearray | None = ..., version: int = ...) -> None: ... # type: ignore[override] # noqa: Y041 + def seed(self, a: int | float | str | bytes | bytearray | None = None, version: int = 2) -> None: ... # type: ignore[override] # noqa: Y041 else: def seed(self, a: Any = ..., version: int = ...) -> None: ... @@ -69,7 +69,7 @@ class Random(_random.Random): else: def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = ...) -> None: ... if sys.version_info >= (3, 11): - def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = ...) -> list[_T]: ... + def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: ... elif sys.version_info >= (3, 9): def sample( self, population: Sequence[_T] | AbstractSet[_T], k: int, *, counts: Iterable[int] | None = ... diff --git a/stdlib/re.pyi b/stdlib/re.pyi index a6094d457575..4962ab8edad9 100644 --- a/stdlib/re.pyi +++ b/stdlib/re.pyi @@ -113,55 +113,47 @@ class Pattern(Generic[AnyStr]): @property def pattern(self) -> AnyStr: ... @overload - def search(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... + def search(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... @overload - def search( - self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 - ) -> Match[bytes] | None: ... + def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... @overload - def match(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... + def match(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... @overload - def match( - self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 - ) -> Match[bytes] | None: ... + def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... @overload - def fullmatch(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Match[str] | None: ... + def fullmatch(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Match[str] | None: ... @overload - def fullmatch( - self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 - ) -> Match[bytes] | None: ... + def fullmatch(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Match[bytes] | None: ... @overload - def split(self: Pattern[str], string: str, maxsplit: int = 0) -> list[str | Any]: ... + def split(self: Pattern[str], string: str, maxsplit: int = ...) -> list[str | Any]: ... @overload - def split(self: Pattern[bytes], string: ReadableBuffer, maxsplit: int = 0) -> list[bytes | Any]: ... + def split(self: Pattern[bytes], string: ReadableBuffer, maxsplit: int = ...) -> list[bytes | Any]: ... # return type depends on the number of groups in the pattern @overload - def findall(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> list[Any]: ... + def findall(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> list[Any]: ... @overload - def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807) -> list[Any]: ... + def findall(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> list[Any]: ... @overload - def finditer(self: Pattern[str], string: str, pos: int = 0, endpos: int = 9223372036854775807) -> Iterator[Match[str]]: ... + def finditer(self: Pattern[str], string: str, pos: int = ..., endpos: int = ...) -> Iterator[Match[str]]: ... @overload - def finditer( - self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = 9223372036854775807 - ) -> Iterator[Match[bytes]]: ... + def finditer(self: Pattern[bytes], string: ReadableBuffer, pos: int = ..., endpos: int = ...) -> Iterator[Match[bytes]]: ... @overload - def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> str: ... + def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ...) -> str: ... @overload def sub( self: Pattern[bytes], repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], string: ReadableBuffer, - count: int = 0, + count: int = ..., ) -> bytes: ... @overload - def subn(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> tuple[str, int]: ... + def subn(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = ...) -> tuple[str, int]: ... @overload def subn( self: Pattern[bytes], repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer], string: ReadableBuffer, - count: int = 0, + count: int = ..., ) -> tuple[bytes, int]: ... def __copy__(self) -> Pattern[AnyStr]: ... def __deepcopy__(self, __memo: Any) -> Pattern[AnyStr]: ... diff --git a/stdlib/smtplib.pyi b/stdlib/smtplib.pyi index b58808f453fe..8325a4c79677 100644 --- a/stdlib/smtplib.pyi +++ b/stdlib/smtplib.pyi @@ -122,7 +122,7 @@ class SMTP: password: str def auth(self, mechanism: str, authobject: _AuthObject, *, initial_response_ok: bool = True) -> _Reply: ... @overload - def auth_cram_md5(self, challenge: None = None) -> None: ... + def auth_cram_md5(self, challenge: None = ...) -> None: ... @overload def auth_cram_md5(self, challenge: ReadableBuffer) -> str: ... def auth_plain(self, challenge: ReadableBuffer | None = None) -> str: ... @@ -170,10 +170,10 @@ class LMTP(SMTP): if sys.version_info >= (3, 9): def __init__( self, - host: str = ..., - port: int = ..., - local_hostname: str | None = ..., - source_address: _SourceAddress | None = ..., + host: str = "", + port: int = 2003, + local_hostname: str | None = None, + source_address: _SourceAddress | None = None, timeout: float = ..., ) -> None: ... else: diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index 66a99d67df06..2e75984212e8 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -669,39 +669,39 @@ class socket(_socket.socket): mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], buffering: Literal[0], *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., ) -> SocketIO: ... @overload def makefile( self, mode: Literal["rwb", "rbw", "wrb", "wbr", "brw", "bwr"], - buffering: Literal[-1, 1] | None = None, + buffering: Literal[-1, 1] | None = ..., *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., ) -> BufferedRWPair: ... @overload def makefile( self, mode: Literal["rb", "br"], - buffering: Literal[-1, 1] | None = None, + buffering: Literal[-1, 1] | None = ..., *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., ) -> BufferedReader: ... @overload def makefile( self, mode: Literal["wb", "bw"], - buffering: Literal[-1, 1] | None = None, + buffering: Literal[-1, 1] | None = ..., *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., ) -> BufferedWriter: ... @overload def makefile( @@ -709,19 +709,19 @@ class socket(_socket.socket): mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"], buffering: int, *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., ) -> IOBase: ... @overload def makefile( self, - mode: Literal["r", "w", "rw", "wr", ""] = "r", - buffering: int | None = None, + mode: Literal["r", "w", "rw", "wr", ""] = ..., + buffering: int | None = ..., *, - encoding: str | None = None, - errors: str | None = None, - newline: str | None = None, + encoding: str | None = ..., + errors: str | None = ..., + newline: str | None = ..., ) -> TextIOWrapper: ... def sendfile(self, file: _SendableFile, offset: int = 0, count: int | None = None) -> int: ... @property diff --git a/stdlib/sqlite3/dbapi2.pyi b/stdlib/sqlite3/dbapi2.pyi index d4799e62d54b..d018c2dd5532 100644 --- a/stdlib/sqlite3/dbapi2.pyi +++ b/stdlib/sqlite3/dbapi2.pyi @@ -294,7 +294,7 @@ class Connection: ) -> None: ... def close(self) -> None: ... if sys.version_info >= (3, 11): - def blobopen(self, __table: str, __column: str, __row: int, *, readonly: bool = ..., name: str = ...) -> Blob: ... + def blobopen(self, __table: str, __column: str, __row: int, *, readonly: bool = False, name: str = "main") -> Blob: ... def commit(self) -> None: ... def create_aggregate(self, name: str, n_arg: int, aggregate_class: Callable[[], _AggregateProtocol]) -> None: ... @@ -318,7 +318,7 @@ class Connection: def create_collation(self, __name: str, __callback: Callable[[str, str], int | SupportsIndex] | None) -> None: ... if sys.version_info >= (3, 8): def create_function( - self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = ... + self, name: str, narg: int, func: Callable[..., _SqliteData] | None, *, deterministic: bool = False ) -> None: ... else: def create_function(self, name: str, num_params: int, func: Callable[..., _SqliteData] | None) -> None: ... @@ -354,8 +354,8 @@ class Connection: if sys.version_info >= (3, 11): def setlimit(self, __category: int, __limit: int) -> int: ... def getlimit(self, __category: int) -> int: ... - def serialize(self, *, name: str = ...) -> bytes: ... - def deserialize(self, __data: ReadableBuffer, *, name: str = ...) -> None: ... + def serialize(self, *, name: str = "main") -> bytes: ... + def deserialize(self, __data: ReadableBuffer, *, name: str = "main") -> None: ... def __call__(self, __sql: str) -> _Statement: ... def __enter__(self: Self) -> Self: ... diff --git a/stdlib/sre_parse.pyi b/stdlib/sre_parse.pyi index 9c055e32bd0a..e137e191c08d 100644 --- a/stdlib/sre_parse.pyi +++ b/stdlib/sre_parse.pyi @@ -52,7 +52,7 @@ class SubPattern: if sys.version_info >= (3, 8): state: State - def __init__(self, state: State, data: list[_CodeType] | None = ...) -> None: ... + def __init__(self, state: State, data: list[_CodeType] | None = None) -> None: ... else: pattern: Pattern def __init__(self, pattern: Pattern, data: list[_CodeType] | None = ...) -> None: ... diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index 2795522f9ba1..ab7ab143299c 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -324,7 +324,7 @@ class SSLSocket(socket.socket): def send(self, data: ReadableBuffer, flags: int = 0) -> int: ... def sendall(self, data: ReadableBuffer, flags: int = 0) -> None: ... @overload - def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = None) -> int: ... + def sendto(self, data: ReadableBuffer, flags_or_addr: socket._Address, addr: None = ...) -> int: ... @overload def sendto(self, data: ReadableBuffer, flags_or_addr: int, addr: socket._Address) -> int: ... def shutdown(self, how: int) -> None: ... @@ -332,7 +332,7 @@ class SSLSocket(socket.socket): def write(self, data: ReadableBuffer) -> int: ... def do_handshake(self, block: bool = False) -> None: ... # block is undocumented @overload - def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ... + def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ... @overload def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload @@ -391,11 +391,11 @@ class SSLContext: cadata: str | ReadableBuffer | None = None, ) -> None: ... @overload - def get_ca_certs(self, binary_form: Literal[False] = False) -> list[_PeerCertRetDictType]: ... + def get_ca_certs(self, binary_form: Literal[False] = ...) -> list[_PeerCertRetDictType]: ... @overload def get_ca_certs(self, binary_form: Literal[True]) -> list[bytes]: ... @overload - def get_ca_certs(self, binary_form: bool = False) -> Any: ... + def get_ca_certs(self, binary_form: bool = ...) -> Any: ... def get_ciphers(self) -> list[_Cipher]: ... def set_default_verify_paths(self) -> None: ... def set_ciphers(self, __cipherlist: str) -> None: ... @@ -436,7 +436,7 @@ class SSLObject: def read(self, len: int = 1024, buffer: bytearray | None = None) -> bytes: ... def write(self, data: ReadableBuffer) -> int: ... @overload - def getpeercert(self, binary_form: Literal[False] = False) -> _PeerCertRetDictType | None: ... + def getpeercert(self, binary_form: Literal[False] = ...) -> _PeerCertRetDictType | None: ... @overload def getpeercert(self, binary_form: Literal[True]) -> bytes | None: ... @overload diff --git a/stdlib/symtable.pyi b/stdlib/symtable.pyi index 98b62edbfc6a..84d3110f9342 100644 --- a/stdlib/symtable.pyi +++ b/stdlib/symtable.pyi @@ -38,7 +38,7 @@ class Class(SymbolTable): class Symbol: if sys.version_info >= (3, 8): def __init__( - self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = ..., *, module_scope: bool = ... + self, name: str, flags: int, namespaces: Sequence[SymbolTable] | None = None, *, module_scope: bool = False ) -> None: ... def is_nonlocal(self) -> bool: ... else: diff --git a/stdlib/tarfile.pyi b/stdlib/tarfile.pyi index a465df6cb1f8..656d024761c0 100644 --- a/stdlib/tarfile.pyi +++ b/stdlib/tarfile.pyi @@ -186,9 +186,9 @@ class TarFile: def gzopen( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r"] = "r", - fileobj: _GzipReadableFileobj | None = None, - compresslevel: int = 9, + mode: Literal["r"] = ..., + fileobj: _GzipReadableFileobj | None = ..., + compresslevel: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -205,8 +205,8 @@ class TarFile: cls: type[Self], name: StrOrBytesPath | None, mode: Literal["w", "x"], - fileobj: _GzipWritableFileobj | None = None, - compresslevel: int = 9, + fileobj: _GzipWritableFileobj | None = ..., + compresslevel: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -223,8 +223,8 @@ class TarFile: cls: type[Self], name: StrOrBytesPath | None, mode: Literal["w", "x"], - fileobj: _Bz2WritableFileobj | None = None, - compresslevel: int = 9, + fileobj: _Bz2WritableFileobj | None = ..., + compresslevel: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., @@ -240,9 +240,9 @@ class TarFile: def bz2open( cls: type[Self], name: StrOrBytesPath | None, - mode: Literal["r"] = "r", - fileobj: _Bz2ReadableFileobj | None = None, - compresslevel: int = 9, + mode: Literal["r"] = ..., + fileobj: _Bz2ReadableFileobj | None = ..., + compresslevel: int = ..., *, format: int | None = ..., tarinfo: type[TarInfo] | None = ..., diff --git a/stdlib/threading.pyi b/stdlib/threading.pyi index 66262715bcd7..c0b344fe757d 100644 --- a/stdlib/threading.pyi +++ b/stdlib/threading.pyi @@ -139,7 +139,7 @@ class Semaphore: def acquire(self, blocking: bool = True, timeout: float | None = None) -> bool: ... def __enter__(self, blocking: bool = True, timeout: float | None = None) -> bool: ... if sys.version_info >= (3, 9): - def release(self, n: int = ...) -> None: ... + def release(self, n: int = 1) -> None: ... else: def release(self) -> None: ... diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index 7688f3fb38d1..d289cf690992 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -119,13 +119,13 @@ class TracebackException: exc_value: BaseException, exc_traceback: TracebackType | None, *, - limit: int | None = ..., - lookup_lines: bool = ..., - capture_locals: bool = ..., - compact: bool = ..., - max_group_width: int = ..., - max_group_depth: int = ..., - _seen: set[int] | None = ..., + limit: int | None = None, + lookup_lines: bool = True, + capture_locals: bool = False, + compact: bool = False, + max_group_width: int = 15, + max_group_depth: int = 10, + _seen: set[int] | None = None, ) -> None: ... @classmethod def from_exception( @@ -181,14 +181,14 @@ class TracebackException: def __eq__(self, other: object) -> bool: ... if sys.version_info >= (3, 11): - def format(self, *, chain: bool = ..., _ctx: _ExceptionPrintContext | None = ...) -> Generator[str, None, None]: ... + def format(self, *, chain: bool = True, _ctx: _ExceptionPrintContext | None = None) -> Generator[str, None, None]: ... else: def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ... def format_exception_only(self) -> Generator[str, None, None]: ... if sys.version_info >= (3, 11): - def print(self, *, file: SupportsWrite[str] | None = ..., chain: bool = ...) -> None: ... + def print(self, *, file: SupportsWrite[str] | None = None, chain: bool = True) -> None: ... class FrameSummary(Iterable[Any]): if sys.version_info >= (3, 11): @@ -198,12 +198,12 @@ class FrameSummary(Iterable[Any]): lineno: int | None, name: str, *, - lookup_line: bool = ..., - locals: Mapping[str, str] | None = ..., - line: str | None = ..., - end_lineno: int | None = ..., - colno: int | None = ..., - end_colno: int | None = ..., + lookup_line: bool = True, + locals: Mapping[str, str] | None = None, + line: str | None = None, + end_lineno: int | None = None, + colno: int | None = None, + end_colno: int | None = None, ) -> None: ... end_lineno: int | None colno: int | None diff --git a/stdlib/tracemalloc.pyi b/stdlib/tracemalloc.pyi index 17a86196077f..d7214de285f8 100644 --- a/stdlib/tracemalloc.pyi +++ b/stdlib/tracemalloc.pyi @@ -85,7 +85,7 @@ class Traceback(Sequence[Frame]): if sys.version_info >= (3, 9): @property def total_nframe(self) -> int | None: ... - def __init__(self, frames: Sequence[_FrameTuple], total_nframe: int | None = ...) -> None: ... + def __init__(self, frames: Sequence[_FrameTuple], total_nframe: int | None = None) -> None: ... else: def __init__(self, frames: Sequence[_FrameTuple]) -> None: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 1cec917dc326..e8cfd2d736f2 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -241,24 +241,24 @@ class CodeType: def replace( self, *, - co_argcount: int = ..., - co_posonlyargcount: int = ..., - co_kwonlyargcount: int = ..., - co_nlocals: int = ..., - co_stacksize: int = ..., - co_flags: int = ..., - co_firstlineno: int = ..., - co_code: bytes = ..., - co_consts: tuple[object, ...] = ..., - co_names: tuple[str, ...] = ..., - co_varnames: tuple[str, ...] = ..., - co_freevars: tuple[str, ...] = ..., - co_cellvars: tuple[str, ...] = ..., - co_filename: str = ..., - co_name: str = ..., - co_qualname: str = ..., - co_linetable: bytes = ..., - co_exceptiontable: bytes = ..., + co_argcount: int = -1, + co_posonlyargcount: int = -1, + co_kwonlyargcount: int = -1, + co_nlocals: int = -1, + co_stacksize: int = -1, + co_flags: int = -1, + co_firstlineno: int = -1, + co_code: bytes = None, + co_consts: tuple[object, ...] = None, + co_names: tuple[str, ...] = None, + co_varnames: tuple[str, ...] = None, + co_freevars: tuple[str, ...] = None, + co_cellvars: tuple[str, ...] = None, + co_filename: str = None, + co_name: str = None, + co_qualname: str = None, + co_linetable: bytes = None, + co_exceptiontable: bytes = None, ) -> CodeType: ... elif sys.version_info >= (3, 10): def replace( diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index f6526a44a4ef..9670c9d6a74a 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -823,7 +823,7 @@ class ForwardRef: __forward_module__: Any | None if sys.version_info >= (3, 9): # The module and is_class arguments were added in later Python 3.9 versions. - def __init__(self, arg: str, is_argument: bool = ..., module: Any | None = ..., *, is_class: bool = ...) -> None: ... + def __init__(self, arg: str, is_argument: bool = True, module: Any | None = None, *, is_class: bool = False) -> None: ... else: def __init__(self, arg: str, is_argument: bool = ...) -> None: ... diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index 723fe0c30b8c..84bda6873710 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -123,21 +123,21 @@ class TestCase: def assertIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = None) -> None: ... def assertNotIsInstance(self, obj: object, cls: _IsInstanceClassInfo, msg: Any = None) -> None: ... @overload - def assertGreater(self, a: SupportsDunderGT[_T], b: _T, msg: Any = None) -> None: ... + def assertGreater(self, a: SupportsDunderGT[_T], b: _T, msg: Any = ...) -> None: ... @overload - def assertGreater(self, a: _T, b: SupportsDunderLT[_T], msg: Any = None) -> None: ... + def assertGreater(self, a: _T, b: SupportsDunderLT[_T], msg: Any = ...) -> None: ... @overload - def assertGreaterEqual(self, a: SupportsDunderGE[_T], b: _T, msg: Any = None) -> None: ... + def assertGreaterEqual(self, a: SupportsDunderGE[_T], b: _T, msg: Any = ...) -> None: ... @overload - def assertGreaterEqual(self, a: _T, b: SupportsDunderLE[_T], msg: Any = None) -> None: ... + def assertGreaterEqual(self, a: _T, b: SupportsDunderLE[_T], msg: Any = ...) -> None: ... @overload - def assertLess(self, a: SupportsDunderLT[_T], b: _T, msg: Any = None) -> None: ... + def assertLess(self, a: SupportsDunderLT[_T], b: _T, msg: Any = ...) -> None: ... @overload - def assertLess(self, a: _T, b: SupportsDunderGT[_T], msg: Any = None) -> None: ... + def assertLess(self, a: _T, b: SupportsDunderGT[_T], msg: Any = ...) -> None: ... @overload - def assertLessEqual(self, a: SupportsDunderLT[_T], b: _T, msg: Any = None) -> None: ... + def assertLessEqual(self, a: SupportsDunderLT[_T], b: _T, msg: Any = ...) -> None: ... @overload - def assertLessEqual(self, a: _T, b: SupportsDunderGT[_T], msg: Any = None) -> None: ... + def assertLessEqual(self, a: _T, b: SupportsDunderGT[_T], msg: Any = ...) -> None: ... # `assertRaises`, `assertRaisesRegex`, and `assertRaisesRegexp` # are not using `ParamSpec` intentionally, # because they might be used with explicitly wrong arg types to raise some error in tests. @@ -196,56 +196,56 @@ class TestCase: ) -> _AssertLogsContext[_LoggingWatcher]: ... if sys.version_info >= (3, 10): def assertNoLogs( - self, logger: str | logging.Logger | None = ..., level: int | str | None = ... + self, logger: str | logging.Logger | None = None, level: int | str | None = None ) -> _AssertLogsContext[None]: ... @overload def assertAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload def assertAlmostEqual( - self, first: _S, second: _S, places: None = None, msg: Any = None, *, delta: _SupportsAbsAndDunderGE + self, first: _S, second: _S, places: None = ..., msg: Any = ..., *, delta: _SupportsAbsAndDunderGE ) -> None: ... @overload def assertAlmostEqual( self, first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]], second: _T, - places: int | None = None, - msg: Any = None, - delta: None = None, + places: int | None = ..., + msg: Any = ..., + delta: None = ..., ) -> None: ... @overload def assertAlmostEqual( self, first: _T, second: SupportsRSub[_T, SupportsAbs[SupportsRound[object]]], - places: int | None = None, - msg: Any = None, - delta: None = None, + places: int | None = ..., + msg: Any = ..., + delta: None = ..., ) -> None: ... @overload def assertNotAlmostEqual(self, first: _S, second: _S, places: None, msg: Any, delta: _SupportsAbsAndDunderGE) -> None: ... @overload def assertNotAlmostEqual( - self, first: _S, second: _S, places: None = None, msg: Any = None, *, delta: _SupportsAbsAndDunderGE + self, first: _S, second: _S, places: None = ..., msg: Any = ..., *, delta: _SupportsAbsAndDunderGE ) -> None: ... @overload def assertNotAlmostEqual( self, first: SupportsSub[_T, SupportsAbs[SupportsRound[object]]], second: _T, - places: int | None = None, - msg: Any = None, - delta: None = None, + places: int | None = ..., + msg: Any = ..., + delta: None = ..., ) -> None: ... @overload def assertNotAlmostEqual( self, first: _T, second: SupportsRSub[_T, SupportsAbs[SupportsRound[object]]], - places: int | None = None, - msg: Any = None, - delta: None = None, + places: int | None = ..., + msg: Any = ..., + delta: None = ..., ) -> None: ... def assertRegex(self, text: AnyStr, expected_regex: AnyStr | Pattern[AnyStr], msg: Any = None) -> None: ... def assertNotRegex(self, text: AnyStr, unexpected_regex: AnyStr | Pattern[AnyStr], msg: Any = None) -> None: ... @@ -302,7 +302,7 @@ class TestCase: assertNotRegexpMatches = assertNotRegex assertRaisesRegexp = assertRaisesRegex def assertDictContainsSubset( - self, subset: Mapping[Any, Any], dictionary: Mapping[Any, Any], msg: object = ... + self, subset: Mapping[Any, Any], dictionary: Mapping[Any, Any], msg: object = None ) -> None: ... class FunctionTestCase(TestCase): diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index d86afc7dc8f7..67fcc41ade71 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -129,11 +129,11 @@ class NonCallableMock(Base, Any): def __setattr__(self, name: str, value: Any) -> None: ... def __dir__(self) -> list[str]: ... if sys.version_info >= (3, 8): - def _calls_repr(self, prefix: str = ...) -> str: ... + def _calls_repr(self, prefix: str = "Calls") -> str: ... def assert_called_with(self, *args: Any, **kwargs: Any) -> None: ... def assert_not_called(self) -> None: ... def assert_called_once_with(self, *args: Any, **kwargs: Any) -> None: ... - def _format_mock_failure_message(self, args: Any, kwargs: Any, action: str = ...) -> str: ... + def _format_mock_failure_message(self, args: Any, kwargs: Any, action: str = "call") -> str: ... else: def assert_called_with(_mock_self, *args: Any, **kwargs: Any) -> None: ... def assert_not_called(_mock_self) -> None: ... @@ -217,7 +217,7 @@ class _patch(Generic[_T]): new_callable: Any | None, kwargs: Mapping[str, Any], *, - unsafe: bool = ..., + unsafe: bool = False, ) -> None: ... else: def __init__( @@ -432,7 +432,7 @@ def mock_open(mock: Any | None = None, read_data: Any = "") -> Any: ... class PropertyMock(Mock): if sys.version_info >= (3, 8): - def __get__(self: Self, obj: _T, obj_type: type[_T] | None = ...) -> Self: ... + def __get__(self: Self, obj: _T, obj_type: type[_T] | None = None) -> Self: ... else: def __get__(self: Self, obj: _T, obj_type: type[_T] | None) -> Self: ... diff --git a/stdlib/urllib/request.pyi b/stdlib/urllib/request.pyi index 2c4a4858b4bd..23ceb1334cff 100644 --- a/stdlib/urllib/request.pyi +++ b/stdlib/urllib/request.pyi @@ -344,7 +344,7 @@ class FancyURLopener(URLopener): ) -> _UrlopenRet | addinfourl | None: ... # undocumented if sys.version_info >= (3, 11): def http_error_308( - self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = ... + self, url: str, fp: IO[bytes], errcode: int, errmsg: str, headers: HTTPMessage, data: ReadableBuffer | None = None ) -> _UrlopenRet | addinfourl | None: ... # undocumented def http_error_401( diff --git a/stdlib/venv/__init__.pyi b/stdlib/venv/__init__.pyi index 74a8f67e5553..4d67a53ee602 100644 --- a/stdlib/venv/__init__.pyi +++ b/stdlib/venv/__init__.pyi @@ -20,13 +20,13 @@ class EnvBuilder: if sys.version_info >= (3, 9): def __init__( self, - system_site_packages: bool = ..., - clear: bool = ..., - symlinks: bool = ..., - upgrade: bool = ..., - with_pip: bool = ..., - prompt: str | None = ..., - upgrade_deps: bool = ..., + system_site_packages: bool = False, + clear: bool = False, + symlinks: bool = False, + upgrade: bool = False, + with_pip: bool = False, + prompt: str | None = None, + upgrade_deps: bool = False, ) -> None: ... else: def __init__( diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index a1a079d1a159..a45919804268 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -92,7 +92,7 @@ class KeyedRef(ref[_T], Generic[_KT, _T]): class WeakKeyDictionary(MutableMapping[_KT, _VT]): @overload - def __init__(self, dict: None = None) -> None: ... + def __init__(self, dict: None = ...) -> None: ... @overload def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ... def __len__(self) -> int: ... diff --git a/stdlib/wsgiref/headers.pyi b/stdlib/wsgiref/headers.pyi index 2654d79bf4e5..664ed947fc72 100644 --- a/stdlib/wsgiref/headers.pyi +++ b/stdlib/wsgiref/headers.pyi @@ -17,7 +17,7 @@ class Headers: @overload def get(self, name: str, default: str) -> str: ... @overload - def get(self, name: str, default: str | None = None) -> str | None: ... + def get(self, name: str, default: str | None = ...) -> str | None: ... def keys(self) -> list[str]: ... def values(self) -> list[str]: ... def items(self) -> _HeaderList: ... diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index 6cdbdbf2e226..7b008f30144f 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -24,8 +24,10 @@ class Node(xml.dom.Node): def localName(self) -> str | None: ... def __bool__(self) -> Literal[True]: ... if sys.version_info >= (3, 9): - def toxml(self, encoding: str | None = ..., standalone: bool | None = ...): ... - def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: str | None = ..., standalone: bool | None = ...): ... + def toxml(self, encoding: str | None = None, standalone: bool | None = None): ... + def toprettyxml( + self, indent: str = "\t", newl: str = "\n", encoding: str | None = None, standalone: bool | None = None + ): ... else: def toxml(self, encoding: str | None = ...): ... def toprettyxml(self, indent: str = ..., newl: str = ..., encoding: str | None = ...): ... @@ -321,11 +323,11 @@ class Document(Node, DocumentLS): def writexml( self, writer: SupportsWrite[str], - indent: str = ..., - addindent: str = ..., - newl: str = ..., - encoding: str | None = ..., - standalone: bool | None = ..., + indent: str = "", + addindent: str = "", + newl: str = "", + encoding: str | None = None, + standalone: bool | None = None, ) -> None: ... else: def writexml( diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index 9a05279f770d..38a4ea07d12b 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -93,11 +93,11 @@ class Element: def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... @overload - def findtext(self, path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ... + def findtext(self, path: str, default: None = ..., namespaces: dict[str, str] | None = ...) -> str | None: ... @overload - def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = None) -> _T | str: ... + def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = ...) -> _T | str: ... @overload - def get(self, key: str, default: None = None) -> str | None: ... + def get(self, key: str, default: None = ...) -> str | None: ... @overload def get(self, key: str, default: _T) -> str | _T: ... def insert(self, __index: int, __subelement: Element) -> None: ... @@ -153,9 +153,9 @@ class ElementTree: def find(self, path: str, namespaces: dict[str, str] | None = None) -> Element | None: ... @overload - def findtext(self, path: str, default: None = None, namespaces: dict[str, str] | None = None) -> str | None: ... + def findtext(self, path: str, default: None = ..., namespaces: dict[str, str] | None = ...) -> str | None: ... @overload - def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = None) -> _T | str: ... + def findtext(self, path: str, default: _T, namespaces: dict[str, str] | None = ...) -> _T | str: ... def findall(self, path: str, namespaces: dict[str, str] | None = None) -> list[Element]: ... def iterfind(self, path: str, namespaces: dict[str, str] | None = None) -> Generator[Element, None, None]: ... def write( diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index ffb436dc00be..bd4cf62a0d40 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -241,7 +241,7 @@ class Transport: if sys.version_info >= (3, 8): def __init__( - self, use_datetime: bool = ..., use_builtin_types: bool = ..., *, headers: Iterable[tuple[str, str]] = ... + self, use_datetime: bool = False, use_builtin_types: bool = False, *, headers: Iterable[tuple[str, str]] = ... ) -> None: ... else: def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ...) -> None: ... @@ -268,11 +268,11 @@ class SafeTransport(Transport): if sys.version_info >= (3, 8): def __init__( self, - use_datetime: bool = ..., - use_builtin_types: bool = ..., + use_datetime: bool = False, + use_builtin_types: bool = False, *, headers: Iterable[tuple[str, str]] = ..., - context: Any | None = ..., + context: Any | None = None, ) -> None: ... else: def __init__(self, use_datetime: bool = ..., use_builtin_types: bool = ..., *, context: Any | None = ...) -> None: ... @@ -292,15 +292,15 @@ class ServerProxy: def __init__( self, uri: str, - transport: Transport | None = ..., - encoding: str | None = ..., - verbose: bool = ..., - allow_none: bool = ..., - use_datetime: bool = ..., - use_builtin_types: bool = ..., + transport: Transport | None = None, + encoding: str | None = None, + verbose: bool = False, + allow_none: bool = False, + use_datetime: bool = False, + use_builtin_types: bool = False, *, headers: Iterable[tuple[str, str]] = ..., - context: Any | None = ..., + context: Any | None = None, ) -> None: ... else: def __init__( diff --git a/stdlib/zipfile.pyi b/stdlib/zipfile.pyi index 31e4a9bc6de7..c4c33d5d2876 100644 --- a/stdlib/zipfile.pyi +++ b/stdlib/zipfile.pyi @@ -70,7 +70,7 @@ class ZipExtFile(io.BufferedIOBase): fileobj: _ClosableZipStream, mode: _ReadWriteMode, zipinfo: ZipInfo, - pwd: bytes | None = None, + pwd: bytes | None = ..., *, close_fileobj: Literal[True], ) -> None: ... @@ -80,8 +80,8 @@ class ZipExtFile(io.BufferedIOBase): fileobj: _ZipStream, mode: _ReadWriteMode, zipinfo: ZipInfo, - pwd: bytes | None = None, - close_fileobj: Literal[False] = False, + pwd: bytes | None = ..., + close_fileobj: Literal[False] = ..., ) -> None: ... def read(self, n: int | None = -1) -> bytes: ... def readline(self, limit: int = -1) -> bytes: ... # type: ignore[override] @@ -184,7 +184,7 @@ class ZipFile: compresslevel: int | None = None, ) -> None: ... if sys.version_info >= (3, 11): - def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = ...) -> None: ... + def mkdir(self, zinfo_or_directory_name: str | ZipInfo, mode: int = 511) -> None: ... class PyZipFile(ZipFile): def __init__( @@ -215,7 +215,7 @@ class ZipInfo: if sys.version_info >= (3, 8): @classmethod def from_file( - cls: type[Self], filename: StrPath, arcname: StrPath | None = ..., *, strict_timestamps: bool = ... + cls: type[Self], filename: StrPath, arcname: StrPath | None = None, *, strict_timestamps: bool = True ) -> Self: ... else: @classmethod @@ -246,7 +246,9 @@ if sys.version_info >= (3, 8): def __init__(self, root: ZipFile | StrPath | IO[bytes], at: str = "") -> None: ... if sys.version_info >= (3, 9): - def open(self, mode: _ReadWriteBinaryMode = ..., *args: Any, pwd: bytes | None = ..., **kwargs: Any) -> IO[bytes]: ... + def open( + self, mode: _ReadWriteBinaryMode = "r", *args: Any, pwd: bytes | None = None, **kwargs: Any + ) -> IO[bytes]: ... else: @property def open(self) -> _PathOpenProtocol: ... diff --git a/stdlib/zipimport.pyi b/stdlib/zipimport.pyi index fb0b450f9e56..ee97faace379 100644 --- a/stdlib/zipimport.pyi +++ b/stdlib/zipimport.pyi @@ -27,5 +27,5 @@ class zipimporter: def is_package(self, fullname: str) -> bool: ... def load_module(self, fullname: str) -> ModuleType: ... if sys.version_info >= (3, 10): - def find_spec(self, fullname: str, target: ModuleType | None = ...) -> ModuleSpec | None: ... + def find_spec(self, fullname: str, target: ModuleType | None = None) -> ModuleSpec | None: ... def invalidate_caches(self) -> None: ... From 9b9bea4aeb9f0e1c97c4db416482a0fad73faf8f Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 17 Jan 2023 22:17:29 -0800 Subject: [PATCH 13/16] undo incorrect ones --- stdlib/asyncio/base_events.pyi | 2 +- stdlib/collections/__init__.pyi | 2 +- stdlib/email/message.pyi | 18 +++++++----------- stdlib/ssl.pyi | 2 +- stdlib/typing.pyi | 2 +- stdlib/urllib/parse.pyi | 2 +- stdlib/weakref.pyi | 4 ++-- 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/stdlib/asyncio/base_events.pyi b/stdlib/asyncio/base_events.pyi index 7d8b2a84c25b..70e345121e65 100644 --- a/stdlib/asyncio/base_events.pyi +++ b/stdlib/asyncio/base_events.pyi @@ -399,7 +399,7 @@ class BaseEventLoop(AbstractEventLoop): stdout: int | IO[Any] | None = -1, stderr: int | IO[Any] | None = -1, universal_newlines: Literal[False] = False, - shell: Literal[True] = False, + shell: Literal[True] = ..., bufsize: Literal[0] = 0, encoding: None = None, errors: None = None, diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 8c8154b80ed6..f524293af054 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -409,7 +409,7 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __contains__(self, key: object) -> bool: ... def __missing__(self, key: _KT) -> _VT: ... # undocumented def __bool__(self) -> bool: ... - def setdefault(self, key: _KT, default: _VT = None) -> _VT: ... + def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... @overload def pop(self, key: _KT) -> _VT: ... @overload diff --git a/stdlib/email/message.pyi b/stdlib/email/message.pyi index 5eef05828699..8ea834c4cf93 100644 --- a/stdlib/email/message.pyi +++ b/stdlib/email/message.pyi @@ -38,8 +38,8 @@ class Message: def keys(self) -> list[str]: ... def values(self) -> list[_HeaderType]: ... def items(self) -> list[tuple[str, _HeaderType]]: ... - def get(self, name: str, failobj: _T = None) -> _HeaderType | _T: ... - def get_all(self, name: str, failobj: _T = None) -> list[_HeaderType] | _T: ... + def get(self, name: str, failobj: _T = ...) -> _HeaderType | _T: ... + def get_all(self, name: str, failobj: _T = ...) -> list[_HeaderType] | _T: ... def add_header(self, _name: str, _value: str, **_params: _ParamsType) -> None: ... def replace_header(self, _name: str, _value: _HeaderType) -> None: ... def get_content_type(self) -> str: ... @@ -47,22 +47,18 @@ class Message: def get_content_subtype(self) -> str: ... def get_default_type(self) -> str: ... def set_default_type(self, ctype: str) -> None: ... - def get_params( - self, failobj: _T = None, header: str = "content-type", unquote: bool = True - ) -> list[tuple[str, str]] | _T: ... - def get_param( - self, param: str, failobj: _T = None, header: str = "content-type", unquote: bool = True - ) -> _T | _ParamType: ... + def get_params(self, failobj: _T = ..., header: str = "content-type", unquote: bool = True) -> list[tuple[str, str]] | _T: ... + def get_param(self, param: str, failobj: _T = ..., header: str = "content-type", unquote: bool = True) -> _T | _ParamType: ... def del_param(self, param: str, header: str = "content-type", requote: bool = True) -> None: ... def set_type(self, type: str, header: str = "Content-Type", requote: bool = True) -> None: ... - def get_filename(self, failobj: _T = None) -> _T | str: ... - def get_boundary(self, failobj: _T = None) -> _T | str: ... + def get_filename(self, failobj: _T = ...) -> _T | str: ... + def get_boundary(self, failobj: _T = ...) -> _T | str: ... def set_boundary(self, boundary: str) -> None: ... @overload def get_content_charset(self) -> str | None: ... @overload def get_content_charset(self, failobj: _T) -> str | _T: ... - def get_charsets(self, failobj: _T = None) -> _T | list[str]: ... + def get_charsets(self, failobj: _T = ...) -> _T | list[str]: ... def walk(self: Self) -> Generator[Self, None, None]: ... def get_content_disposition(self) -> str | None: ... def as_string(self, unixfrom: bool = False, maxheaderlen: int = 0, policy: Policy | None = None) -> str: ... diff --git a/stdlib/ssl.pyi b/stdlib/ssl.pyi index ab7ab143299c..b2b57e6a9802 100644 --- a/stdlib/ssl.pyi +++ b/stdlib/ssl.pyi @@ -378,7 +378,7 @@ class SSLContext: if sys.version_info >= (3, 8): keylog_filename: str post_handshake_auth: bool - def __new__(cls: type[Self], protocol: int = None, *args: Any, **kwargs: Any) -> Self: ... + def __new__(cls: type[Self], protocol: int = ..., *args: Any, **kwargs: Any) -> Self: ... def cert_store_stats(self) -> dict[str, int]: ... def load_cert_chain( self, certfile: StrOrBytesPath, keyfile: StrOrBytesPath | None = None, password: _PasswordType | None = None diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 9670c9d6a74a..8d3531941d56 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -467,7 +467,7 @@ class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]): @abstractmethod def __getitem__(self, index: slice) -> Sequence[_T_co]: ... # Mixin methods - def index(self, value: Any, start: int = 0, stop: int = None) -> int: ... + def index(self, value: Any, start: int = 0, stop: int = ...) -> int: ... def count(self, value: Any) -> int: ... def __contains__(self, value: object) -> bool: ... def __iter__(self) -> Iterator[_T_co]: ... diff --git a/stdlib/urllib/parse.pyi b/stdlib/urllib/parse.pyi index 5aec2b3133cc..4d5c69937808 100644 --- a/stdlib/urllib/parse.pyi +++ b/stdlib/urllib/parse.pyi @@ -159,7 +159,7 @@ _Q = TypeVar("_Q", bound=str | Iterable[int]) def urlencode( query: Mapping[Any, Any] | Mapping[Any, Sequence[Any]] | Sequence[tuple[Any, Any]] | Sequence[tuple[Any, Sequence[Any]]], doseq: bool = False, - safe: _Q = "", + safe: _Q = ..., encoding: str | None = None, errors: str | None = None, quote_via: Callable[[AnyStr, _Q, str, str], str] = ..., diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index a45919804268..583dfdb69d6b 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -70,7 +70,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ... - def setdefault(self, key: _KT, default: _VT = None) -> _VT: ... + def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... @overload def pop(self, key: _KT) -> _VT: ... @overload @@ -109,7 +109,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def values(self) -> Iterator[_VT]: ... # type: ignore[override] def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def keyrefs(self) -> list[ref[_KT]]: ... - def setdefault(self, key: _KT, default: _VT = None) -> _VT: ... + def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... @overload def pop(self, key: _KT) -> _VT: ... @overload From 6714e565285747d56a600b1471d3bb68c55243bc Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 17 Jan 2023 22:22:03 -0800 Subject: [PATCH 14/16] more in 3.11 --- stdlib/types.pyi | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/stdlib/types.pyi b/stdlib/types.pyi index e8cfd2d736f2..d4069c672737 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -248,17 +248,17 @@ class CodeType: co_stacksize: int = -1, co_flags: int = -1, co_firstlineno: int = -1, - co_code: bytes = None, - co_consts: tuple[object, ...] = None, - co_names: tuple[str, ...] = None, - co_varnames: tuple[str, ...] = None, - co_freevars: tuple[str, ...] = None, - co_cellvars: tuple[str, ...] = None, - co_filename: str = None, - co_name: str = None, - co_qualname: str = None, - co_linetable: bytes = None, - co_exceptiontable: bytes = None, + co_code: bytes = ..., + co_consts: tuple[object, ...] = ..., + co_names: tuple[str, ...] = ..., + co_varnames: tuple[str, ...] = ..., + co_freevars: tuple[str, ...] = ..., + co_cellvars: tuple[str, ...] = ..., + co_filename: str = ..., + co_name: str = ..., + co_qualname: str = ..., + co_linetable: bytes = ..., + co_exceptiontable: bytes = ..., ) -> CodeType: ... elif sys.version_info >= (3, 10): def replace( From 508dd86b6858c92696b90e00a6115f55849a357c Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 17 Jan 2023 22:28:58 -0800 Subject: [PATCH 15/16] not sure why pyright is happy now --- stdlib/subprocess.pyi | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index 9b2a9ec706b7..ab32f24ef5dc 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -91,12 +91,11 @@ class CompletedProcess(Generic[_T]): # and writing all the overloads would be horrific. stdout: _T stderr: _T - # pyright ignore on __init__ because the TypeVar can technically be unsolved, but see comment above def __init__( self, args: _CMD, returncode: int, - stdout: _T | None = None, # pyright: ignore[reportInvalidTypeVarUse] + stdout: _T | None = None, stderr: _T | None = None, ) -> None: ... def check_returncode(self) -> None: ... From 1eb30b8c6b2a1e519bea60b2909ab821d1218ef6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 18 Jan 2023 06:30:17 +0000 Subject: [PATCH 16/16] [pre-commit.ci] auto fixes from pre-commit.com hooks --- stdlib/subprocess.pyi | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index ab32f24ef5dc..a417f34b074e 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -91,13 +91,7 @@ class CompletedProcess(Generic[_T]): # and writing all the overloads would be horrific. stdout: _T stderr: _T - def __init__( - self, - args: _CMD, - returncode: int, - stdout: _T | None = None, - stderr: _T | None = None, - ) -> None: ... + def __init__(self, args: _CMD, returncode: int, stdout: _T | None = None, stderr: _T | None = None) -> None: ... def check_returncode(self) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ...