Skip to content

Commit

Permalink
Merge pull request #1012 from rpgraham84/master
Browse files Browse the repository at this point in the history
Fixes issue #447
  • Loading branch information
davidism authored May 18, 2018
2 parents b10c52a + a112bb2 commit da0ebcb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion click/_termui_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,16 @@ def make_step(self, n_steps):
return

self.last_eta = time.time()
self.avg = self.avg[-6:] + [-(self.start - time.time()) / (self.pos)]

# self.avg is a rolling list of length <= 7 of steps where steps are
# defined as time elapsed divided by the total progress through
# self.length.
if self.pos:
step = (time.time() - self.start) / self.pos
else:
step = time.time() - self.start

self.avg = self.avg[-6:] + [step]

self.eta_known = self.length_known

Expand Down

0 comments on commit da0ebcb

Please sign in to comment.