[BUG] Fix progress bar unit. (#3177)

pull/3183/head
PiaoYang 2 years ago committed by GitHub
parent 6ffd3e4f7f
commit 5a0103b2ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -133,10 +133,10 @@ def _get_download(url, fullname):
total_size = req.headers.get('content-length')
with open(tmp_fullname, 'wb') as f:
if total_size:
with tqdm(total=(int(total_size) + 1023) // 1024) as pbar:
with tqdm(total=(int(total_size)), unit='B', unit_scale=True) as pbar:
for chunk in req.iter_content(chunk_size=1024):
f.write(chunk)
pbar.update(1)
pbar.update(len(chunk))
else:
for chunk in req.iter_content(chunk_size=1024):
if chunk:

Loading…
Cancel
Save