Add more defaults to the stdlib (#9606)

Continuing work towards #8988.

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

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

View File

@@ -60,7 +60,7 @@ class Executor:
if sys.version_info >= (3, 9):
def shutdown(self, wait: bool = True, *, cancel_futures: bool = False) -> None: ...
else:
def shutdown(self, wait: bool = ...) -> None: ...
def shutdown(self, wait: bool = True) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(

View File

@@ -58,7 +58,7 @@ class _ResultItem:
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: ...
def __init__(self, work_id: int, exception: Exception | None = None, result: Any | None = None) -> None: ...
class _CallItem:
work_id: int
@@ -83,7 +83,7 @@ class _SafeQueue(Queue[Future[Any]]):
) -> None: ...
else:
def __init__(
self, max_size: int | None = ..., *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]]
self, max_size: int | None = 0, *, ctx: BaseContext, pending_work_items: dict[int, _WorkItem[Any]]
) -> None: ...
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
@@ -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 = ..., 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):
@@ -181,9 +181,9 @@ class ProcessPoolExecutor(Executor):
else:
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, ...] = ...,
) -> None: ...
if sys.version_info >= (3, 9):