From f20175d166148917e7587cb25823575f0dcb3693 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Tue, 15 Aug 2023 16:43:03 -0400 Subject: [PATCH] fix: make flake8 6.x happy ./src/bindings/python/bt2/bt2/trace_collection_message_iterator.py:143:12: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` ./src/bindings/python/bt2/bt2/trace_collection_message_iterator.py:151:12: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` ./src/bindings/python/bt2/bt2/trace_collection_message_iterator.py:156:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` ./src/bindings/python/bt2/bt2/trace_collection_message_iterator.py:160:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` ./src/bindings/python/bt2/bt2/trace_collection_message_iterator.py:164:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` ./src/bindings/python/bt2/bt2/trace_collection_message_iterator.py:168:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` ./tests/data/auto-source-discovery/params-log-level/bt_plugin_test.py:33:20: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()` Change-Id: I388dfe9b1c8fa7030a805e6c6e0e487e56947616 Signed-off-by: Michael Jeanson Reviewed-on: https://review.lttng.org/c/babeltrace/+/10612 Reviewed-by: Simon Marchi Tested-by: jenkins --- .../bt2/bt2/trace_collection_message_iterator.py | 12 ++++++------ .../params-log-level/bt_plugin_test.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py b/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py index ed474cd0..79946290 100644 --- a/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py +++ b/src/bindings/python/bt2/bt2/trace_collection_message_iterator.py @@ -140,7 +140,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"] @@ -148,24 +148,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) diff --git a/tests/data/auto-source-discovery/params-log-level/bt_plugin_test.py b/tests/data/auto-source-discovery/params-log-level/bt_plugin_test.py index 91d0c74c..36315a4a 100644 --- a/tests/data/auto-source-discovery/params-log-level/bt_plugin_test.py +++ b/tests/data/auto-source-discovery/params-log-level/bt_plugin_test.py @@ -30,7 +30,7 @@ class TestIter(bt2._UserMessageIterator): log_level = self._component.logging_level stream_name = "{}: {}".format(comp_cls_name, log_level) elif params["what"] == "python-obj": - assert type(obj) == str or obj is None + assert type(obj) is str or obj is None stream_name = "{}: {}".format(comp_cls_name, obj) else: assert False -- 2.34.1