python: fix all "do not use bare 'except'" warnings
[babeltrace.git] / src / bindings / python / bt2 / bt2 / value.py
index 104698a0fb752eb9b9776a6c1c41e1c1aa2e6660..3001502abb472600a8038d1d056c19197a8c374b 100644 (file)
@@ -132,7 +132,7 @@ class _NumericValue(_Value):
     def __eq__(self, other):
         try:
             return self._value == self._extract_value(other)
-        except:
+        except Exception:
             return False
 
     def __rmod__(self, other):
@@ -383,7 +383,7 @@ class StringValue(collections.abc.Sequence, _Value):
     def __eq__(self, other):
         try:
             return self._value == self._value_to_str(other)
-        except:
+        except Exception:
             return False
 
     def __lt__(self, other):
@@ -404,6 +404,9 @@ class StringValue(collections.abc.Sequence, _Value):
     def __len__(self):
         return len(self._value)
 
+    def __contains__(self, item):
+        return self._value_to_str(item) in self._value
+
     def __iadd__(self, value):
         curvalue = self._value
         curvalue += self._value_to_str(value)
@@ -448,7 +451,7 @@ class ArrayValue(_Container, collections.abc.MutableSequence, _Value):
         return True
 
     def __len__(self):
-        size = native_bt.value_array_get_size(self._ptr)
+        size = native_bt.value_array_get_length(self._ptr)
         assert size >= 0
         return size
 
This page took 0.041116 seconds and 4 git commands to generate.