-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add description, example, and install info
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Windmolen | ||
|
||
Treat multiple asynchronous iterators like they are a single asynchronous iterator. | ||
|
||
**Example:** | ||
|
||
```python | ||
import asyncio | ||
from windmolen import FanIn | ||
|
||
|
||
async def async_iterator_1(): | ||
for i in range(1, 5): | ||
yield i | ||
await asyncio.sleep(0.5) | ||
|
||
|
||
async def async_iterator_2(): | ||
for j in range(5, 9): | ||
yield j | ||
await asyncio.sleep(1) | ||
|
||
|
||
async def main(): | ||
async with FanIn(async_iterator_1(), async_iterator_2()) as async_iterators: | ||
async for item in async_iterators: | ||
print(item) | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) | ||
``` | ||
|
||
## Install | ||
|
||
```shell | ||
pip install windmolen | ||
``` |