mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 23:10:42 +01:00
fix unknown total progress
- depends on https://github.com/tqdm/tqdm/pull/800
This commit is contained in:
+11
-4
@@ -32,6 +32,11 @@ class Tqdm(tqdm):
|
||||
"""
|
||||
maximum-compatibility tqdm-based progressbars
|
||||
"""
|
||||
BAR_FMT_DEFAULT = (
|
||||
"{percentage:3.0f}%|{bar:10}|{desc} {bar:-10b}{n}/{total}"
|
||||
" [{elapsed}<{remaining}, {rate_fmt:>11}{postfix}]"
|
||||
)
|
||||
BAR_FMT_NOTOTAL = "{desc} {bar:b}{n} [{elapsed}<??:??, {rate_fmt:>11}{postfix}]"
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@@ -40,10 +45,7 @@ class Tqdm(tqdm):
|
||||
bytes=False, # pylint: disable=W0622
|
||||
desc_truncate=None,
|
||||
leave=None,
|
||||
bar_format=(
|
||||
"{percentage:3.0f}%|{bar:10}|{desc} {bar:-10b}{n}/{total}"
|
||||
" [{elapsed}<{remaining}, {rate_fmt:>11}{postfix}]"
|
||||
),
|
||||
bar_format=None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
@@ -66,6 +68,11 @@ class Tqdm(tqdm):
|
||||
logging.getLogger(__name__).getEffectiveLevel()
|
||||
>= logging.CRITICAL
|
||||
)
|
||||
if bar_format is None:
|
||||
if kwargs.get('total', getattr(iterable, '__len__', None)) is None:
|
||||
bar_format = self.BAR_FMT_NOTOTAL
|
||||
else:
|
||||
bar_format = self.BAR_FMT_DEFAULT
|
||||
super(Tqdm, self).__init__(
|
||||
iterable=iterable,
|
||||
disable=disable,
|
||||
|
||||
Reference in New Issue
Block a user