fix: make flake8 6.x happy
[babeltrace.git] / src / bindings / python / bt2 / bt2 / trace_collection_message_iterator.py
index 4e7347a92a01128a6265f4b2328739540d3044c5..03132cc212e6dd5a30ce206e5a5f109fa484f7ae 100644 (file)
@@ -76,7 +76,8 @@ class ComponentSpec(_BaseComponentSpec):
         super().__init__(params, obj, logging_level)
 
         is_cc_object = isinstance(
-            component_class, (bt2._SourceComponentClass, bt2._FilterComponentClass)
+            component_class,
+            (bt2._SourceComponentClassConst, bt2._FilterComponentClassConst),
         )
         is_user_cc_type = isinstance(
             component_class, bt2_component._UserComponentType
@@ -157,7 +158,7 @@ def _auto_discover_source_component_specs(auto_source_comp_specs, plugin_set):
 
     res = bt2_value._create_from_ptr(res_ptr)
 
-    assert type(res) == bt2.MapValue
+    assert type(res) is bt2.MapValue
     assert 'status' in res
 
     status = res['status']
@@ -165,24 +166,24 @@ def _auto_discover_source_component_specs(auto_source_comp_specs, plugin_set):
 
     comp_specs = []
     comp_specs_raw = res['results']
-    assert type(comp_specs_raw) == bt2.ArrayValue
+    assert type(comp_specs_raw) is bt2.ArrayValue
 
     used_input_indices = set()
 
     for comp_spec_raw in comp_specs_raw:
-        assert type(comp_spec_raw) == bt2.ArrayValue
+        assert type(comp_spec_raw) is bt2.ArrayValue
         assert len(comp_spec_raw) == 4
 
         plugin_name = comp_spec_raw[0]
-        assert type(plugin_name) == bt2.StringValue
+        assert type(plugin_name) is bt2.StringValue
         plugin_name = str(plugin_name)
 
         class_name = comp_spec_raw[1]
-        assert type(class_name) == bt2.StringValue
+        assert type(class_name) is bt2.StringValue
         class_name = str(class_name)
 
         comp_inputs = comp_spec_raw[2]
-        assert type(comp_inputs) == bt2.ArrayValue
+        assert type(comp_inputs) is bt2.ArrayValue
 
         comp_orig_indices = comp_spec_raw[3]
         assert type(comp_orig_indices)
@@ -258,15 +259,13 @@ def _get_ns(obj):
 
 
 class _TraceCollectionMessageIteratorProxySink(bt2_component._UserSinkComponent):
-    def __init__(self, params, msg_list):
+    def __init__(self, config, params, msg_list):
         assert type(msg_list) is list
         self._msg_list = msg_list
         self._add_input_port('in')
 
     def _user_graph_is_configured(self):
-        self._msg_iter = self._create_input_port_message_iterator(
-            self._input_ports['in']
-        )
+        self._msg_iter = self._create_message_iterator(self._input_ports['in'])
 
     def _user_consume(self):
         assert self._msg_list[0] is None
@@ -345,34 +344,30 @@ class TraceCollectionMessageIterator(bt2_message_iterator._MessageIterator):
         self._stream_inter_port_to_range = {}
 
         for src_comp_and_spec in self._src_comps_and_specs:
-            try:
-                inputs = src_comp_and_spec.spec.params['inputs']
-            except KeyError as e:
-                raise ValueError(
-                    'all source components must be created with an "inputs" parameter in stream intersection mode'
-                ) from e
-
-            params = {'inputs': inputs}
-
-            # query the port's component for the `babeltrace.trace-info`
+            # Query the port's component for the `babeltrace.trace-infos`
             # object which contains the range for each stream, from which we can
             # compute the intersection of the streams in each trace.
             query_exec = bt2.QueryExecutor(
-                src_comp_and_spec.spec.component_class, 'babeltrace.trace-info', params
+                src_comp_and_spec.spec.component_class,
+                'babeltrace.trace-infos',
+                src_comp_and_spec.spec.params,
             )
             trace_infos = query_exec.query()
 
             for trace_info in trace_infos:
                 begin = max(
-                    [stream['range-ns']['begin'] for stream in trace_info['streams']]
+                    [
+                        stream['range-ns']['begin']
+                        for stream in trace_info['stream-infos']
+                    ]
                 )
                 end = min(
-                    [stream['range-ns']['end'] for stream in trace_info['streams']]
+                    [stream['range-ns']['end'] for stream in trace_info['stream-infos']]
                 )
 
                 # Each port associated to this trace will have this computed
                 # range.
-                for stream in trace_info['streams']:
+                for stream in trace_info['stream-infos']:
                     # A port name is unique within a component, but not
                     # necessarily across all components.  Use a component
                     # and port name pair to make it unique across the graph.
@@ -501,7 +496,7 @@ class TraceCollectionMessageIterator(bt2_message_iterator._MessageIterator):
         if not self._connect_ports:
             return
 
-        if type(port) is bt2_port._InputPort:
+        if type(port) is bt2_port._InputPortConst:
             return
 
         if component not in [comp.comp for comp in self._src_comps_and_specs]:
This page took 0.026504 seconds and 4 git commands to generate.