From c6c8b8021998f810a99cc4e4c435a79fe7b41955 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 26 Nov 2019 00:37:12 +0000 Subject: [PATCH] no unit scaling for small totals --- dvc/progress.py | 5 ++++- dvc/repo/add.py | 2 -- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dvc/progress.py b/dvc/progress.py index 4ec93bc5c6..ed3c462c1b 100644 --- a/dvc/progress.py +++ b/dvc/progress.py @@ -47,6 +47,7 @@ def __init__( bar_format=None, bytes=False, # pylint: disable=W0622 file=None, + total=None, **kwargs ): """ @@ -61,9 +62,10 @@ def __init__( kwargs : anything accepted by `tqdm.tqdm()` """ kwargs = kwargs.copy() - kwargs.setdefault("unit_scale", True) if bytes: kwargs = merge(self.BYTES_DEFAULTS, kwargs) + else: + kwargs.setdefault("unit_scale", total > 999 if total else True) if file is None: file = sys.stderr self.desc_persist = desc @@ -84,6 +86,7 @@ def __init__( desc=desc, bar_format="!", lock_args=(False,), + total=total, **kwargs ) if bar_format is None: diff --git a/dvc/repo/add.py b/dvc/repo/add.py index 51fc417f8e..5e8da0b967 100644 --- a/dvc/repo/add.py +++ b/dvc/repo/add.py @@ -54,8 +54,6 @@ def add(repo, targets, recursive=False, no_commit=False, fname=None): stage.dump() stages_list += stages - # remove filled bar bit of progress, leaving stats - pbar.bar_format = pbar.BAR_FMT_DEFAULT.replace("|{bar:10}|", " ") return stages_list