31 lines
1.1 KiB
Diff
31 lines
1.1 KiB
Diff
|
Subject: progress: Don't overwrite "format"
|
||
|
From: Radostin Stoyanov rstoyanov1@gmail.com Wed Oct 11 12:35:44 2017 +0100
|
||
|
Date: Fri Oct 20 11:49:14 2017 -0400:
|
||
|
Git: 2d276ebed84ba9f468243989d219940883cf72ad
|
||
|
|
||
|
Do not overwrite built-in format. [1]
|
||
|
|
||
|
https://docs.python.org/2/library/functions.html#format
|
||
|
|
||
|
diff --git a/virtinst/progress.py b/virtinst/progress.py
|
||
|
index 05114ed4..2b070540 100644
|
||
|
--- a/virtinst/progress.py
|
||
|
+++ b/virtinst/progress.py
|
||
|
@@ -484,12 +484,12 @@ def format_number(number, SI=0, space=' '):
|
||
|
if isinstance(number, int) or isinstance(number, long):
|
||
|
# it's an int or a long, which means it didn't get divided,
|
||
|
# which means it's already short enough
|
||
|
- format = '%i%s%s'
|
||
|
+ fmt = '%i%s%s'
|
||
|
elif number < 9.95:
|
||
|
# must use 9.95 for proper sizing. For example, 9.99 will be
|
||
|
# rounded to 10.0 with the .1f format string (which is too long)
|
||
|
- format = '%.1f%s%s'
|
||
|
+ fmt = '%.1f%s%s'
|
||
|
else:
|
||
|
- format = '%.0f%s%s'
|
||
|
+ fmt = '%.0f%s%s'
|
||
|
|
||
|
- return(format % (float(number or 0), space, symbols[depth]))
|
||
|
+ return(fmt % (float(number or 0), space, symbols[depth]))
|