mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virtinst/progress.py: change 'fo' to make codespell happy
'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. Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
bdb2bed3e9
commit
29963ac986
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user