mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
stdlib: add argument default values (#9501)
This commit is contained in:
@@ -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,10 +55,10 @@ 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: ...
|
||||
def shutdown(self, wait: bool = True, *, cancel_futures: bool = False) -> None: ...
|
||||
else:
|
||||
def shutdown(self, wait: bool = ...) -> None: ...
|
||||
|
||||
@@ -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,9 @@ 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
|
||||
|
||||
@@ -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]],
|
||||
@@ -95,9 +95,9 @@ 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:
|
||||
@@ -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:
|
||||
@@ -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__(
|
||||
|
||||
@@ -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: ...
|
||||
|
||||
Reference in New Issue
Block a user