-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
87 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from concurrent.futures import Future | ||
from os import PathLike | ||
from typing import Callable, Iterable, Iterator, List, Optional, Protocol, TypeVar | ||
|
||
from typing_extensions import ParamSpec | ||
|
||
_T = TypeVar("_T") | ||
_P = ParamSpec("_P") | ||
_S = TypeVar("_S") | ||
|
||
|
||
class Executor(Protocol): | ||
@classmethod | ||
def as_completed(cls, futures: List["Future[_T]"]) -> Iterator["Future[_T]"]: | ||
... | ||
|
||
def submit( | ||
self, | ||
__fn: Callable[_P, _T], | ||
/, | ||
*args: _P.args, | ||
**kwargs: _P.kwargs, | ||
) -> "Future[_T]": | ||
... | ||
|
||
def map_unordered(self, fn: Callable[[_S], _T], args: Iterable[_S]) -> Iterator[_T]: | ||
... | ||
|
||
def map_to_futures( | ||
self, | ||
fn: Callable[[_S], _T], | ||
args: Iterable[_S], | ||
output_pickle_path_getter: Optional[Callable[[_S], PathLike]], | ||
) -> List["Future[_T]"]: | ||
... | ||
|
||
def map( | ||
self, | ||
fn: Callable[[_S], _T], | ||
iterables: Iterable[_S], | ||
timeout: Optional[float], | ||
chunksize: int, | ||
) -> Iterator[_T]: | ||
... | ||
|
||
def forward_log(self, fut: "Future[_T]") -> _T: | ||
... | ||
|
||
def shutdown(self, wait: bool = True, *, cancel_futures: bool = False) -> None: | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.