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

Update ternary operation calculation

parent 78099d8b
No related branches found
No related tags found
No related merge requests found
Pipeline #14452 failed with stage
in 2 minutes and 33 seconds
......@@ -46,7 +46,7 @@ class Code:
#This methods rewrite ternary operation into "normal" conditions
#variable = (condition) ? Expression2 : Expression3;
def rewrite_ternary_operation_to_normal_condition(self, code):
pattern = r"(\w+) *\= *([^?\n]+) *\? *([^:\n]+) *\: *([^\n]+)\n"
pattern = r"(\w+) *\= *([\w][^?\n]+) *\? *([^:\n]+) *\: *([^\n]+)\n"
to_replace = []
for match in re.finditer(pattern, code):
variable = match.group(1)
......
......@@ -532,7 +532,6 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
self.initialise()
self.graph.initialise(processes_2_remove = self.processes_2_remove)
if(not self.graph.check_if_process_dependendy_is_equivalent_to_other_without_subworkflows(temp_process_dependency_graph)):
print(render_graphs)
if(render_graphs==True):
generate_graph(self.get_output_dir()/ "debug" /"spec_graph_OG", temp_spec_graph, render_graphs = True)
generate_graph(self.get_output_dir()/ "debug" /"spec_graph", self.graph.full_dico, render_graphs = True)
......@@ -769,10 +768,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
return broken_subworkflows
#Get the clusters and the code
print("Calculating user view ....")
relevant_processes = self.check_relevant_processes_in_workflow(relevant_processes)
self.generate_user_view(relevant_processes = relevant_processes, processes_2_remove = [], render_graphs=render_graphs)
print("Finished user view")
clusters = self.graph.get_clusters_from_user_view()
broken_subworkflows = get_workflows_broken(get_subworkflow_2_executors(), get_clusters_with_calls(clusters))
......@@ -790,9 +787,6 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
clusters = self.graph.get_clusters_from_user_view()
broken_subworkflows = get_workflows_broken(get_subworkflow_2_executors(), get_clusters_with_calls(clusters))
#print(code)
#Get the clsuters with the corresponding operations inside
......@@ -803,16 +797,8 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#Get the topological order
executors_in_order = self.get_order_execution_executors()
new_clusters = []
#for clust in clusters:
# print("*")
# for c in clust:
# if(c.get_type()=="Process"):
# print(c, c.get_code()[:20])
# else:
# print(c, c.get_code()[:20], c.artificial)
for c in clusters:
print(len(c))
for cluster in clusters:
tab = []
for e in executors_in_order:
......@@ -822,15 +808,6 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
clusters = new_clusters
#clusters = self.graph.get_topogical_order(clusters)
#print('_________________')
#for clust in clusters:
# print("*")
# for c in clust:
# if(c.get_type()=="Process"):
# print(c, c.get_code()[:20])
# else:
# print(c, c.get_code()[:20], c.artificial)
......
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