From: Philippe Proulx Date: Wed, 14 Aug 2019 00:08:57 +0000 (-0400) Subject: bt2: rename `_Field.field_class` -> `_Field.cls` X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=d8e2073cd8f489baab09894fa2ed3e976a235eb0 bt2: rename `_Field.field_class` -> `_Field.cls` 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 Change-Id: I5dd6f837a7f79b05ca933cd30bd281da2fbe5728 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1919 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- diff --git a/src/bindings/python/bt2/bt2/field.py b/src/bindings/python/bt2/bt2/field.py index 512271bd..ecbd9715 100644 --- a/src/bindings/python/bt2/bt2/field.py +++ b/src/bindings/python/bt2/bt2/field.py @@ -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): diff --git a/tests/bindings/python/bt2/test_packet.py b/tests/bindings/python/bt2/test_packet.py index 250ac466..aad07c44 100644 --- a/tests/bindings/python/bt2/test_packet.py +++ b/tests/bindings/python/bt2/test_packet.py @@ -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)