Use tqdm with 1024 instead of 1000 unit scale (#131)

This commit is contained in:
Santiago Castro 2021-08-09 00:20:38 -06:00 committed by GitHub
parent 8cad3a736a
commit ff339871f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ def _download(url: str, root: str = os.path.expanduser("~/.cache/clip")):
warnings.warn(f"{download_target} exists, but the SHA256 checksum does not match; re-downloading the file")
with urllib.request.urlopen(url) as source, open(download_target, "wb") as output:
with tqdm(total=int(source.info().get("Content-Length")), ncols=80, unit='iB', unit_scale=True) as loop:
with tqdm(total=int(source.info().get("Content-Length")), ncols=80, unit='iB', unit_scale=True, unit_divisor=1024) as loop:
while True:
buffer = source.read(8192)
if not buffer: