mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-12-03 07:18:28 +01:00
add progress.Tqdm(bytes)
This commit is contained in:
@@ -15,10 +15,17 @@ class Tqdm(tqdm):
|
||||
disable=logging.getLogger(
|
||||
__name__).getEffectiveLevel() >= logging.CRITICAL,
|
||||
ascii=None, # TODO: True?
|
||||
bytes=False,
|
||||
**kwargs):
|
||||
"""
|
||||
bytes : adds unit='B', unit_scale=True, unit_divisor=1024, miniters=1
|
||||
kwargs : anything accepted by `tqdm.tqdm()`
|
||||
"""
|
||||
if bytes:
|
||||
#kwargs = deepcopy(kwargs)
|
||||
for k, v in dict(unit='B', unit_scale=True, unit_divisor=1024,
|
||||
miniters=1):
|
||||
kwargs.setdefault(k, v)
|
||||
super(Tqdm, self).__init__(
|
||||
iterable=iterable,
|
||||
disable=disable,
|
||||
|
||||
+1
-2
@@ -35,8 +35,7 @@ class RemoteHTTP(RemoteBASE):
|
||||
#if total:
|
||||
# leave = total > self.CHUNK_SIZE * 100
|
||||
|
||||
with Tqdm(total=total, leave=leave,
|
||||
unit='B', unit_scale=True, unit_divisor=1024, miniters=1,
|
||||
with Tqdm(total=total, leave=leave, bytes=True,
|
||||
disable=no_progress_bar) as pbar:
|
||||
with open(to_file, "wb") as fd:
|
||||
for chunk in request.iter_content(chunk_size=self.CHUNK_SIZE):
|
||||
|
||||
Reference in New Issue
Block a user