def update_progress(self, datalen): self.current += datalen if self.total > 1024 and self.current: howmuch = int((self.current * 100) / self.total) if self.last_output is None or howmuch - self.last_output >= 10: self.last_output = howmuch elapsed = time.time() - self.start velocity = self.current / elapsed cur = self.current tot = self.total for (order, unit) in [(1024, 'KiB'), (1024 * 1024, 'MiB'), (1024 * 1024 * 1024, 'GiB')]: if tot / order < 100: break cur /= order tot /= order units = unit estimate = self.total / velocity left = estimate - elapsed print( '%s - %.1f of %.1f %s (%ds remaining)' % (util.pretty_progress(howmuch, 5), cur, tot, units, left)) if self.current == self.total: print('%0.2f MiB/s' % (self.total / (1024.0 * 1024) / elapsed))
def update_progress(self, datalen): self.current += datalen if self.total > 1024 and self.current: howmuch = int((self.current * 100) / self.total) if self.last_output is None or howmuch - self.last_output >= 10: self.last_output = howmuch elapsed = time.time() - self.start velocity = self.current / elapsed cur = self.current tot = self.total for (order, unit) in [(1024, 'KiB'), (1024 * 1024, 'MiB'), (1024 * 1024 * 1024, 'GiB')]: if tot / order < 100: break cur /= order tot /= order units = unit estimate = self.total / velocity left = estimate - elapsed print('%s - %.1f of %.1f %s (%ds remaining)' % (util.pretty_progress(howmuch, 5), cur, tot, units, left)) if self.current == self.total: print('%0.2f MiB/s' % (self.total / (1024.0 * 1024) / elapsed))
def _progress(percent, tag, message): print(util.pretty_progress(percent), message)
def progress(self, percent, tag, message): print(util.pretty_progress(percent), message)
def update(pct, tag, description): if not cfg.json: print(" {}: {}".format(util.pretty_progress(pct), description))