[virt-tools-list] [virt-manager] [PATCH] virtinst: progress: Simplify if-statement

Radostin Stoyanov rstoyanov1 at gmail.com
Fri Mar 2 08:12:53 UTC 2018


Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 virtinst/progress.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/virtinst/progress.py b/virtinst/progress.py
index 29bff358..4284f854 100644
--- a/virtinst/progress.py
+++ b/virtinst/progress.py
@@ -253,10 +253,8 @@ class TextMeter(BaseMeter):
 
         # Include text + ui_rate in minimal
         tl = TerminalLine(8, 8+1+8)
-        if tl._llen > 80:
-            use_hours = True # For big screens, make it more readable.
-        else:
-            use_hours = False
+        # For big screens, make it more readable.
+        use_hours = bool(tl._llen > 80)
         ui_size = tl.add(' | %5sB' % fread)
         if self.size is None:
             ui_time = tl.add('  %s' % format_time(etime, use_hours))
@@ -301,10 +299,8 @@ class TextMeter(BaseMeter):
             text = self.basename
 
         tl = TerminalLine(8)
-        if tl._llen > 80:
-            use_hours = True # For big screens, make it more readable.
-        else:
-            use_hours = False
+        # For big screens, make it more readable.
+        use_hours = bool(tl._llen > 80)
         ui_size = tl.add(' | %5sB' % total_size)
         ui_time = tl.add('  %s' % format_time(self.re.elapsed_time(), use_hours))
         ui_end, not_done = _term_add_end(tl, self.size, amount_read)
-- 
2.14.3




More information about the virt-tools-list mailing list