bt2: add `StringValue.__contains__()` method
[babeltrace.git] / src / bindings / python / bt2 / bt2 / value.py
index 104698a0fb752eb9b9776a6c1c41e1c1aa2e6660..3acabe7998ca5eddd6fb788b20c93216c39ff9a1 100644 (file)
@@ -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.023365 seconds and 4 git commands to generate.