diff --git a/src/call.py b/src/call.py index b50e93b2716d465bdc261ecb7d27517a6fa84522..1fdeae70be554e22f1886cedad477782337aaa09 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 5e838abbd869146c25d350f8a2ac513e9e7c06a3..f0a28d01d1d3bfe9fe354980d622bd1e70c2e846 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 0197475ff2a4f03137ed5f65e9b6db9319d0a4ab..88e3e9b27736c1517cf2724642fe5387a893cece 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 efaab886cc6ef3fb4146323ea9d0d0e2cb302c63..faeb68e26f70cebc7cff48d82d1c875770871d1e 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)