14
14
convert_dict_to_id_list_if_needed ,
15
15
ensure_step_position ,
16
16
inputs_as_native_steps ,
17
+ pop_connect_from_step_dict ,
17
18
with_step_ids ,
18
19
)
19
20
from .yaml import ordered_load
@@ -89,13 +90,13 @@ def rename_arg(argument):
89
90
return argument
90
91
91
92
92
- def clean_connection (value ) :
93
+ def clean_connection (value : str ) -> str :
93
94
if value and "#" in value and SUPPORT_LEGACY_CONNECTIONS :
94
95
# Hope these are just used by Galaxy testing workflows and such, and not in production workflows.
95
96
log .warn (f"Legacy workflow syntax for connections [{ value } ] will not be supported in the future" )
96
97
value = value .replace ("#" , "/" , 1 )
97
- else :
98
- return value
98
+
99
+ return value
99
100
100
101
101
102
class ImportOptions :
@@ -381,7 +382,7 @@ def transform_pause(context, step, default_name="Pause for dataset review"):
381
382
"name" : name
382
383
}
383
384
384
- connect = _init_connect_dict (step )
385
+ connect = pop_connect_from_step_dict (step )
385
386
_populate_input_connections (context , step , connect )
386
387
_populate_tool_state (step , tool_state )
387
388
@@ -398,7 +399,7 @@ def transform_subworkflow(context, step):
398
399
tool_state = {
399
400
}
400
401
401
- connect = _init_connect_dict (step )
402
+ connect = pop_connect_from_step_dict (step )
402
403
_populate_input_connections (context , step , connect )
403
404
_populate_tool_state (step , tool_state )
404
405
@@ -428,7 +429,7 @@ def transform_tool(context, step):
428
429
"__page__" : 0 ,
429
430
}
430
431
431
- connect = _init_connect_dict (step )
432
+ connect = pop_connect_from_step_dict (step )
432
433
433
434
def append_link (key , value ):
434
435
if key not in connect :
@@ -641,38 +642,6 @@ def _join_prefix(prefix, key):
641
642
return new_key
642
643
643
644
644
- def _init_connect_dict (step ):
645
- if "connect" not in step :
646
- step ["connect" ] = {}
647
-
648
- connect = step ["connect" ]
649
- del step ["connect" ]
650
-
651
- # handle CWL-style in dict connections.
652
- if "in" in step :
653
- step_in = step ["in" ]
654
- assert isinstance (step_in , dict )
655
- connection_keys = set ()
656
- for key , value in step_in .items ():
657
- # TODO: this can be a list right?
658
- if isinstance (value , dict ) and 'source' in value :
659
- value = value ["source" ]
660
- elif isinstance (value , dict ) and 'default' in value :
661
- continue
662
- elif isinstance (value , dict ):
663
- raise KeyError (f'step input must define either source or default { value } ' )
664
- connect [key ] = [value ]
665
- connection_keys .add (key )
666
-
667
- for key in connection_keys :
668
- del step_in [key ]
669
-
670
- if len (step_in ) == 0 :
671
- del step ['in' ]
672
-
673
- return connect
674
-
675
-
676
645
def _populate_input_connections (context , step , connect ):
677
646
_ensure_inputs_connections (step )
678
647
input_connections = step ["input_connections" ]
0 commit comments