From 776a2a252c9875caa1e8b4f41cb8cc12c79611c3 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Thu, 10 Sep 2020 11:35:58 -0400 Subject: [PATCH] Reformat Python files with Black v20.8b1 Signed-off-by: Philippe Proulx Change-Id: I50a663f02800456ce2370383bbdaefa8e0ebabc1 Reviewed-on: https://review.lttng.org/c/babeltrace/+/4062 Tested-by: jenkins --- src/bindings/python/bt2/bt2/__init__.py | 4 +- src/bindings/python/bt2/bt2/error.py | 38 ++++++++++--------- .../python/bt2/bt2/message_iterator.py | 12 ++++-- src/bindings/python/bt2/bt2/trace_class.py | 6 ++- .../python/bt2/test_component_class.py | 4 +- tests/bindings/python/bt2/test_event.py | 6 ++- tests/bindings/python/bt2/test_message.py | 10 +++-- .../src.ctf.lttng-live/lttng_live_server.py | 4 +- 8 files changed, 50 insertions(+), 34 deletions(-) diff --git a/src/bindings/python/bt2/bt2/__init__.py b/src/bindings/python/bt2/bt2/__init__.py index b642e6a1..9ed080e8 100644 --- a/src/bindings/python/bt2/bt2/__init__.py +++ b/src/bindings/python/bt2/bt2/__init__.py @@ -232,10 +232,10 @@ class _MemoryError(_Error): class UnknownObject(Exception): - ''' + """ Raised when a component class handles a query for an object it doesn't know about. - ''' + """ pass diff --git a/src/bindings/python/bt2/bt2/error.py b/src/bindings/python/bt2/bt2/error.py index 9d06b88e..a0673451 100644 --- a/src/bindings/python/bt2/bt2/error.py +++ b/src/bindings/python/bt2/bt2/error.py @@ -58,11 +58,11 @@ class _ComponentErrorCause(_ErrorCause): self._component_name = native_bt.error_cause_component_actor_get_component_name( ptr ) - self._component_class_type = native_bt.error_cause_component_actor_get_component_class_type( - ptr + self._component_class_type = ( + native_bt.error_cause_component_actor_get_component_class_type(ptr) ) - self._component_class_name = native_bt.error_cause_component_actor_get_component_class_name( - ptr + self._component_class_name = ( + native_bt.error_cause_component_actor_get_component_class_name(ptr) ) self._plugin_name = native_bt.error_cause_component_actor_get_plugin_name(ptr) @@ -86,11 +86,11 @@ class _ComponentErrorCause(_ErrorCause): class _ComponentClassErrorCause(_ErrorCause): def __init__(self, ptr): super().__init__(ptr) - self._component_class_type = native_bt.error_cause_component_class_actor_get_component_class_type( - ptr + self._component_class_type = ( + native_bt.error_cause_component_class_actor_get_component_class_type(ptr) ) - self._component_class_name = native_bt.error_cause_component_class_actor_get_component_class_name( - ptr + self._component_class_name = ( + native_bt.error_cause_component_class_actor_get_component_class_name(ptr) ) self._plugin_name = native_bt.error_cause_component_class_actor_get_plugin_name( ptr @@ -112,20 +112,22 @@ class _ComponentClassErrorCause(_ErrorCause): class _MessageIteratorErrorCause(_ErrorCause): def __init__(self, ptr): super().__init__(ptr) - self._component_name = native_bt.error_cause_message_iterator_actor_get_component_name( - ptr + self._component_name = ( + native_bt.error_cause_message_iterator_actor_get_component_name(ptr) ) - self._component_output_port_name = native_bt.error_cause_message_iterator_actor_get_component_output_port_name( - ptr + self._component_output_port_name = ( + native_bt.error_cause_message_iterator_actor_get_component_output_port_name( + ptr + ) ) - self._component_class_type = native_bt.error_cause_message_iterator_actor_get_component_class_type( - ptr + self._component_class_type = ( + native_bt.error_cause_message_iterator_actor_get_component_class_type(ptr) ) - self._component_class_name = native_bt.error_cause_message_iterator_actor_get_component_class_name( - ptr + self._component_class_name = ( + native_bt.error_cause_message_iterator_actor_get_component_class_name(ptr) ) - self._plugin_name = native_bt.error_cause_message_iterator_actor_get_plugin_name( - ptr + self._plugin_name = ( + native_bt.error_cause_message_iterator_actor_get_plugin_name(ptr) ) @property diff --git a/src/bindings/python/bt2/bt2/message_iterator.py b/src/bindings/python/bt2/bt2/message_iterator.py index ba9c3161..62c5610c 100644 --- a/src/bindings/python/bt2/bt2/message_iterator.py +++ b/src/bindings/python/bt2/bt2/message_iterator.py @@ -390,8 +390,10 @@ class _UserMessageIterator(_MessageIterator): ) ) - ptr = native_bt.message_discarded_events_create_with_default_clock_snapshots( - self._bt_ptr, stream._ptr, beg_clock_snapshot, end_clock_snapshot + ptr = ( + native_bt.message_discarded_events_create_with_default_clock_snapshots( + self._bt_ptr, stream._ptr, beg_clock_snapshot, end_clock_snapshot + ) ) else: if beg_clock_snapshot is not None or end_clock_snapshot is not None: @@ -435,8 +437,10 @@ class _UserMessageIterator(_MessageIterator): ) ) - ptr = native_bt.message_discarded_packets_create_with_default_clock_snapshots( - self._bt_ptr, stream._ptr, beg_clock_snapshot, end_clock_snapshot + ptr = ( + native_bt.message_discarded_packets_create_with_default_clock_snapshots( + self._bt_ptr, stream._ptr, beg_clock_snapshot, end_clock_snapshot + ) ) else: if beg_clock_snapshot is not None or end_clock_snapshot is not None: diff --git a/src/bindings/python/bt2/bt2/trace_class.py b/src/bindings/python/bt2/bt2/trace_class.py index e9987449..25a5cb62 100644 --- a/src/bindings/python/bt2/bt2/trace_class.py +++ b/src/bindings/python/bt2/bt2/trace_class.py @@ -483,8 +483,10 @@ class _TraceClass(_TraceClassConst): ) else: utils._check_type(ranges, bt2_integer_range_set.SignedIntegerRangeSet) - ptr = native_bt.field_class_option_with_selector_field_integer_signed_create( - self._ptr, content_fc._ptr, selector_fc._ptr, ranges._ptr + ptr = ( + native_bt.field_class_option_with_selector_field_integer_signed_create( + self._ptr, content_fc._ptr, selector_fc._ptr, ranges._ptr + ) ) self._check_field_class_create_status(ptr, 'option') diff --git a/tests/bindings/python/bt2/test_component_class.py b/tests/bindings/python/bt2/test_component_class.py index bee368a1..08b0c02b 100644 --- a/tests/bindings/python/bt2/test_component_class.py +++ b/tests/bindings/python/bt2/test_component_class.py @@ -300,11 +300,11 @@ class UserComponentClassTestCase(unittest.TestCase): class ComponentClassTestCase(unittest.TestCase): def setUp(self): class MySink(bt2._UserSinkComponent): - ''' + """ The description. The help. - ''' + """ def _user_consume(self): pass diff --git a/tests/bindings/python/bt2/test_event.py b/tests/bindings/python/bt2/test_event.py index 39486bc6..979579b0 100644 --- a/tests/bindings/python/bt2/test_event.py +++ b/tests/bindings/python/bt2/test_event.py @@ -330,7 +330,8 @@ class EventTestCase(unittest.TestCase): def test_const_getitem_no_packet(self): msg = self._create_test_const_event_message( - event_fields_config=self._event_payload_fields_config, with_ep=True, + event_fields_config=self._event_payload_fields_config, + with_ep=True, ) ev = msg.event @@ -377,7 +378,8 @@ class EventTestCase(unittest.TestCase): def test_iter_payload_only(self): msg = self._create_test_const_event_message( - event_fields_config=self._event_payload_fields_config, with_ep=True, + event_fields_config=self._event_payload_fields_config, + with_ep=True, ) expected_field_names = [ # payload diff --git a/tests/bindings/python/bt2/test_message.py b/tests/bindings/python/bt2/test_message.py index d9e2fdbc..fc75e1c5 100644 --- a/tests/bindings/python/bt2/test_message.py +++ b/tests/bindings/python/bt2/test_message.py @@ -425,7 +425,8 @@ class CreateDiscardedEventMessageTestCase(unittest.TestCase): def msg_iter_next(msg_iter, stream): with self.assertRaisesRegex( - ValueError, 'discarded event count is 0', + ValueError, + 'discarded event count is 0', ): msg_iter._create_discarded_events_message(stream, count=0) @@ -572,7 +573,8 @@ class CreateDiscardedPacketMessageTestCase(unittest.TestCase): def msg_iter_next(msg_iter, stream): with self.assertRaisesRegex( - ValueError, 'discarded packet count is 0', + ValueError, + 'discarded packet count is 0', ): msg_iter._create_discarded_packets_message(stream, count=0) @@ -604,7 +606,9 @@ class CreateDiscardedPacketMessageTestCase(unittest.TestCase): # Trying to create when the stream does not support discarded packets. def test_create_unsupported_raises(self): def create_stream_class(tc, cc): - return tc.create_stream_class(supports_packets=True,) + return tc.create_stream_class( + supports_packets=True, + ) def msg_iter_next(msg_iter, stream): with self.assertRaisesRegex( diff --git a/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py b/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py index 9bff6086..be42ac4f 100644 --- a/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py +++ b/tests/data/plugins/src.ctf.lttng-live/lttng_live_server.py @@ -1533,7 +1533,9 @@ if __name__ == '__main__': help='Prefix to prepend to the trace paths of session configurations', ) parser.add_argument( - '--sessions-filename', type=str, help='Path to a session configuration file', + '--sessions-filename', + type=str, + help='Path to a session configuration file', ) parser.add_argument( '-h', -- 2.34.1