Skip to content

Commit f8a1bf6

Browse files
committed
estimate: don't bother if no items remaining
1 parent d4cfe1e commit f8a1bf6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

unpythonic/timeutil.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ def _estimate(self) -> typing.Optional[float]:
102102
# Maybe we could use a Lanczos downsampling filter to make the ETA
103103
# behave more smoothly?
104104
remaining = self.total - self.completed
105+
if remaining <= 0:
106+
return 0.0
105107
dt_avg = sum(self.que) / len(self.que)
106108
return remaining * dt_avg
107109
estimate = property(fget=_estimate, doc="Estimate of time remaining, in seconds. Computed when read; read-only. If no tasks have been marked completed yet, the estimate is `None`.")

0 commit comments

Comments
 (0)