bt2: rename `_Field.field_class` -> `_Field.cls`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 14 Aug 2019 00:08:57 +0000 (20:08 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Aug 2019 15:41:44 +0000 (11:41 -0400)
This makes it match what we have for the class of an event object, the
class of a stream object, and the class of a trace object (`cls`
properties).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I5dd6f837a7f79b05ca933cd30bd281da2fbe5728
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1919
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
src/bindings/python/bt2/bt2/field.py
tests/bindings/python/bt2/test_packet.py

index 512271bd95c9a055f6b6108be2035cb5344f043a..ecbd9715753ce3e6fcec9d4f36dff19f288abd32 100644 (file)
@@ -59,7 +59,7 @@ class _Field(object._UniqueObject):
         return self._spec_eq(other)
 
     @property
-    def field_class(self):
+    def cls(self):
         field_class_ptr = native_bt.field_borrow_class_const(self._ptr)
         assert field_class_ptr is not None
         return bt2_field_class._create_field_class_from_ptr_and_get_ref(field_class_ptr)
@@ -96,7 +96,7 @@ class _BitArrayField(_Field):
         return str(self.value_as_integer)
 
     def __len__(self):
-        return self.field_class.length
+        return self.cls.length
 
 
 @functools.total_ordering
@@ -440,7 +440,7 @@ class _StructureField(_ContainerField, collections.abc.MutableMapping):
     _NAME = 'Structure'
 
     def _count(self):
-        return len(self.field_class)
+        return len(self.cls)
 
     def __setitem__(self, key, value):
         # raises if key is somehow invalid
@@ -452,7 +452,7 @@ class _StructureField(_ContainerField, collections.abc.MutableMapping):
 
     def __iter__(self):
         # same name iterator
-        return iter(self.field_class)
+        return iter(self.cls)
 
     def _spec_eq(self, other):
         if not isinstance(other, collections.abc.Mapping):
index 250ac466c55dc4aa07aecadb3a6cd78fe9bdcaab..aad07c4441b3d3e8b2706177976f053216812db8 100644 (file)
@@ -90,7 +90,7 @@ class PacketTestCase(unittest.TestCase):
 
     def test_context_field(self):
         packet, stream, pc_fc = self._create_packet(with_pc=True)
-        self.assertEqual(packet.context_field.field_class.addr, pc_fc.addr)
+        self.assertEqual(packet.context_field.cls.addr, pc_fc.addr)
 
     def test_no_context_field(self):
         packet, _, _ = self._create_packet(with_pc=False)
This page took 0.026915 seconds and 4 git commands to generate.