File: util.py

package info (click to toggle)
streamrip 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,560 kB
  • sloc: python: 6,308; makefile: 5
file content (17 lines) | stat: -rw-r--r-- 305 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import asyncio

loop = asyncio.new_event_loop()


def arun(coro):
    return loop.run_until_complete(coro)


def afor(async_gen):
    async def _afor(async_gen):
        items = []
        async for item in async_gen:
            items.append(item)
        return items

    return arun(_afor(async_gen))