diff --git a/src/outils.py b/src/outils.py index c5d67695d13e2158b28d616d5fdf0ff1ec142bb2..32c7aa953f3c4474a0fbdfb5104e492fe455cd4d 100644 --- a/src/outils.py +++ b/src/outils.py @@ -922,7 +922,6 @@ def is_git_directory(path = '.'): #TODO -> need to update this -> if the same condition appears multiple times in the code -> in the dico it is only counted once #Right now the function is not recursif -> since i call blocks recursively and that this function is only used by blocks -> it is indirectrly called recursiverly def extract_conditions(code, only_get_inside = True): - conditions_dico = {} index_condition = 0 @@ -1367,8 +1366,17 @@ def remove_empty_conditions(code): return code #This function removes the empty conditions -> while keeping the anker_clusters -> if it's orignally in a condtion -def remove_empty_conditions_place_anker(code): - conditions = extract_conditions(code) +def remove_empty_conditions_place_anker(code, workflow): + #We remove the processes and functions from the code so that the conditions in the processes are not extracted + temp_code = code + for m in workflow.get_first_file().get_modules_defined(): + if(m.get_type() in ["Process", "Function"]): + tmp = temp_code + temp_code = temp_code.replace(m.get_code(), "a"*len(m.get_code())) + if(tmp==temp_code): + raise Exception("Something went wrong -> the code was not updated") + + conditions = extract_conditions(temp_code) OG_anker= "//Anker_clusters" pos = code.find(OG_anker) conditions_containing_anker = [] diff --git a/src/workflow.py b/src/workflow.py index 9c0c7362a97598134903db8a91c8ef8e5fbf1697..dd66787ddbefff5d75d4f3ebe38c75fc55ec2911 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -365,6 +365,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen #Putting || back code = code.replace("$OR$", "||") + #put_modified_operations_back #TODO -> add the other things necessary to reformat code #Somethimes this is incorrect but that's due to the fact that the DSL1 analysis isn't as clean as the DSL2 analyse (concerning the conditions) @@ -809,9 +810,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen ternary_operation_dico = self.ternary_operation_dico map_element_dico = self.map_element_dico - - if(self.duplicate): #First check if there are any duplicate operations #That method is in the "get_order_execution_executors" method -> so we just run that first @@ -965,7 +964,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen raise Exception("This shoudn't happen") #Remove the empty conditions left in the code - code = remove_empty_conditions_place_anker(code) + code = remove_empty_conditions_place_anker(code, self) #Add the subworkflow defintions