Skip to content
Snippets Groups Projects
Commit 67b93125 authored by George Marchment's avatar George Marchment
Browse files

Updated the rewrite of the operations (reduce map) + added view into that group

parent 61124ab3
No related branches found
No related tags found
No related merge requests found
Pipeline #14663 failed with stage
in 2 minutes and 17 seconds
......@@ -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
......
......@@ -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 = [
......
......@@ -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())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment