concurrent.futures: update for py39, minor fixes (#4503)

Note the new parameter doesn't actually exist on the base class, even
though it's documented as that being the case. Asked about it in https://bugs.python.org/issue39349

Co-authored-by: hauntsaninja <>
This commit is contained in:
Shantanu
2020-08-31 13:04:49 -07:00
committed by GitHub
parent 846e858bdc
commit 48c8939ce6
2 changed files with 18 additions and 6 deletions

View File

@@ -46,14 +46,20 @@ class Future(Generic[_T]):
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
class Executor:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
if sys.version_info >= (3, 9):
def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
else:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
if sys.version_info >= (3, 5):
def map(
self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
) -> Iterator[_T]: ...
else:
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ...
def shutdown(self, wait: bool = ...) -> None: ...
if sys.version_info >= (3, 9):
def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ...
else:
def shutdown(self, wait: bool = ...) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ...

View File

@@ -46,14 +46,20 @@ class Future(Generic[_T]):
def set_exception_info(self, exception: Any, traceback: Optional[TracebackType]) -> None: ...
class Executor:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
if sys.version_info >= (3, 9):
def submit(self, __fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
else:
def submit(self, fn: Callable[..., _T], *args: Any, **kwargs: Any) -> Future[_T]: ...
if sys.version_info >= (3, 5):
def map(
self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ..., chunksize: int = ...
) -> Iterator[_T]: ...
else:
def map(self, func: Callable[..., _T], *iterables: Iterable[Any], timeout: Optional[float] = ...) -> Iterator[_T]: ...
def shutdown(self, wait: bool = ...) -> None: ...
if sys.version_info >= (3, 9):
def shutdown(self, wait: bool = ..., *, cancel_futures: bool = ...) -> None: ...
else:
def shutdown(self, wait: bool = ...) -> None: ...
def __enter__(self: _T) -> _T: ...
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Optional[bool]: ...