From cd1ef6f2860c2b6bf3c22ee984347029c31ac827 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Mon, 22 Jul 2019 13:45:22 -0400 Subject: [PATCH] bt2: do not require sink component's _graph_is_configured() method The "graph is configured" method is not required when you implement a component class in C, as it's not strictly needed to make the graph runnable, so it should not be required in Python either. A default _UserSinkComponent._graph_is_configured() method is added to make it optional. Signed-off-by: Philippe Proulx Change-Id: I3ef4e3d159af61e2d06a0a47dddc1234aed93ae1 Reviewed-on: https://review.lttng.org/c/babeltrace/+/1740 Tested-by: jenkins --- src/bindings/python/bt2/bt2/component.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/bindings/python/bt2/bt2/component.py b/src/bindings/python/bt2/bt2/component.py index d7d42a71..f3184218 100644 --- a/src/bindings/python/bt2/bt2/component.py +++ b/src/bindings/python/bt2/bt2/component.py @@ -481,13 +481,6 @@ class _UserComponentType(type): cls, comp_cls_name, comp_cls_descr, comp_cls_help ) elif _UserSinkComponent in bases: - if not hasattr(cls, '_graph_is_configured'): - raise bt2.IncompleteUserClass( - "cannot create component class '{}': missing a _graph_is_configured() method".format( - class_name - ) - ) - if not hasattr(cls, '_consume'): raise bt2.IncompleteUserClass( "cannot create component class '{}': missing a _consume() method".format( @@ -833,6 +826,9 @@ class _UserSinkComponent(_UserComponent, _SinkComponent): def _bt_graph_is_configured_from_native(self): self._graph_is_configured() + def _graph_is_configured(self): + pass + @property def _input_ports(self): def get_input_port_count(self_ptr): -- 2.34.1