[PATCH 3/7] virtinst/progress.py: change 'fo' to make codespell happy

Daniel Henrique Barboza danielhb413 at gmail.com
Tue Jun 2 20:39:34 UTC 2020


'codespell' returns errors on this file in the format of:

virtinst/progress.py:527: fo  ==> of, for

This has to do with the 'fo' instance variable of the TextMeter
class. The code was introduced in commit v1.2.1-131-gd5d6cfff,
when parts of the urlgrabber code were copied to avoid dependency
on python-urlgrabber.

Looking at how 'fo' is used, an alternative would be rename it to
'output', so let's make codespell and ourselves happier with less
lint errors.

Signed-off-by: Daniel Henrique Barboza <danielhb413 at gmail.com>
---
 virtinst/progress.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/virtinst/progress.py b/virtinst/progress.py
index 391ee75c..e8e4852f 100644
--- a/virtinst/progress.py
+++ b/virtinst/progress.py
@@ -236,9 +236,9 @@ def _term_add_end(tl, osize, size):
 
 
 class TextMeter(BaseMeter):
-    def __init__(self, fo=sys.stderr):
+    def __init__(self, output=sys.stderr):
         BaseMeter.__init__(self)
-        self.fo = fo
+        self.output = output
 
     def _do_update(self, amount_read, now=None):
         etime = self.re.elapsed_time()
@@ -291,8 +291,8 @@ class TextMeter(BaseMeter):
                 ui_rate, ui_size, ui_time, ui_end
             )
 
-        self.fo.write(out)
-        self.fo.flush()
+        self.output.write(out)
+        self.output.flush()
 
     def _do_end(self, amount_read, now=None):
         global _text_meter_total_size
@@ -313,8 +313,8 @@ class TextMeter(BaseMeter):
         ui_end, not_done = _term_add_end(tl, self.size, amount_read)
         out = '\r%-*.*s%s%s%s\n' % (tl.rest(), tl.rest(), text,
                                     ui_size, ui_time, ui_end)
-        self.fo.write(out)
-        self.fo.flush()
+        self.output.write(out)
+        self.output.flush()
 
         # Don't add size to the sofar size until we have all of it.
         # If we don't have a size, then just pretend/hope we got all of it.
@@ -524,7 +524,7 @@ def format_number(number, SI=0, space=' '):
 def make_meter(quiet):
     if quiet:
         return BaseMeter()
-    return TextMeter(fo=sys.stdout)
+    return TextMeter(output=sys.stdout)
 
 
 def ensure_meter(meter):
-- 
2.26.2




More information about the virt-tools-list mailing list