-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
3e4a95e
commit c9ac174
Showing
3 changed files
with
21 additions
and
3 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,13 @@ | ||
|
||
from typing import Awaitable, Callable, Literal, Tuple, Union, overload | ||
|
||
from a_sync._typing import K, P, V, AnyIterable | ||
from a_sync.iter import ASyncIterator | ||
from a_sync.task import TaskMapping | ||
|
||
@overload | ||
def map(coro_fn: Callable[P, Awaitable[V]], *iterables: AnyIterable[P.args], yields: Literal['keys'], **coro_fn_kwargs: P.kwargs) -> ASyncIterator[K]:... | ||
@overload | ||
def map(coro_fn: Callable[P, Awaitable[V]], *iterables: AnyIterable[P.args], yields: Literal['both'], **coro_fn_kwargs: P.kwargs) -> ASyncIterator[Tuple[K, V]]:... | ||
def map(coro_fn: Callable[P, Awaitable[V]], *iterables: AnyIterable[P.args], yields: Literal['keys', 'both'] = 'both', **coro_fn_kwargs: P.kwargs) -> Union[ASyncIterator[K], ASyncIterator[Tuple[K, V]]]: | ||
return ASyncIterator.wrap(TaskMapping(coro_fn, **coro_fn_kwargs).map(*iterables, yields=yields)) |