summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Thompson <daniel@redfelineninja.org.uk>2021-05-05 20:02:16 (GMT)
committerDaniel Thompson <daniel@redfelineninja.org.uk>2021-05-05 20:02:16 (GMT)
commit3bbd808115d99e2738135cb1acbfc5bd14380f9d (patch)
tree13b0fba722942c5f025253c6a8fdb78b8cf5a70c /tools
parent69a989b97ea038ddf7776e38426fae0c678470fd (diff)
wasptool: Fix progress bar numbering
Currently direct callers of draw_pbar() can have 20 or more digits after the decimal place. Fix this by moving the rounding function. Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/wasptool5
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/wasptool b/tools/wasptool
index ccca180..4bd9b21 100755
--- a/tools/wasptool
+++ b/tools/wasptool
@@ -18,13 +18,13 @@ def draw_pbar(percent, quiet=False, end='\r'):
if percent > 100:
percent = 100
bar = int(percent) // 2
- print(f'[{"#"*bar}{"."*(50-bar)}] {percent}% ', end=end, flush=True)
+ print(f'[{"#"*bar}{"."*(50-bar)}] {round(percent, 1)}% ', end=end, flush=True)
def pbar(iterable, quiet=False):
step = 100 / len(iterable)
for i, v in enumerate(iterable):
- draw_pbar(round(step * i, 1), quiet)
+ draw_pbar(step * i, quiet)
yield v
if not quiet:
draw_pbar(100, quiet, None)
@@ -264,7 +264,6 @@ def handle_binary_download(c, tname, fname):
elif reply.startswith("'"):
# 'b\'..CONTENT..\''
reply = reply[1:-1].replace("\\'", "'")
- data = print(reply)
data = eval(reply)
if len(data) == 0:
break