This commit is contained in:
Casper da Costa-Luis 2020-11-07 03:01:25 +00:00
parent feb238a3c1
commit f1b849e062
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
1 changed files with 3 additions and 2 deletions

View File

@ -7,9 +7,9 @@ Usage:
>>> async for i in trange(10):
... ...
"""
import asyncio
from .std import tqdm as std_tqdm
from .utils import ensure_lock
import asyncio
__author__ = {"github.com/": ["casperdcl"]}
__all__ = ['tqdm_asyncio', 'tarange', 'tqdm', 'trange']
@ -76,7 +76,8 @@ class tqdm_asyncio(std_tqdm):
"""
with ensure_lock(cls, lock_name=kwargs.get('lock_name', "")):
tasks = [asyncio.create_task(i) for i in map(fn, *iterables)]
_ = [await i for i in cls.as_completed(tasks, **kwargs)]
for i in cls.as_completed(tasks, **kwargs):
await i
return [i.result() for i in tasks]