@@ -47,11 +47,11 @@ def is_expression(string: str,
4747 return False
4848 if string .strip ().startswith ('${' ):
4949 return True
50- # if '$(' in string:
51- # try:
52- # do_eval(string, inputs, context=self, requirements=[], outdir='', tmpdir='', resources={})
53- # except WorkflowException:
54- # return True
50+ if '$(' in string :
51+ try :
52+ do_eval (string , inputs , context = self , requirements = [], outdir = '' , tmpdir = '' , resources = {})
53+ except WorkflowException :
54+ return True
5555 return False
5656
5757def etool_to_cltool (etool : cwl .ExpressionTool , expressionLib : Optional [List [str ]]= None ) -> cwl .CommandLineTool :
@@ -154,7 +154,7 @@ def generate_etool_from_expr(expr: str,
154154def get_input_for_id (name : str , tool : Union [cwl .CommandLineTool , cwl .Workflow ]) -> Optional [cwl .CommandInputParameter ]:
155155 name = name .split ('/' )[- 1 ]
156156 for inp in tool .inputs :
157- if inp .id .split ('#' )[- 1 ] == name :
157+ if inp .id .split ('#' )[- 1 ]. split ( '/' )[ - 1 ] == name :
158158 return inp
159159 if isinstance (tool , cwl .Workflow ) and '/' in name :
160160 stepname , stem = name .split ('/' , 1 )
@@ -388,7 +388,7 @@ def process_workflow_reqs_and_hints(workflow: cwl.Workflow, replace_etool=False)
388388 elif isinstance (entry , cwl .Dirent ):
389389 if entry .entry and is_expression (entry .entry , inputs , None ):
390390 modified = True
391- target_type = [cwl . File , cwl .Dirent ]
391+ target_type = [" File" , cwl .Dirent ]
392392 target = cwl .InputParameter (None , None , None , None , None , None , None , None , target_type )
393393 etool_id = "_expression_workflow_InitialWorkDirRequirement_{}" .format (index )
394394 replace_expr_with_etool (
@@ -561,7 +561,7 @@ def process_level_reqs(process: cwl.Process, step: cwl.WorkflowStep, parent: cwl
561561 elif isinstance (entry , cwl .Dirent ):
562562 if entry .entry and is_expression (entry .entry , inputs , None ):
563563 modified = True
564- target_type = [cwl . File , cwl . Dirent ]
564+ target_type = [" File" , " Dirent" ]
565565 target = cwl .InputParameter (None , None , None , None , None , None , None , None , target_type )
566566 etool_id = "_expression_{}_InitialWorkDirRequirement_{}" .format (step_name , index )
567567 replace_expr_with_etool (
@@ -743,14 +743,15 @@ def traverse_CommandLineTool(clt: cwl.CommandLineTool, parent: cwl.Workflow, ste
743743 etool_id ,
744744 orig_step_inputs ,
745745 [cwl .WorkflowStepOutput ("result" )], None , None , None , None , etool , None , step .scatterMethod )
746- new_clt_step = copy .deepcopy (step )
746+ new_clt_step = copy .copy (step )
747747 new_clt_step .id = new_clt_step .id .split ('#' )[- 1 ]
748748 new_clt_step .run .id = None
749749 remove_JSReq (new_clt_step .run )
750750 for new_outp in new_clt_step .run .outputs :
751751 if new_outp .id .split ('#' )[- 1 ] == outp_id :
752- new_outp .outputBinding .outputEval = None
753- new_outp .outputBinding .loadContents = None
752+ if new_outp .outputBinding :
753+ new_outp .outputBinding .outputEval = None
754+ new_outp .outputBinding .loadContents = None
754755 new_outp .type = cwl .CommandOutputArraySchema ("File" , "array" , None , None )
755756 for inp in new_clt_step .in_ :
756757 inp .id = inp .id .split ('/' )[- 1 ]
0 commit comments