From cb0f0ccb88221a35cd2093a8e2d487227088699b Mon Sep 17 00:00:00 2001 From: George Marchment <georgemarchment@yahoo.fr> Date: Tue, 11 Mar 2025 15:05:16 +0100 Subject: [PATCH] debugged a small thing --- src/call.py | 13 +++++++------ src/operation.py | 1 - src/outils.py | 2 +- src/workflow.py | 7 ++++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/call.py b/src/call.py index b50e93b..1fdeae7 100644 --- a/src/call.py +++ b/src/call.py @@ -168,12 +168,13 @@ class Call(Executor): #if(re.fullmatch(constant.WORD, param) and not analysed_param or param in ['[]'] or param[:7]=="params."): #TODO this needs to be updated to proper formalise how you search for channels channels = self.origin.get_channels_from_name_same_level(param) - if(channels==[]): - channels = self.origin.get_channels_from_name_inside_level(param) - if(channels==[]): - channels = self.origin.get_channels_from_name_above_level(param) - if(channels==[]): - channels = self.origin.get_channels_from_name_other_blocks_on_same_level(param) + #if(channels==[]): + # channels = self.origin.get_channels_from_name_inside_level(param) + #if(channels==[]): + # channels = self.origin.get_channels_from_name_above_level(param) + # print(param, channels) + #if(channels==[]): + # channels = self.origin.get_channels_from_name_other_blocks_on_same_level(param) if(channels==[]): channels = self.origin.get_channels_from_name_all_channels(param) if(channels==[]): diff --git a/src/operation.py b/src/operation.py index 5e838ab..f0a28d0 100644 --- a/src/operation.py +++ b/src/operation.py @@ -103,7 +103,6 @@ class Operation(Executor): channel = Channel(name=name, origin=self.origin) self.origin.add_channel(channel) channels = [channel] - else: channel = Channel(name=name, origin=self.origin) self.origin.takes_channels.append(channel) diff --git a/src/outils.py b/src/outils.py index 0197475..88e3e9b 100644 --- a/src/outils.py +++ b/src/outils.py @@ -1298,7 +1298,7 @@ def remove_extra_jumps(code): changed = False temp = code def replacer(match): - return "\n\n" + return "\n\n" code = re.sub(r"\n\s*\n\s*\n", replacer, code) if(code!=temp): changed = True diff --git a/src/workflow.py b/src/workflow.py index efaab88..faeb68e 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -619,7 +619,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen if(new.find("=")!=-1): if(new.split("=")[0].strip()==new.split("=")[1].strip()): new = '' - code = code.replace(old, new) + #code = code.replace(old, new) + code = replace_group1(code, fr"({re.escape(old)})[^\w]", new) if(temp_code==code): raise Exception("Something went wrong: The code hasn't changed") @@ -837,7 +838,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen #Only create the subworkflows for clusters with more than one element processes_added = [] things_added_in_cluster = [] - if(len(elements)>1 and at_least_one_process): + if(len(elements)>=1 and at_least_one_process): name, body, take, emit = "", "", "", "" first_element = True @@ -1080,7 +1081,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen for old, new in channels_to_replace_outside_of_cluster: - pattern= fr"[ \(,]({re.escape(old)})" + pattern= fr"[ \(,]({re.escape(old)})[^\w]" code = replace_group1(code, pattern, new) #code = code.replace(old, new) -- GitLab