Created
July 29, 2020 09:00
-
-
Save easysugar/b8e1c5a34aa9a769bfc304a3eb70b8d8 to your computer and use it in GitHub Desktop.
simple constructor for using async functions like pipelines
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
async def async_pipeline(pipe): | |
if isinstance(pipe, tuple): | |
for f in pipe: | |
await async_pipeline(f) | |
elif isinstance(pipe, set): | |
await asyncio.gather(*map(async_pipeline, pipe)) | |
else: | |
await pipe |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment