Skip to content

Instantly share code, notes, and snippets.

@easysugar
Created July 29, 2020 09:00
Show Gist options
  • Save easysugar/b8e1c5a34aa9a769bfc304a3eb70b8d8 to your computer and use it in GitHub Desktop.
Save easysugar/b8e1c5a34aa9a769bfc304a3eb70b8d8 to your computer and use it in GitHub Desktop.
simple constructor for using async functions like pipelines
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