diff --git a/src/code_.py b/src/code_.py index cc2bc825c65d9c6d89e1cc94ad4e97350b7f202a..fb3400143058bdf54d6c08c6f12c2609c4128864 100644 --- a/src/code_.py +++ b/src/code_.py @@ -142,10 +142,11 @@ class Code: while(searching and timeout<constant.WHILE_UPPER_BOUND): searching = False #TODO -> do the same with flatMap -> 668 - for word in ["map", "flatMap"]: + for word in ["map", "flatMap", "view"]: for end_char in ['{', '\(']: pattern = fr"(\.|\|)\s*"+word+r"\s*"+end_char for match in re.finditer(pattern, code): + connector = match.group(1) start_map, end = match.span(0) if(end_char=="{"): end_map = extract_curly(code, end) @@ -158,7 +159,7 @@ class Code: self.add_map_element(old, new) old_code = code[start_map:end_map] - new_code = f".{word}_modified {{ {new} }}" + new_code = f"{connector}{word}_modified {{ {new} }}" code = code.replace(old_code, new_code) searching = True @@ -166,13 +167,14 @@ class Code: break #For reduce for match in re.finditer(r"(\.|\|)\s*reduce[^{]+{", code): + connector = match.group(1) start_map, end = match.span(0) end_map = extract_curly(code, end) old = code[end:end_map-1] new = f"¤{id(self)}_{index}¤" self.add_map_element(old, new) old_code = code[start_map:end_map] - new_code = f".{word}_modified {{ {new} }}" + new_code = f"{connector}reduce_modified {{ {new} }}" code = code.replace(old_code, new_code) searching = True index+=1 diff --git a/src/constant.py b/src/constant.py index 8f32dbedb1d9a52626fa749d62cbeec6643723eb..a5cd310fff079955c50d34d2b82c3cb19a258a7a 100644 --- a/src/constant.py +++ b/src/constant.py @@ -15,12 +15,13 @@ ILLEGAL_IMPORTS = ["groovy", "java"] LIST_AS = ["as ", "As ", "AS ", "aS "] LIST_OPERATORS = ["distinct", "filter", "first", "last", "randomSample", "take", "unique", - "until","buffer","collate","collect","flatten","flatMap", "flatMap_modified","groupBy","groupTuple","map","map_modified","reduce","toList","toSortedList","transpose", + "until","buffer","collate","collect","flatten","flatMap","groupBy","groupTuple","map","toList","toSortedList","transpose", "splitCsv","splitFasta","splitFastq","splitText", "cross","collectFile","combine","concat","join","merge","mix","phase","spread","tap", "branch","choice","multiMap","into","separate","tap", "count","countBy","min","max","sum","toInteger", - "close","dump","ifEmpty","print","println","set","view", + "close","dump","ifEmpty","print","println","set","view", + "map_modified","reduce_modified", "flatMap_modified", "view_modified", #The articifiel operations "empty", "of", "fromPath", "fromList", "subscribe", "value", "from"]#This last line is added by me:) TOOLS = [ diff --git a/src/graph.py b/src/graph.py index 18b5464f00bffb6020e5b001192087dd26d03765..5e22b22a3e3dccd7efc1e8b590109fd9a7966ae8 100644 --- a/src/graph.py +++ b/src/graph.py @@ -233,7 +233,8 @@ class Graph(): add_edges(dico["subworkflows"][sub], condition, checking_conditions, index=index) return checking_conditions - if(self.workflow.get_duplicate_status()): + #if(self.workflow.get_duplicate_status()): + if(False):#Right now not generating the colored edges checking_conditions = True most_influential_conditions = self.workflow.get_most_influential_conditions() list_most_influential_conditions = list(most_influential_conditions.keys())