X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fcomponent.py;h=7f56757d61a8414543e7f733cbbb8f23ef9088a2;hb=c594ab036e1797da45594dce8dfc07d90f2bb81f;hp=3480f6570703e2ae49db6c0a99d62daabf89b0a7;hpb=578e048b5debf169e286e5b5cc747b5d6c16886d;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/component.py b/src/bindings/python/bt2/bt2/component.py index 3480f657..7f56757d 100644 --- a/src/bindings/python/bt2/bt2/component.py +++ b/src/bindings/python/bt2/bt2/component.py @@ -100,8 +100,6 @@ def _handle_component_status(status, gen_error_msg): raise bt2.Stop elif status == native_bt.SELF_COMPONENT_STATUS_AGAIN: raise bt2.TryAgain - elif status == native_bt.SELF_COMPONENT_STATUS_REFUSE_PORT_CONNECTION: - raise bt2.PortConnectionRefused elif status < 0: raise bt2.Error(gen_error_msg) @@ -184,6 +182,11 @@ class _Component: assert name is not None return name + @property + def logging_level(self): + ptr = self._as_component_ptr(self._ptr) + return native_bt.component_get_logging_level(ptr) + @property def cls(self): cc_ptr = self._borrow_component_class_ptr(self._ptr) @@ -519,7 +522,7 @@ class _UserComponentType(type): def addr(cls): return int(cls._cc_ptr) - def _query_from_native(cls, query_exec_ptr, obj, params_ptr): + def _query_from_native(cls, query_exec_ptr, obj, params_ptr, log_level): # this can raise, in which case the native call to # bt_component_class_query() returns NULL if params_ptr is not None: @@ -531,7 +534,7 @@ class _UserComponentType(type): query_exec_ptr) # this can raise, but the native side checks the exception - results = cls._query(query_exec, obj, params) + results = cls._query(query_exec, obj, params, log_level) # this can raise, but the native side checks the exception results = bt2.create_value(results) @@ -544,7 +547,7 @@ class _UserComponentType(type): return results_addr - def _query(cls, query_executor, obj, params): + def _query(cls, query_executor, obj, params, log_level): raise NotImplementedError def _component_class_ptr(self): @@ -575,6 +578,12 @@ class _UserComponent(metaclass=_UserComponentType): assert name is not None return name + @property + def logging_level(self): + ptr = self._as_not_self_specific_component_ptr(self._ptr) + ptr = self._as_component_ptr(ptr) + return native_bt.component_get_logging_level(ptr) + @property def cls(self): comp_ptr = self._as_not_self_specific_component_ptr(self._ptr) @@ -591,27 +600,6 @@ class _UserComponent(metaclass=_UserComponentType): def _finalize(self): pass - def _accept_port_connection(self, port, other_port): - return True - - def _accept_port_connection_from_native(self, self_port_ptr, self_port_type, other_port_ptr): - port = bt2.port._create_self_from_ptr_and_get_ref( - self_port_ptr, self_port_type) - - if self_port_type == native_bt.PORT_TYPE_OUTPUT: - other_port_type = native_bt.PORT_TYPE_INPUT - else: - other_port_type = native_bt.PORT_TYPE_OUTPUT - - other_port = bt2.port._create_from_ptr_and_get_ref( - other_port_ptr, other_port_type) - res = self._accept_port_connection(port, other_port_ptr) - - if type(res) is not bool: - raise TypeError("'{}' is not a 'bool' object") - - return res - def _port_connected(self, port, other_port): pass