bt2: field.py: _value_to_int(): require `numbers.Integral`
[babeltrace.git] / src / bindings / python / bt2 / bt2 / field.py
index ee28315790cf35851170b2f5686458611a4e5474..9882f0236549a143841d299c98e72b5600bedd9b 100644 (file)
@@ -167,34 +167,6 @@ class _NumericField(_Field):
     def __rpow__(self, base):
         return self._extract_value(base) ** self._value
 
-    def __iadd__(self, other):
-        self.value = self + other
-        return self
-
-    def __isub__(self, other):
-        self.value = self - other
-        return self
-
-    def __imul__(self, other):
-        self.value = self * other
-        return self
-
-    def __itruediv__(self, other):
-        self.value = self / other
-        return self
-
-    def __ifloordiv__(self, other):
-        self.value = self // other
-        return self
-
-    def __imod__(self, other):
-        self.value = self % other
-        return self
-
-    def __ipow__(self, other):
-        self.value = self ** other
-        return self
-
 
 class _IntegralField(_NumericField, numbers.Integral):
     def __lshift__(self, other):
@@ -230,26 +202,6 @@ class _IntegralField(_NumericField, numbers.Integral):
     def __invert__(self):
         return ~self._value
 
-    def __ilshift__(self, other):
-        self.value = self << other
-        return self
-
-    def __irshift__(self, other):
-        self.value = self >> other
-        return self
-
-    def __iand__(self, other):
-        self.value = self & other
-        return self
-
-    def __ixor__(self, other):
-        self.value = self ^ other
-        return self
-
-    def __ior__(self, other):
-        self.value = self | other
-        return self
-
 
 class _IntegerField(_IntegralField, _Field):
     pass
@@ -259,8 +211,8 @@ class _UnsignedIntegerField(_IntegerField, _Field):
     _NAME = 'Unsigned integer'
 
     def _value_to_int(self, value):
-        if not isinstance(value, numbers.Real):
-            raise TypeError('expecting a real number object')
+        if not isinstance(value, numbers.Integral):
+            raise TypeError('expecting an integral number object')
 
         value = int(value)
         utils._check_uint64(value)
@@ -282,8 +234,8 @@ class _SignedIntegerField(_IntegerField, _Field):
     _NAME = 'Signed integer'
 
     def _value_to_int(self, value):
-        if not isinstance(value, numbers.Real):
-            raise TypeError('expecting a real number object')
+        if not isinstance(value, numbers.Integral):
+            raise TypeError('expecting an integral number object')
 
         value = int(value)
         utils._check_int64(value)
This page took 0.025724 seconds and 4 git commands to generate.