More precise signatures in concurrent.futures (#1262)

* Allow None in concurrent.futures.exception() and set_exception()

* Make Executor.map() signature more precise

* Remove superfluous signatures

* Specify str type for some concurrent.futures constants

* Update concurrent.futures backport

* CR fixes
This commit is contained in:
Max
2017-05-14 13:55:27 -07:00
committed by Jelle Zijlstra
parent 6207eb8cde
commit df9df65882
4 changed files with 11 additions and 21 deletions

View File

@@ -26,16 +26,16 @@ class Future(Generic[_T]):
class Executor:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
def map(self, func: Callable[..., _T], *iterables: Any, timeout: Optional[float] = ...) -> Iterable[_T]: ...
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ...
def shutdown(self, wait: bool = ...) -> None: ...
def __enter__(self) -> Executor: ...
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> bool: ...
class ThreadPoolExecutor(Executor):
def __init__(self, max_workers: int) -> None: ...
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
class ProcessPoolExecutor(Executor):
def __init__(self, max_workers: Union[int, None] = ...) -> None: ...
def __init__(self, max_workers: Optional[int] = ...) -> None: ...
def wait(fs: Iterable[Future], timeout: Optional[float] = ..., return_when: str = ...) -> Tuple[Set[Future], Set[Future]]: ...