[PATCH 11/11] Only give Size objects a __div__ method under python2.

Chris Lumens clumens at redhat.com
Mon Apr 27 17:09:09 UTC 2015


---
 blivet/size.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/blivet/size.py b/blivet/size.py
index 29d2cb6..ff9e8cb 100644
--- a/blivet/size.py
+++ b/blivet/size.py
@@ -295,7 +295,12 @@ class Size(Decimal):
     __rmul__ = __mul__
 
     def __div__(self, other, context=None):
-        return Size(Decimal.__div__(self, other))
+        if six.PY2:
+            # This still needs to be ignored by pylint, because it will get
+            # through the above guard.
+            return Size(Decimal.__div__(self, other))   # pylint: disable=no-member
+        else:
+            raise AttributeError
 
     def __truediv__(self, other, context=None):
         return Size(Decimal.__truediv__(self, other))
-- 
2.2.2



More information about the anaconda-patches mailing list