From 9a695e28467b8ff9e9eca51553fa75702301945f Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:17:53 +0100 Subject: [PATCH] Fix ruff/flake8-bugbear (B020) issues --- capsul/execution_context.py | 10 +++++----- capsul/pipeline/pipeline.py | 8 ++++---- capsul/pipeline/python_export.py | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/capsul/execution_context.py b/capsul/execution_context.py index 2206ffd9..fe34824a 100644 --- a/capsul/execution_context.py +++ b/capsul/execution_context.py @@ -772,15 +772,15 @@ def find_temporary_to_generate(executable): field.generate_temporary = False if isinstance(node, ProcessIteration): node.process.field(field.name).generate_temporary = field.generate_temporary - for node, parameter in executable.get_linked_items( + for snode, parameter in executable.get_linked_items( node, field.name, direction="links_from", in_outer_pipelines=True ): if isinstance(node, ProcessIteration): - stack.append((node.process, node.process.field(parameter))) - # print('!temporaries! + ', node.process.full_name, ':', parameter) + stack.append((snode.process, snode.process.field(parameter))) + # print('!temporaries! + ', snode.process.full_name, ':', parameter) else: - stack.append((node, node.field(parameter))) - # print('!temporaries! + ', node.full_name, ':', parameter) + stack.append((snode, snode.field(parameter))) + # print('!temporaries! + ', snode.full_name, ':', parameter) # print('!temporaries! parameters with temporary') # for n, p in temporaries: diff --git a/capsul/pipeline/pipeline.py b/capsul/pipeline/pipeline.py index 7fdb7b3e..d2fd5190 100644 --- a/capsul/pipeline/pipeline.py +++ b/capsul/pipeline/pipeline.py @@ -2460,10 +2460,10 @@ def __setitem__(self, path, value): def dispatch_value(self, node, name, value): """Propagate the value from a pipeline plug through links""" # print(f"!dispatch! {node.name}.{name} = {value}") - for node, plug in self.dispatch_plugs(node, name): - # print(f"!dispatch! -> {node.name}.{plug}") - if getattr(node, plug, undefined) != value: - setattr(node, plug, value) + for snode, plug in self.dispatch_plugs(node, name): + # print(f"!dispatch! -> {snode.name}.{plug}") + if getattr(snode, plug, undefined) != value: + setattr(snode, plug, value) def dispatch_plugs(self, node, name): """generator through linked plugs""" diff --git a/capsul/pipeline/python_export.py b/capsul/pipeline/python_export.py index b1f2220d..f35dac55 100644 --- a/capsul/pipeline/python_export.py +++ b/capsul/pipeline/python_export.py @@ -139,7 +139,7 @@ def _write_process(process, pyf, name, enabled, skip_invalid): if isinstance(snode, Pipeline): sself_str = '%s.nodes["%s"]' % (self_str, "%s") - for node_name, snode in snode.nodes.items(): + for node_name, _ in snode.nodes.items(): scnode = cnode.nodes[node_name] if node_name == "":