diff --git a/dvc/progress.py b/dvc/progress.py index 5fe0f60b9..3c483ccee 100644 --- a/dvc/progress.py +++ b/dvc/progress.py @@ -15,10 +15,17 @@ class Tqdm(tqdm): disable=logging.getLogger( __name__).getEffectiveLevel() >= logging.CRITICAL, ascii=None, # TODO: True? + bytes=False, **kwargs): """ + bytes : adds unit='B', unit_scale=True, unit_divisor=1024, miniters=1 kwargs : anything accepted by `tqdm.tqdm()` """ + if bytes: + #kwargs = deepcopy(kwargs) + for k, v in dict(unit='B', unit_scale=True, unit_divisor=1024, + miniters=1): + kwargs.setdefault(k, v) super(Tqdm, self).__init__( iterable=iterable, disable=disable, diff --git a/dvc/remote/http.py b/dvc/remote/http.py index 911e9754c..e662b9b9c 100644 --- a/dvc/remote/http.py +++ b/dvc/remote/http.py @@ -35,8 +35,7 @@ class RemoteHTTP(RemoteBASE): #if total: # leave = total > self.CHUNK_SIZE * 100 - with Tqdm(total=total, leave=leave, - unit='B', unit_scale=True, unit_divisor=1024, miniters=1, + with Tqdm(total=total, leave=leave, bytes=True, disable=no_progress_bar) as pbar: with open(to_file, "wb") as fd: for chunk in request.iter_content(chunk_size=self.CHUNK_SIZE):