mirror of https://github.com/tqdm/tqdm.git
parent
a774e3ff8d
commit
42de6bdfc9
10
tqdm/std.py
10
tqdm/std.py
|
@ -10,7 +10,7 @@ Usage:
|
|||
from __future__ import absolute_import, division
|
||||
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
from collections import OrderedDict, defaultdict
|
||||
from contextlib import contextmanager
|
||||
from datetime import datetime, timedelta
|
||||
from numbers import Number
|
||||
|
@ -1420,14 +1420,16 @@ class tqdm(Comparable):
|
|||
@property
|
||||
def format_dict(self):
|
||||
"""Public API for read-only member access."""
|
||||
if self.disable and not hasattr(self, 'unit'):
|
||||
return defaultdict(lambda: None, {
|
||||
'n': self.n, 'total': self.total, 'elapsed': 0, 'unit': 'it'})
|
||||
if self.dynamic_ncols:
|
||||
self.ncols, self.nrows = self.dynamic_ncols(self.fp)
|
||||
ncols, nrows = self.ncols, self.nrows
|
||||
return {
|
||||
'n': self.n, 'total': self.total,
|
||||
'elapsed': self._time() - self.start_t if hasattr(self, 'start_t') else 0,
|
||||
'ncols': ncols, 'nrows': nrows, 'prefix': self.desc, 'ascii': self.ascii,
|
||||
'unit': self.unit, 'unit_scale': self.unit_scale,
|
||||
'ncols': self.ncols, 'nrows': self.nrows, 'prefix': self.desc,
|
||||
'ascii': self.ascii, 'unit': self.unit, 'unit_scale': self.unit_scale,
|
||||
'rate': self._ema_dn() / self._ema_dt() if self._ema_dt() else None,
|
||||
'bar_format': self.bar_format, 'postfix': self.postfix,
|
||||
'unit_divisor': self.unit_divisor, 'initial': self.initial,
|
||||
|
|
Loading…
Reference in New Issue