@@ -26,9 +26,9 @@ def _get_nodes_dict(function_dict):
2626
2727def _get_edge_from_dict (target , key , value_dict , nodes_mapping_dict ):
2828 if len (value_dict ['attributes' ]) == 1 :
29- return {'target ' : target , 'targetHandle ' : key , "source " : nodes_mapping_dict [value_dict ['uuid' ]], 'sourceHandle ' : value_dict ['attributes' ][0 ][1 ]}
29+ return {'tn ' : target , 'th ' : key , "sn " : nodes_mapping_dict [value_dict ['uuid' ]], 'sh ' : value_dict ['attributes' ][0 ][1 ]}
3030 else :
31- return {'target ' : target , 'targetHandle ' : key , "source " : nodes_mapping_dict [value_dict ['uuid' ]], 'sourceHandle ' : None }
31+ return {'tn ' : target , 'th ' : key , "sn " : nodes_mapping_dict [value_dict ['uuid' ]], 'sh ' : None }
3232
3333
3434def _get_edges_and_extend_nodes (flow_dict , nodes_mapping_dict , nodes_dict ):
@@ -59,8 +59,8 @@ def _get_edges_and_extend_nodes(flow_dict, nodes_mapping_dict, nodes_dict):
5959 nodes_dict [node_index ] = vt
6060 else :
6161 node_index = {str (tv ): tk for tk , tv in nodes_dict .items ()}[str (vt )]
62- edges_lst .append ({'target ' : node_dict_index , 'targetHandle ' : kt , "source " : node_index , 'sourceHandle ' : None })
63- edges_lst .append ({'target ' : nodes_mapping_dict [job ["uuid" ]], 'targetHandle ' : k , "source " : node_dict_index , 'sourceHandle ' : None })
62+ edges_lst .append ({'tn ' : node_dict_index , 'th ' : kt , "sn " : node_index , 'sh ' : None })
63+ edges_lst .append ({'tn ' : nodes_mapping_dict [job ["uuid" ]], 'th ' : k , "sn " : node_dict_index , 'sh ' : None })
6464 elif isinstance (v , list ) and any ([isinstance (el , dict ) and '@module' in el and '@class' in el and '@version' in el for el in v ]):
6565 node_list_index = len (nodes_dict )
6666 nodes_dict [node_list_index ] = get_list
@@ -78,15 +78,15 @@ def _get_edges_and_extend_nodes(flow_dict, nodes_mapping_dict, nodes_dict):
7878 nodes_dict [node_index ] = vt
7979 else :
8080 node_index = {str (tv ): tk for tk , tv in nodes_dict .items ()}[str (vt )]
81- edges_lst .append ({'target ' : node_list_index , 'targetHandle ' : kt , "source " : node_index , 'sourceHandle ' : None })
82- edges_lst .append ({'target ' : nodes_mapping_dict [job ["uuid" ]], 'targetHandle ' : k , "source " : node_list_index , 'sourceHandle ' : None })
81+ edges_lst .append ({'tn ' : node_list_index , 'th ' : kt , "sn " : node_index , 'sh ' : None })
82+ edges_lst .append ({'tn ' : nodes_mapping_dict [job ["uuid" ]], 'th ' : k , "sn " : node_list_index , 'sh ' : None })
8383 else :
8484 if v not in nodes_dict .values ():
8585 node_index = len (nodes_dict )
8686 nodes_dict [node_index ] = v
8787 else :
8888 node_index = {tv : tk for tk , tv in nodes_dict .items ()}[v ]
89- edges_lst .append ({'target ' : nodes_mapping_dict [job ["uuid" ]], 'targetHandle ' : k , "source " : node_index , 'sourceHandle ' : None })
89+ edges_lst .append ({'tn ' : nodes_mapping_dict [job ["uuid" ]], 'th ' : k , "sn " : node_index , 'sh ' : None })
9090 return edges_lst , nodes_dict
9191
9292
@@ -99,7 +99,7 @@ def _resort_total_lst(total_dict, nodes_dict):
9999 for ind in sorted (total_dict .keys ()):
100100 connect = total_dict [ind ]
101101 if ind not in ordered_lst :
102- source_lst = [sd ["source " ] for sd in connect .values ()]
102+ source_lst = [sd ["sn " ] for sd in connect .values ()]
103103 if all ([s in ordered_lst or s in nodes_without_dep_lst for s in source_lst ]):
104104 ordered_lst .append (ind )
105105 total_new_dict [ind ] = connect
@@ -109,11 +109,11 @@ def _resort_total_lst(total_dict, nodes_dict):
109109def _group_edges (edges_lst ):
110110 total_dict = {}
111111 for ed_major in edges_lst :
112- target_id = ed_major ["target " ]
112+ target_id = ed_major ["tn " ]
113113 tmp_lst = []
114114 if target_id not in total_dict .keys ():
115115 for ed in edges_lst :
116- if target_id == ed ["target " ]:
116+ if target_id == ed ["tn " ]:
117117 tmp_lst .append (ed )
118118 total_dict [target_id ] = get_kwargs (lst = tmp_lst )
119119 return total_dict
@@ -139,8 +139,8 @@ def get_attr_helper(obj, source_handle):
139139 else :
140140 fn = job (method = v )
141141 kwargs = {
142- kw : input_dict [vw ['source ' ]] if vw ['source ' ] in input_dict else get_attr_helper (
143- obj = memory_dict [vw ['source ' ]], source_handle = vw ['sourceHandle ' ])
142+ kw : input_dict [vw ['sn ' ]] if vw ['sn ' ] in input_dict else get_attr_helper (
143+ obj = memory_dict [vw ['sn ' ]], source_handle = vw ['sh ' ])
144144 for kw , vw in total_dict [k ].items ()
145145 }
146146 memory_dict [k ] = fn (** kwargs )
@@ -160,15 +160,15 @@ def load_workflow_json(file_name):
160160
161161 edges_new_lst = []
162162 for edge in content ["edges" ]:
163- if edge ['sourceHandle ' ] is None :
163+ if edge ['sh ' ] is None :
164164 edges_new_lst .append (edge )
165165 else :
166166 edges_new_lst .append (
167167 {
168- 'target ' : edge ['target ' ],
169- 'targetHandle ' : edge ['targetHandle ' ],
170- 'source ' : edge ['source ' ],
171- 'sourceHandle ' : str (edge ['sourceHandle ' ]),
168+ 'tn ' : edge ['tn ' ],
169+ 'th ' : edge ['th ' ],
170+ 'sn ' : edge ['sn ' ],
171+ 'sh ' : str (edge ['sh ' ]),
172172 }
173173 )
174174
0 commit comments