Use tqdm
parent
a7f5a87539
commit
02d283b645
|
@ -40,6 +40,7 @@ import posix1e
|
|||
import blkid
|
||||
from filesystem import *
|
||||
from ntfs import *
|
||||
from tqdm import tqdm
|
||||
|
||||
class OgProgressPrinter(git.RemoteProgress):
|
||||
"""
|
||||
|
@ -65,18 +66,18 @@ class OgProgressPrinter(git.RemoteProgress):
|
|||
def __init__(self, parentLogger):
|
||||
super().__init__()
|
||||
self.logger = parentLogger
|
||||
self.prev_len = 0
|
||||
|
||||
print("\n", file=sys.stderr)
|
||||
if sys.stdin.isatty():
|
||||
self.progress = tqdm()
|
||||
|
||||
def update(self, op_code, cur_count, max_count=None, message=""):
|
||||
self.logger.debug(f"Progress: {op_code} {cur_count}/{max_count}: {message}")
|
||||
|
||||
status_string = "Progress: %s %s/%s: %s" % (op_code, cur_count, max_count, message)
|
||||
padded_string = status_string.rjust(self.prev_len, " ")
|
||||
self.prev_len = len(status_string)
|
||||
|
||||
print(f"\r{padded_string}", file=sys.stderr, end="")
|
||||
if self.progress:
|
||||
self.progress.total = max_count
|
||||
self.progress.n = cur_count
|
||||
self.progress.desc = message
|
||||
self.progress.refresh()
|
||||
|
||||
def __del__(self):
|
||||
print("\n", file=sys.stderr)
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
gitdb==4.0.11
|
||||
GitPython==3.1.43
|
||||
libarchive==0.4.7
|
||||
libarchive-c==5.1
|
||||
nose==1.3.7
|
||||
pathlib==1.0.1
|
||||
pkg_resources==0.0.0
|
||||
pylibacl==0.7.0
|
||||
pylibblkid==0.3
|
||||
pyxattr==0.8.1
|
||||
smmap==5.0.1
|
||||
tqdm==4.66.5
|
||||
|
|
Loading…
Reference in New Issue