[blivet:master 08/20] Hoist _BINARY_FACTOR * min_value calculation out of loop.
mulhern
amulhern at redhat.com
Tue Dec 23 23:42:21 UTC 2014
Signed-off-by: mulhern <amulhern at redhat.com>
---
blivet/size.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/blivet/size.py b/blivet/size.py
index 6d24fdf..697f5b3 100644
--- a/blivet/size.py
+++ b/blivet/size.py
@@ -348,10 +348,11 @@ class Size(Decimal):
# _BINARY_FACTOR * min_value to the left of the decimal point.
# If the number is so large that no prefix will satisfy this
# requirement use the largest prefix.
+ limit = _BINARY_FACTOR * min_value
for factor, _prefix, abbr in [_EMPTY_PREFIX] + _BINARY_PREFIXES:
newcheck = super(Size, self).__div__(Decimal(factor))
- if abs(newcheck) < _BINARY_FACTOR * min_value:
+ if abs(newcheck) < limit:
# nice value, use this factor, prefix and abbr
break
--
1.9.3
More information about the anaconda-patches
mailing list