diff --git a/stdlib/3/concurrent/futures/_base.pyi b/stdlib/3/concurrent/futures/_base.pyi index 84d10a052..98ffaf3a6 100644 --- a/stdlib/3/concurrent/futures/_base.pyi +++ b/stdlib/3/concurrent/futures/_base.pyi @@ -2,7 +2,7 @@ # # NOTE: This dynamically typed stub was automatically generated by stubgen. -from typing import Any +from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple from collections import namedtuple FIRST_COMPLETED = ... # type: Any @@ -54,28 +54,30 @@ class _AcquireFutures: def __enter__(self): ... def __exit__(self, *args): ... -def as_completed(fs, timeout=None): ... - DoneAndNotDoneFutures = namedtuple('DoneAndNotDoneFutures', 'done not_done') -def wait(fs, timeout=None, return_when=...): ... +_T = TypeVar('_T') -class Future: - def __init__(self): ... - def cancel(self): ... - def cancelled(self): ... - def running(self): ... - def done(self): ... - def add_done_callback(self, fn): ... - def result(self, timeout=None): ... - def exception(self, timeout=None): ... - def set_running_or_notify_cancel(self): ... - def set_result(self, result): ... - def set_exception(self, exception): ... +class Future(Generic[_T]): + def __init__(self) -> None: ... + def cancel(self) -> bool: ... + def cancelled(self) -> bool: ... + def running(self) -> bool: ... + def done(self) -> bool: ... + def add_done_callback(self, fn: Callable[[Future], Any]) -> None: ... + def result(self, timeout: float = ...) -> _T: ... + def exception(self, timeout: float = ...) -> Exception: ... + def set_running_or_notify_cancel(self) -> None: ... + def set_result(self, result: _T) -> None: ... + def set_exception(self, exception: Exception) -> None: ... class Executor: - def submit(self, fn, *args, **kwargs): ... - def map(self, fn, *iterables, timeout=None, chunksize=1): ... - def shutdown(self, wait=True): ... - def __enter__(self): ... - def __exit__(self, exc_type, exc_val, exc_tb): ... + def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ... + def map(self, func: Callable[..., _T], *iterables: Any, timeout: float = ...) -> Iterable[_T]: ... + def shutdown(self, wait: bool = ...) -> None: ... + def __enter__(self) -> Executor: ... + def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool: ... + +def as_completed(fs: Iterable[Future], timeout: float = ...) -> Iterator[Future]: ... + +def wait(fs: Iterable[Future], timeout: float = ..., return_when: str = ...) -> Tuple[Iterable[Future], Iterable[Future]]: ...