MCPcopy
hub / github.com/treeverse/dvc / Tqdm

Class Tqdm

dvc/progress.py:20–170  ·  view source on GitHub ↗

maximum-compatibility tqdm-based progressbars

Source from the content-addressed store, hash-verified

18
19
20class Tqdm(tqdm):
21 """
22 maximum-compatibility tqdm-based progressbars
23 """
24
25 BAR_FMT_DEFAULT = (
26 "{percentage:3.0f}% {desc}|{bar}|"
27 "{postfix[info]}{n_fmt}/{total_fmt}"
28 " [{elapsed}<{remaining}, {rate_fmt:>11}]"
29 )
30 # nested bars should have fixed bar widths to align nicely
31 BAR_FMT_DEFAULT_NESTED = (
32 "{percentage:3.0f}%|{bar:10}|{desc:{ncols_desc}.{ncols_desc}}"
33 "{postfix[info]}{n_fmt}/{total_fmt}"
34 " [{elapsed}<{remaining}, {rate_fmt:>11}]"
35 )
36 BAR_FMT_NOTOTAL = "{desc}{bar:b}|{postfix[info]}{n_fmt} [{elapsed}, {rate_fmt:>11}]"
37 BYTES_DEFAULTS: ClassVar[dict[str, Any]] = {
38 "unit": "B",
39 "unit_scale": True,
40 "unit_divisor": 1024,
41 "miniters": 1,
42 }
43
44 def __init__(
45 self,
46 iterable=None,
47 disable=None,
48 level=logging.ERROR,
49 desc=None,
50 leave=False,
51 bar_format=None,
52 bytes=False, # noqa: A002
53 file=None,
54 total=None,
55 postfix=None,
56 **kwargs,
57 ):
58 """
59 bytes : shortcut for
60 `unit='B', unit_scale=True, unit_divisor=1024, miniters=1`
61 desc : persists after `close()`
62 level : effective logging level for determining `disable`;
63 used only if `disable` is unspecified
64 disable : If (default: None) or False,
65 will be determined by logging level.
66 May be overridden to `True` due to non-TTY status.
67 Skip override by specifying env var `DVC_IGNORE_ISATTY`.
68 kwargs : anything accepted by `tqdm.tqdm()`
69 """
70 kwargs = kwargs.copy()
71 if bytes:
72 kwargs = self.BYTES_DEFAULTS | kwargs
73 else:
74 kwargs.setdefault("unit_scale", total > 999 if total else True)
75 if file is None:
76 file = sys.stderr
77 # auto-disable based on `logger.level`

Callers 9

lockMethod · 0.90
lockMethod · 0.90
_resolve_data_sourcesFunction · 0.90
progressMethod · 0.90
test_quiet_loggingFunction · 0.90
test_quiet_nottyFunction · 0.90
test_defaultFunction · 0.90

Calls

no outgoing calls

Tested by 5

test_quiet_loggingFunction · 0.72
test_quiet_nottyFunction · 0.72
test_defaultFunction · 0.72