doc/api/libbabeltrace2/DoxygenLayout.xml: use `topics` tab
[babeltrace.git] / src / bindings / python / bt2 / bt2 / field_class.py
index 99c179355705c11c28af2b85e3dca87cd54980d5..8594b496d08609f1e4ea31d7a6bc0bb116572ebc 100644 (file)
@@ -1,36 +1,31 @@
-# The MIT License (MIT)
+# SPDX-License-Identifier: MIT
 #
 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-from bt2 import native_bt, object, utils
+
 import collections.abc
+
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
+from bt2 import value as bt2_value
+from bt2 import object as bt2_object
+from bt2 import native_bt
 from bt2 import field_path as bt2_field_path
 from bt2 import integer_range_set as bt2_integer_range_set
-from bt2 import value as bt2_value
-import bt2
 
 
-def _create_field_class_from_ptr_and_get_ref_template(type_map, ptr):
+def _obj_type_from_field_class_ptr_template(type_map, ptr):
     typeid = native_bt.field_class_get_type(ptr)
-    return type_map[typeid]._create_from_ptr_and_get_ref(ptr)
+    return type_map[typeid]
+
+
+def _obj_type_from_field_class_ptr(ptr):
+    return _obj_type_from_field_class_ptr_template(_FIELD_CLASS_TYPE_TO_OBJ, ptr)
+
+
+def _create_field_class_from_ptr_and_get_ref_template(type_map, ptr):
+    return _obj_type_from_field_class_ptr_template(
+        type_map, ptr
+    )._create_from_ptr_and_get_ref(ptr)
 
 
 def _create_field_class_from_ptr_and_get_ref(ptr):
@@ -52,9 +47,15 @@ class IntegerDisplayBase:
     HEXADECIMAL = native_bt.FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL
 
 
-class _FieldClassConst(object._SharedObject):
-    _get_ref = staticmethod(native_bt.field_class_get_ref)
-    _put_ref = staticmethod(native_bt.field_class_put_ref)
+class _FieldClassConst(bt2_object._SharedObject):
+    @staticmethod
+    def _get_ref(ptr):
+        native_bt.field_class_get_ref(ptr)
+
+    @staticmethod
+    def _put_ref(ptr):
+        native_bt.field_class_put_ref(ptr)
+
     _borrow_user_attributes_ptr = staticmethod(
         native_bt.field_class_borrow_user_attributes_const
     )
@@ -64,8 +65,8 @@ class _FieldClassConst(object._SharedObject):
 
     def _check_create_status(self, ptr):
         if ptr is None:
-            raise bt2._MemoryError(
-                'cannot create {} field class object'.format(self._NAME.lower())
+            raise bt2_error._MemoryError(
+                "cannot create {} field class object".format(self._NAME.lower())
             )
 
     @property
@@ -85,22 +86,22 @@ class _FieldClass(_FieldClassConst):
 
     def _user_attributes(self, user_attributes):
         value = bt2_value.create_value(user_attributes)
-        utils._check_type(value, bt2_value.MapValue)
+        bt2_utils._check_type(value, bt2_value.MapValue)
         native_bt.field_class_set_user_attributes(self._ptr, value._ptr)
 
     _user_attributes = property(fset=_user_attributes)
 
 
 class _BoolFieldClassConst(_FieldClassConst):
-    _NAME = 'Const boolean'
+    _NAME = "Const boolean"
 
 
 class _BoolFieldClass(_BoolFieldClassConst, _FieldClass):
-    _NAME = 'Boolean'
+    _NAME = "Boolean"
 
 
 class _BitArrayFieldClassConst(_FieldClassConst):
-    _NAME = 'Const bit array'
+    _NAME = "Const bit array"
 
     @property
     def length(self):
@@ -110,7 +111,7 @@ class _BitArrayFieldClassConst(_FieldClassConst):
 
 
 class _BitArrayFieldClass(_BitArrayFieldClassConst, _FieldClass):
-    _NAME = 'Bit array'
+    _NAME = "Bit array"
 
 
 class _IntegerFieldClassConst(_FieldClassConst):
@@ -136,7 +137,7 @@ class _IntegerFieldClass(_FieldClass, _IntegerFieldClassConst):
     _field_value_range = property(fset=_field_value_range)
 
     def _preferred_display_base(self, base):
-        utils._check_uint64(base)
+        bt2_utils._check_uint64(base)
 
         if base not in (
             IntegerDisplayBase.BINARY,
@@ -152,23 +153,23 @@ class _IntegerFieldClass(_FieldClass, _IntegerFieldClassConst):
 
 
 class _UnsignedIntegerFieldClassConst(_IntegerFieldClassConst, _FieldClassConst):
-    _NAME = 'Const unsigned integer'
+    _NAME = "Const unsigned integer"
 
 
 class _UnsignedIntegerFieldClass(
     _UnsignedIntegerFieldClassConst, _IntegerFieldClass, _FieldClass
 ):
-    _NAME = 'Unsigned integer'
+    _NAME = "Unsigned integer"
 
 
 class _SignedIntegerFieldClassConst(_IntegerFieldClassConst, _FieldClassConst):
-    _NAME = 'Const signed integer'
+    _NAME = "Const signed integer"
 
 
 class _SignedIntegerFieldClass(
     _SignedIntegerFieldClassConst, _IntegerFieldClass, _FieldClass
 ):
-    _NAME = 'Signed integer'
+    _NAME = "Signed integer"
 
 
 class _RealFieldClassConst(_FieldClassConst):
@@ -176,11 +177,11 @@ class _RealFieldClassConst(_FieldClassConst):
 
 
 class _SinglePrecisionRealFieldClassConst(_RealFieldClassConst):
-    _NAME = 'Const single-precision real'
+    _NAME = "Const single-precision real"
 
 
 class _DoublePrecisionRealFieldClassConst(_RealFieldClassConst):
-    _NAME = 'Const double-precision real'
+    _NAME = "Const double-precision real"
 
 
 class _RealFieldClass(_FieldClass, _RealFieldClassConst):
@@ -188,11 +189,11 @@ class _RealFieldClass(_FieldClass, _RealFieldClassConst):
 
 
 class _SinglePrecisionRealFieldClass(_RealFieldClass):
-    _NAME = 'Single-precision real'
+    _NAME = "Single-precision real"
 
 
 class _DoublePrecisionRealFieldClass(_RealFieldClass):
-    _NAME = 'Double-precision real'
+    _NAME = "Double-precision real"
 
 
 # an enumeration field class mapping does not have a reference count, so
@@ -247,8 +248,8 @@ class _EnumerationFieldClassConst(_IntegerFieldClassConst, collections.abc.Mappi
         self._check_int_type(value)
 
         status, labels = self._get_mapping_labels_for_value(self._ptr, value)
-        utils._handle_func_status(
-            status, 'cannot get mapping labels for value {}'.format(value)
+        bt2_utils._handle_func_status(
+            status, "cannot get mapping labels for value {}".format(value)
         )
         return [self[label] for label in labels]
 
@@ -258,7 +259,7 @@ class _EnumerationFieldClassConst(_IntegerFieldClassConst, collections.abc.Mappi
             yield self._mapping_pycls(mapping_ptr).label
 
     def __getitem__(self, label):
-        utils._check_str(label)
+        bt2_utils._check_str(label)
         mapping_ptr = self._borrow_mapping_ptr_by_label(self._ptr, label)
 
         if mapping_ptr is None:
@@ -269,15 +270,15 @@ class _EnumerationFieldClassConst(_IntegerFieldClassConst, collections.abc.Mappi
 
 class _EnumerationFieldClass(_EnumerationFieldClassConst, _IntegerFieldClass):
     def add_mapping(self, label, ranges):
-        utils._check_str(label)
-        utils._check_type(ranges, self._range_set_pycls)
+        bt2_utils._check_str(label)
+        bt2_utils._check_type(ranges, self._range_set_pycls)
 
         if label in self:
             raise ValueError("duplicate mapping label '{}'".format(label))
 
         status = self._add_mapping(self._ptr, label, ranges._ptr)
-        utils._handle_func_status(
-            status, 'cannot add mapping to enumeration field class object'
+        bt2_utils._handle_func_status(
+            status, "cannot add mapping to enumeration field class object"
         )
 
     def __iadd__(self, mappings):
@@ -290,7 +291,7 @@ class _EnumerationFieldClass(_EnumerationFieldClassConst, _IntegerFieldClass):
 class _UnsignedEnumerationFieldClassConst(
     _EnumerationFieldClassConst, _UnsignedIntegerFieldClassConst
 ):
-    _NAME = 'Const unsigned enumeration'
+    _NAME = "Const unsigned enumeration"
     _borrow_mapping_ptr_by_label = staticmethod(
         native_bt.field_class_enumeration_unsigned_borrow_mapping_by_label_const
     )
@@ -301,7 +302,7 @@ class _UnsignedEnumerationFieldClassConst(
     _get_mapping_labels_for_value = staticmethod(
         native_bt.field_class_enumeration_unsigned_get_mapping_labels_for_value
     )
-    _check_int_type = staticmethod(utils._check_uint64)
+    _check_int_type = staticmethod(bt2_utils._check_uint64)
 
 
 class _UnsignedEnumerationFieldClass(
@@ -309,7 +310,7 @@ class _UnsignedEnumerationFieldClass(
     _EnumerationFieldClass,
     _UnsignedIntegerFieldClass,
 ):
-    _NAME = 'Unsigned enumeration'
+    _NAME = "Unsigned enumeration"
     _range_set_pycls = bt2_integer_range_set.UnsignedIntegerRangeSet
     _add_mapping = staticmethod(native_bt.field_class_enumeration_unsigned_add_mapping)
 
@@ -317,7 +318,7 @@ class _UnsignedEnumerationFieldClass(
 class _SignedEnumerationFieldClassConst(
     _EnumerationFieldClassConst, _SignedIntegerFieldClassConst
 ):
-    _NAME = 'Const signed enumeration'
+    _NAME = "Const signed enumeration"
     _borrow_mapping_ptr_by_label = staticmethod(
         native_bt.field_class_enumeration_signed_borrow_mapping_by_label_const
     )
@@ -328,23 +329,23 @@ class _SignedEnumerationFieldClassConst(
     _get_mapping_labels_for_value = staticmethod(
         native_bt.field_class_enumeration_signed_get_mapping_labels_for_value
     )
-    _check_int_type = staticmethod(utils._check_int64)
+    _check_int_type = staticmethod(bt2_utils._check_int64)
 
 
 class _SignedEnumerationFieldClass(
     _SignedEnumerationFieldClassConst, _EnumerationFieldClass, _SignedIntegerFieldClass
 ):
-    _NAME = 'Signed enumeration'
+    _NAME = "Signed enumeration"
     _range_set_pycls = bt2_integer_range_set.SignedIntegerRangeSet
     _add_mapping = staticmethod(native_bt.field_class_enumeration_signed_add_mapping)
 
 
 class _StringFieldClassConst(_FieldClassConst):
-    _NAME = 'Const string'
+    _NAME = "Const string"
 
 
 class _StringFieldClass(_StringFieldClassConst, _FieldClass):
-    _NAME = 'String'
+    _NAME = "String"
 
 
 class _StructureFieldClassMemberConst:
@@ -402,7 +403,7 @@ class _StructureFieldClassMember(_StructureFieldClassMemberConst):
 
     def _user_attributes(self, user_attributes):
         value = bt2_value.create_value(user_attributes)
-        utils._check_type(value, bt2_value.MapValue)
+        bt2_utils._check_type(value, bt2_value.MapValue)
         native_bt.field_class_structure_member_set_user_attributes(
             self._ptr, value._ptr
         )
@@ -411,7 +412,7 @@ class _StructureFieldClassMember(_StructureFieldClassMemberConst):
 
 
 class _StructureFieldClassConst(_FieldClassConst, collections.abc.Mapping):
-    _NAME = 'Const structure'
+    _NAME = "Const structure"
     _borrow_member_ptr_by_index = staticmethod(
         native_bt.field_class_structure_borrow_member_by_index_const
     )
@@ -447,7 +448,7 @@ class _StructureFieldClassConst(_FieldClassConst, collections.abc.Mapping):
             yield native_bt.field_class_structure_member_get_name(member_ptr)
 
     def member_at_index(self, index):
-        utils._check_uint64(index)
+        bt2_utils._check_uint64(index)
 
         if index >= len(self):
             raise IndexError
@@ -458,7 +459,7 @@ class _StructureFieldClassConst(_FieldClassConst, collections.abc.Mapping):
 
 
 class _StructureFieldClass(_StructureFieldClassConst, _FieldClass):
-    _NAME = 'Structure'
+    _NAME = "Structure"
     _borrow_member_by_index = staticmethod(
         native_bt.field_class_structure_borrow_member_by_index
     )
@@ -468,8 +469,8 @@ class _StructureFieldClass(_StructureFieldClassConst, _FieldClass):
     _structure_member_field_class_pycls = property(lambda _: _StructureFieldClassMember)
 
     def append_member(self, name, field_class, user_attributes=None):
-        utils._check_str(name)
-        utils._check_type(field_class, _FieldClass)
+        bt2_utils._check_str(name)
+        bt2_utils._check_type(field_class, _FieldClass)
 
         if name in self:
             raise ValueError("duplicate member name '{}'".format(name))
@@ -478,13 +479,13 @@ class _StructureFieldClass(_StructureFieldClassConst, _FieldClass):
 
         if user_attributes is not None:
             # check now that user attributes are valid
-            user_attributes_value = bt2.create_value(user_attributes)
+            user_attributes_value = bt2_value.create_value(user_attributes)
 
         status = native_bt.field_class_structure_append_member(
             self._ptr, name, field_class._ptr
         )
-        utils._handle_func_status(
-            status, 'cannot append member to structure field class object'
+        bt2_utils._handle_func_status(
+            status, "cannot append member to structure field class object"
         )
 
         if user_attributes is not None:
@@ -498,7 +499,7 @@ class _StructureFieldClass(_StructureFieldClassConst, _FieldClass):
 
 
 class _OptionFieldClassConst(_FieldClassConst):
-    _NAME = 'Const option'
+    _NAME = "Const option"
     _create_field_class_from_ptr_and_get_ref = staticmethod(
         _create_field_class_from_const_ptr_and_get_ref
     )
@@ -513,7 +514,7 @@ class _OptionFieldClassConst(_FieldClassConst):
 
 
 class _OptionWithSelectorFieldClassConst(_OptionFieldClassConst):
-    _NAME = 'Const option (with selector)'
+    _NAME = "Const option (with selector)"
 
     @property
     def selector_field_path(self):
@@ -527,7 +528,7 @@ class _OptionWithSelectorFieldClassConst(_OptionFieldClassConst):
 
 
 class _OptionWithBoolSelectorFieldClassConst(_OptionWithSelectorFieldClassConst):
-    _NAME = 'Const option (with boolean selector)'
+    _NAME = "Const option (with boolean selector)"
 
     @property
     def selector_is_reversed(self):
@@ -539,7 +540,7 @@ class _OptionWithBoolSelectorFieldClassConst(_OptionWithSelectorFieldClassConst)
 
 
 class _OptionWithIntegerSelectorFieldClassConst(_OptionWithSelectorFieldClassConst):
-    _NAME = 'Const option (with integer selector)'
+    _NAME = "Const option (with integer selector)"
 
     @property
     def ranges(self):
@@ -551,7 +552,7 @@ class _OptionWithIntegerSelectorFieldClassConst(_OptionWithSelectorFieldClassCon
 class _OptionWithUnsignedIntegerSelectorFieldClassConst(
     _OptionWithIntegerSelectorFieldClassConst
 ):
-    _NAME = 'Const option (with unsigned integer selector)'
+    _NAME = "Const option (with unsigned integer selector)"
     _range_set_pycls = bt2_integer_range_set._UnsignedIntegerRangeSetConst
     _borrow_selector_ranges_ptr = staticmethod(
         native_bt.field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const
@@ -561,7 +562,7 @@ class _OptionWithUnsignedIntegerSelectorFieldClassConst(
 class _OptionWithSignedIntegerSelectorFieldClassConst(
     _OptionWithIntegerSelectorFieldClassConst
 ):
-    _NAME = 'Const option (with signed integer selector)'
+    _NAME = "Const option (with signed integer selector)"
     _range_set_pycls = bt2_integer_range_set._SignedIntegerRangeSetConst
     _borrow_selector_ranges_ptr = staticmethod(
         native_bt.field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const
@@ -569,7 +570,7 @@ class _OptionWithSignedIntegerSelectorFieldClassConst(
 
 
 class _OptionFieldClass(_OptionFieldClassConst, _FieldClass):
-    _NAME = 'Option'
+    _NAME = "Option"
     _borrow_field_class_ptr = staticmethod(
         native_bt.field_class_option_borrow_field_class
     )
@@ -581,16 +582,16 @@ class _OptionFieldClass(_OptionFieldClassConst, _FieldClass):
 class _OptionWithSelectorFieldClass(
     _OptionWithSelectorFieldClassConst, _OptionFieldClass
 ):
-    _NAME = 'Option (with selector)'
+    _NAME = "Option (with selector)"
 
 
 class _OptionWithBoolSelectorFieldClass(
     _OptionWithBoolSelectorFieldClassConst, _OptionWithSelectorFieldClass
 ):
-    _NAME = 'Option (with boolean selector)'
+    _NAME = "Option (with boolean selector)"
 
     def _selector_is_reversed(self, selector_is_reversed):
-        utils._check_bool(selector_is_reversed)
+        bt2_utils._check_bool(selector_is_reversed)
         native_bt.field_class_option_with_selector_field_bool_set_selector_is_reversed(
             self._ptr, selector_is_reversed
         )
@@ -601,21 +602,21 @@ class _OptionWithBoolSelectorFieldClass(
 class _OptionWithIntegerSelectorFieldClass(
     _OptionWithIntegerSelectorFieldClassConst, _OptionWithSelectorFieldClass
 ):
-    _NAME = 'Option (with integer selector)'
+    _NAME = "Option (with integer selector)"
 
 
 class _OptionWithUnsignedIntegerSelectorFieldClass(
     _OptionWithUnsignedIntegerSelectorFieldClassConst,
     _OptionWithIntegerSelectorFieldClass,
 ):
-    _NAME = 'Option (with unsigned integer selector)'
+    _NAME = "Option (with unsigned integer selector)"
 
 
 class _OptionWithSignedIntegerSelectorFieldClass(
     _OptionWithSignedIntegerSelectorFieldClassConst,
     _OptionWithIntegerSelectorFieldClass,
 ):
-    _NAME = 'Option (with signed integer selector)'
+    _NAME = "Option (with signed integer selector)"
 
 
 class _VariantFieldClassOptionConst:
@@ -673,7 +674,7 @@ class _VariantFieldClassOption(_VariantFieldClassOptionConst):
 
     def _user_attributes(self, user_attributes):
         value = bt2_value.create_value(user_attributes)
-        utils._check_type(value, bt2_value.MapValue)
+        bt2_utils._check_type(value, bt2_value.MapValue)
         native_bt.field_class_variant_option_set_user_attributes(self._ptr, value._ptr)
 
     _user_attributes = property(fset=_user_attributes)
@@ -736,7 +737,7 @@ class _VariantFieldClassWithUnsignedIntegerSelectorOption(
 
 
 class _VariantFieldClassConst(_FieldClassConst, collections.abc.Mapping):
-    _NAME = 'Const variant'
+    _NAME = "Const variant"
     _borrow_option_ptr_by_name = staticmethod(
         native_bt.field_class_variant_borrow_option_by_name_const
     )
@@ -778,7 +779,7 @@ class _VariantFieldClassConst(_FieldClassConst, collections.abc.Mapping):
             yield native_bt.field_class_variant_option_get_name(base_opt_ptr)
 
     def option_at_index(self, index):
-        utils._check_uint64(index)
+        bt2_utils._check_uint64(index)
 
         if index >= len(self):
             raise IndexError
@@ -789,7 +790,7 @@ class _VariantFieldClassConst(_FieldClassConst, collections.abc.Mapping):
 
 
 class _VariantFieldClass(_VariantFieldClassConst, _FieldClass, collections.abc.Mapping):
-    _NAME = 'Variant'
+    _NAME = "Variant"
     _borrow_option_ptr_by_name = staticmethod(
         native_bt.field_class_variant_borrow_option_by_name
     )
@@ -800,17 +801,17 @@ class _VariantFieldClass(_VariantFieldClassConst, _FieldClass, collections.abc.M
 
 
 class _VariantFieldClassWithoutSelectorConst(_VariantFieldClassConst):
-    _NAME = 'Const variant (without selector)'
+    _NAME = "Const variant (without selector)"
 
 
 class _VariantFieldClassWithoutSelector(
     _VariantFieldClassWithoutSelectorConst, _VariantFieldClass
 ):
-    _NAME = 'Variant (without selector)'
+    _NAME = "Variant (without selector)"
 
     def append_option(self, name, field_class, user_attributes=None):
-        utils._check_str(name)
-        utils._check_type(field_class, _FieldClass)
+        bt2_utils._check_str(name)
+        bt2_utils._check_type(field_class, _FieldClass)
 
         if name in self:
             raise ValueError("duplicate option name '{}'".format(name))
@@ -819,13 +820,13 @@ class _VariantFieldClassWithoutSelector(
 
         if user_attributes is not None:
             # check now that user attributes are valid
-            user_attributes_value = bt2.create_value(user_attributes)
+            user_attributes_value = bt2_value.create_value(user_attributes)
 
         status = native_bt.field_class_variant_without_selector_append_option(
             self._ptr, name, field_class._ptr
         )
-        utils._handle_func_status(
-            status, 'cannot append option to variant field class object'
+        bt2_utils._handle_func_status(
+            status, "cannot append option to variant field class object"
         )
 
         if user_attributes is not None:
@@ -839,7 +840,7 @@ class _VariantFieldClassWithoutSelector(
 
 
 class _VariantFieldClassWithIntegerSelectorConst(_VariantFieldClassConst):
-    _NAME = 'Const variant (with selector)'
+    _NAME = "Const variant (with selector)"
 
     @property
     def selector_field_path(self):
@@ -856,30 +857,30 @@ class _VariantFieldClassWithIntegerSelectorConst(_VariantFieldClassConst):
 class _VariantFieldClassWithIntegerSelector(
     _VariantFieldClassWithIntegerSelectorConst, _VariantFieldClass
 ):
-    _NAME = 'Variant (with selector)'
+    _NAME = "Variant (with selector)"
 
     def append_option(self, name, field_class, ranges, user_attributes=None):
-        utils._check_str(name)
-        utils._check_type(field_class, _FieldClass)
-        utils._check_type(ranges, self._variant_option_pycls._range_set_pycls)
+        bt2_utils._check_str(name)
+        bt2_utils._check_type(field_class, _FieldClass)
+        bt2_utils._check_type(ranges, self._variant_option_pycls._range_set_pycls)
 
         if name in self:
             raise ValueError("duplicate option name '{}'".format(name))
 
         if len(ranges) == 0:
-            raise ValueError('range set is empty')
+            raise ValueError("range set is empty")
 
         user_attributes_value = None
 
         if user_attributes is not None:
             # check now that user attributes are valid
-            user_attributes_value = bt2.create_value(user_attributes)
+            user_attributes_value = bt2_value.create_value(user_attributes)
 
         # TODO: check overlaps (precondition of self._append_option())
 
         status = self._append_option(self._ptr, name, field_class._ptr, ranges._ptr)
-        utils._handle_func_status(
-            status, 'cannot append option to variant field class object'
+        bt2_utils._handle_func_status(
+            status, "cannot append option to variant field class object"
         )
 
         if user_attributes is not None:
@@ -895,7 +896,7 @@ class _VariantFieldClassWithIntegerSelector(
 class _VariantFieldClassWithUnsignedIntegerSelectorConst(
     _VariantFieldClassWithIntegerSelectorConst
 ):
-    _NAME = 'Const variant (with unsigned integer selector)'
+    _NAME = "Const variant (with unsigned integer selector)"
     _borrow_option_ptr_by_name = staticmethod(
         native_bt.field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const
     )
@@ -910,7 +911,7 @@ class _VariantFieldClassWithUnsignedIntegerSelector(
     _VariantFieldClassWithUnsignedIntegerSelectorConst,
     _VariantFieldClassWithIntegerSelector,
 ):
-    _NAME = 'Variant (with unsigned integer selector)'
+    _NAME = "Variant (with unsigned integer selector)"
     _variant_option_pycls = _VariantFieldClassWithUnsignedIntegerSelectorOption
     _as_option_ptr = staticmethod(_variant_option_pycls._as_option_ptr)
     _append_option = staticmethod(
@@ -921,7 +922,7 @@ class _VariantFieldClassWithUnsignedIntegerSelector(
 class _VariantFieldClassWithSignedIntegerSelectorConst(
     _VariantFieldClassWithIntegerSelectorConst
 ):
-    _NAME = 'Const variant (with signed integer selector)'
+    _NAME = "Const variant (with signed integer selector)"
     _borrow_option_ptr_by_name = staticmethod(
         native_bt.field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const
     )
@@ -936,7 +937,7 @@ class _VariantFieldClassWithSignedIntegerSelector(
     _VariantFieldClassWithSignedIntegerSelectorConst,
     _VariantFieldClassWithIntegerSelector,
 ):
-    _NAME = 'Variant (with signed integer selector)'
+    _NAME = "Variant (with signed integer selector)"
     _variant_option_pycls = _VariantFieldClassWithSignedIntegerSelectorOption
     _as_option_ptr = staticmethod(_variant_option_pycls._as_option_ptr)
     _append_option = staticmethod(
@@ -968,7 +969,7 @@ class _ArrayFieldClass(_ArrayFieldClassConst, _FieldClass):
 
 
 class _StaticArrayFieldClassConst(_ArrayFieldClassConst):
-    _NAME = 'Const static array'
+    _NAME = "Const static array"
 
     @property
     def length(self):
@@ -976,15 +977,15 @@ class _StaticArrayFieldClassConst(_ArrayFieldClassConst):
 
 
 class _StaticArrayFieldClass(_StaticArrayFieldClassConst, _ArrayFieldClass):
-    _NAME = 'Static array'
+    _NAME = "Static array"
 
 
 class _DynamicArrayFieldClassConst(_ArrayFieldClassConst):
-    _NAME = 'Const dynamic array'
+    _NAME = "Const dynamic array"
 
 
 class _DynamicArrayWithLengthFieldFieldClassConst(_DynamicArrayFieldClassConst):
-    _NAME = 'Const dynamic array (with length field)'
+    _NAME = "Const dynamic array (with length field)"
 
     @property
     def length_field_path(self):
@@ -998,13 +999,13 @@ class _DynamicArrayWithLengthFieldFieldClassConst(_DynamicArrayFieldClassConst):
 
 
 class _DynamicArrayFieldClass(_DynamicArrayFieldClassConst, _ArrayFieldClass):
-    _NAME = 'Dynamic array'
+    _NAME = "Dynamic array"
 
 
 class _DynamicArrayWithLengthFieldFieldClass(
     _DynamicArrayWithLengthFieldFieldClassConst, _DynamicArrayFieldClass
 ):
-    _NAME = 'Dynamic array (with length field)'
+    _NAME = "Dynamic array (with length field)"
 
 
 _FIELD_CLASS_TYPE_TO_CONST_OBJ = {
This page took 0.032308 seconds and 4 git commands to generate.