Skip to content

Commit

Permalink
remove ETA on completion, minor tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Jan 26, 2020
1 parent a42d4f2 commit 5d10606
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dvc/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class Tqdm(tqdm):
"{desc:{ncols_desc}.{ncols_desc}}{n_fmt}"
" [{elapsed}<??:??, {rate_fmt:>11}{postfix}]"
)
BYTES_DEFAULTS = dict(
unit="B", unit_scale=True, unit_divisor=1024, miniters=1
)

def __init__(
self,
Expand Down Expand Up @@ -60,10 +63,7 @@ def __init__(
kwargs = kwargs.copy()
kwargs.setdefault("unit_scale", True)
if bytes:
bytes_defaults = dict(
unit="B", unit_scale=True, unit_divisor=1024, miniters=1
)
kwargs = merge(bytes_defaults, kwargs)
kwargs = merge(self.BYTES_DEFAULTS, kwargs)
if file is None:
file = sys.stderr
self.desc_persist = desc
Expand Down Expand Up @@ -114,6 +114,10 @@ def update_to(self, current, total=None):
def close(self):
if self.desc_persist is not None:
self.set_description_str(self.desc_persist, refresh=False)
# remove ETA (either zero or unknown)
self.bar_format = self.bar_format.replace("<??:??", "").replace(
"<{remaining}", ""
)
super().close()

@property
Expand Down

0 comments on commit 5d10606

Please sign in to comment.