mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
concurrent.futures: Add various Errors. Fix wait(). (#964)
Introduces Error, CancelledError and TimeoutError, based on the backport. Also fixes the return type of wait to be Sets instead of Iterables. The function documentation promises Sets and the code uses Sets. https://github.com/agronholm/pythonfutures/blob/master/concurrent/futures/_base.py#L261
This commit is contained in:
committed by
Matthias Kramm
parent
aa54fc1958
commit
8e59579953
@@ -1,7 +1,11 @@
|
||||
from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Tuple, Union
|
||||
from typing import TypeVar, Generic, Any, Iterable, Iterator, Callable, Optional, Set, Tuple, Union
|
||||
|
||||
_T = TypeVar('_T')
|
||||
|
||||
class Error(Exception): ...
|
||||
class CancelledError(Error): ...
|
||||
class TimeoutError(Error): ...
|
||||
|
||||
class Future(Generic[_T]):
|
||||
def cancel(self) -> bool: ...
|
||||
def cancelled(self) -> bool: ...
|
||||
@@ -28,7 +32,7 @@ class ThreadPoolExecutor(Executor):
|
||||
class ProcessPoolExecutor(Executor):
|
||||
def __init__(self, max_workers: Union[int, None] = ...) -> None: ...
|
||||
|
||||
def wait(fs: Iterable[Future], timeout: float = ..., return_when: str = ...) -> Tuple[Iterable[Future], Iterable[Future]]: ...
|
||||
def wait(fs: Iterable[Future], timeout: Optional[float] = ..., return_when: str = ...) -> Tuple[Set[Future], Set[Future]]: ...
|
||||
|
||||
FIRST_COMPLETED = ... # type: str
|
||||
FIRST_EXCEPTION = ... # type: str
|
||||
|
||||
Reference in New Issue
Block a user