add Tqdm units

This commit is contained in:
Casper da Costa-Luis
2019-08-17 22:05:48 +01:00
parent 16113c880a
commit 49d4930c39
6 changed files with 15 additions and 8 deletions
+6 -2
View File
@@ -115,7 +115,9 @@ class RemoteAZURE(RemoteBASE):
def _upload(
self, from_file, to_info, name=None, no_progress_bar=False, **_kwargs
):
with Tqdm(desc_truncate=name, disable=no_progress_bar) as pbar:
with Tqdm(
desc_truncate=name, disable=no_progress_bar, bytes=True
) as pbar:
self.blob_service.create_blob_from_path(
to_info.bucket,
to_info.path,
@@ -126,7 +128,9 @@ class RemoteAZURE(RemoteBASE):
def _download(
self, from_info, to_file, name=None, no_progress_bar=False, **_kwargs
):
with Tqdm(desc_truncate=name, disable=no_progress_bar) as pbar:
with Tqdm(
desc_truncate=name, disable=no_progress_bar, bytes=True
) as pbar:
self.blob_service.get_blob_to_path(
from_info.bucket,
from_info.path,
+1 -1
View File
@@ -632,7 +632,7 @@ class RemoteBASE(object):
if not self.no_traverse:
return list(set(checksums) & set(self.all()))
with Tqdm(total=len(checksums)) as pbar:
with Tqdm(total=len(checksums), unit="md5") as pbar:
def exists_with_progress(path_info):
ret = self.exists(path_info)
+4 -2
View File
@@ -348,7 +348,9 @@ class RemoteLOCAL(RemoteBASE):
cache = []
path_infos = []
names = []
for md5, info in Tqdm(status_info.items(), desc="Analysing status"):
for md5, info in Tqdm(
status_info.items(), desc="Analysing status", unit="file"
):
if info["status"] == status:
cache.append(self.checksum_to_path_info(md5))
path_infos.append(remote.checksum_to_path_info(md5))
@@ -539,7 +541,7 @@ class RemoteLOCAL(RemoteBASE):
def _create_unpacked_dir(self, checksum, dir_info, unpacked_dir_info):
self.makedirs(unpacked_dir_info)
for entry in Tqdm(dir_info, desc="Created unpacked dir"):
for entry in Tqdm(dir_info, desc="Creating unpacked dir", unit="dir"):
entry_cache_info = self.checksum_to_path_info(
entry[self.PARAM_CHECKSUM]
)
+1 -1
View File
@@ -251,7 +251,7 @@ class RemoteSSH(RemoteBASE):
if not self.no_traverse:
return list(set(checksums) & set(self.all()))
with Tqdm(total=len(checksums)) as pbar:
with Tqdm(total=len(checksums), unit="md5") as pbar:
def exists_with_progress(chunks):
return self.batch_exists(chunks, callback=pbar.update_desc)
+2 -1
View File
@@ -171,6 +171,7 @@ class SSHConnection:
with Tqdm(
desc_truncate=progress_title or os.path.basename(src),
disable=no_progress_bar,
bytes=True,
) as pbar:
self.sftp.get(src, dest, callback=pbar.update_to)
@@ -185,7 +186,7 @@ class SSHConnection:
progress_title = posixpath.basename(dest)
with Tqdm(
desc_truncate=progress_title, disable=no_progress_bar
desc_truncate=progress_title, disable=no_progress_bar, bytes=True
) as pbar:
self.sftp.put(src, tmp_file, callback=pbar.update_to)
+1 -1
View File
@@ -37,7 +37,7 @@ def checkout(self, target=None, with_deps=False, force=False, recursive=False):
with self.state:
_cleanup_unused_links(self, all_stages)
with Tqdm(total=get_all_files_numbers(stages)) as pbar:
with Tqdm(total=get_all_files_numbers(stages), unit="file") as pbar:
for stage in stages:
if stage.locked:
logger.warning(