From 55f1149f253bfb3f384a02e53586963862484e1b Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sun, 19 Nov 2023 22:14:42 +0100 Subject: [PATCH] Use directly a set comprehension... ... instead of a list comprehension to initialise a set. --- capsul/pipeline/test/test_custom_nodes.py | 10 ++++------ capsul/pipeline/test/test_iterative_process.py | 2 +- capsul/qt_gui/widgets/settings_editor.py | 18 ++++++++---------- capsul/sphinxext/capsul_pipeline_rst.py | 2 +- capsul/sphinxext/capsul_usecases_rst.py | 2 +- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/capsul/pipeline/test/test_custom_nodes.py b/capsul/pipeline/test/test_custom_nodes.py index 7306ac53f..9bce8ed0f 100644 --- a/capsul/pipeline/test/test_custom_nodes.py +++ b/capsul/pipeline/test/test_custom_nodes.py @@ -275,12 +275,10 @@ def pipeline_definition(self): self.add_iterative_process( "test_it", "capsul.pipeline.test.test_custom_nodes.CVtest", - non_iterative_plugs=set( - [ - "model", - "base", - ] - ), + non_iterative_plugs={ + "model", + "base", + }, make_optional=["out1"], ) self.add_custom_node( diff --git a/capsul/pipeline/test/test_iterative_process.py b/capsul/pipeline/test/test_iterative_process.py index 93b62e6c3..c45264523 100644 --- a/capsul/pipeline/test/test_iterative_process.py +++ b/capsul/pipeline/test/test_iterative_process.py @@ -279,7 +279,7 @@ def test_iterative_big_pipeline_workflow(self): subject = workflow.parameters_values[proxy[1]] subjects.add(subject) self.assertIn(subject, ["toto", "tutu", "tata", "titi", "tete"]) - self.assertEqual(subjects, set(["toto", "tutu", "tata", "titi", "tete"])) + self.assertEqual(subjects, {"toto", "tutu", "tata", "titi", "tete"}) def test_iterative_pipeline_workflow_run(self): self.small_pipeline.output_image = [ diff --git a/capsul/qt_gui/widgets/settings_editor.py b/capsul/qt_gui/widgets/settings_editor.py index aa41a3f34..d8b7c927a 100644 --- a/capsul/qt_gui/widgets/settings_editor.py +++ b/capsul/qt_gui/widgets/settings_editor.py @@ -47,16 +47,14 @@ def update_gui(self): self.tab_wid.clear() self.module_tabs = {} resource = self.resource_combo.currentText() - non_modules = set( - [ - "dataset", - "config_modules", - "python_modules", - "database", - "persistent", - "start_workers", - ] - ) + non_modules = { + "dataset", + "config_modules", + "python_modules", + "database", + "persistent", + "start_workers", + } mod_map = [ f.name for f in getattr(self.config, resource).fields() diff --git a/capsul/sphinxext/capsul_pipeline_rst.py b/capsul/sphinxext/capsul_pipeline_rst.py index 93821520f..0836b67b1 100644 --- a/capsul/sphinxext/capsul_pipeline_rst.py +++ b/capsul/sphinxext/capsul_pipeline_rst.py @@ -124,7 +124,7 @@ ): # From the modules full path 'm1.m2.pipeline/process' get the module # name 'm2' - module_names = set([x.split(".")[1] for x in modules]) + module_names = {x.split(".")[1] for x in modules} # Sort each item according to its module name. # The result is a dict of the form 'd[m2] = [pipeline/process1, ...]'. diff --git a/capsul/sphinxext/capsul_usecases_rst.py b/capsul/sphinxext/capsul_usecases_rst.py index 7f04aee40..bedc0dd89 100644 --- a/capsul/sphinxext/capsul_usecases_rst.py +++ b/capsul/sphinxext/capsul_usecases_rst.py @@ -83,7 +83,7 @@ # Sort all the pilots # > from the pilots full path 'm1.m2.pipeline' get the module name 'm2' -module_names = set([x.split(".")[1] for x in pilots]) +module_names = {x.split(".")[1] for x in pilots} # > sort each pilot according to its module name. # > the result is a dict of the form 'd[m2] = [pilot1, ...]' sorted_pilots = {}