def inner(_, current, total): if total isnotNone:
bar.total = total
delta = current - last_b[0]
last_b[0] = current
if delta > 0:
bar.update(delta) return inner
def download_file(url, dest=None): if dest isNone:
dest = urlparse(url).path.split('/')[-1]
with tqdm.tqdm(unit='B', unit_scale=True, miniters=1, dynamic_ncols=True,
desc=dest) as bar:
dl = Download(url, dest, progress=download_progress(bar))
dl.start()
dl.wait()