@@ -82,27 +82,29 @@ def match_types(sinktype, src, iid, inputobj, linkMerge, valueFrom):
82
82
else :
83
83
raise WorkflowException (u"Unrecognized linkMerge enum '%s'" % linkMerge )
84
84
return True
85
- elif valueFrom is not None or are_same_type (src .parameter ["type" ], sinktype ) or sinktype == "Any" :
85
+ elif valueFrom is not None or can_assign_src_to_sink (src .parameter ["type" ], sinktype ) or sinktype == "Any" :
86
86
# simply assign the value from state to input
87
87
inputobj [iid ] = copy .deepcopy (src .value )
88
88
return True
89
89
return False
90
90
91
- def are_same_type (src , sink ): # type: (Any, Any) -> bool
91
+ def can_assign_src_to_sink (src , sink ): # type: (Any, Any) -> bool
92
92
"""Check for identical type specifications, ignoring extra keys like inputBinding.
93
93
"""
94
94
if isinstance (src , dict ) and isinstance (sink , dict ):
95
95
if src ["type" ] == "array" and sink ["type" ] == "array" :
96
- if 'null' in sink ["items" ]:
97
- return are_same_type ([src ["items" ]], [it for it in sink ["items" ] if it != 'null' ])
98
- return are_same_type (src ["items" ], sink ["items" ])
99
- elif src ["type" ] == sink ["type" ]:
100
- return True
101
- else :
102
- return False
96
+ return can_assign_src_to_sink (src ["items" ], sink ["items" ])
97
+ elif isinstance (src , list ):
98
+ for t in src :
99
+ if can_assign_src_to_sink (t , sink ):
100
+ return True
101
+ elif isinstance (sink , list ):
102
+ for t in sink :
103
+ if can_assign_src_to_sink (src , t ):
104
+ return True
103
105
else :
104
106
return src == sink
105
-
107
+ return False
106
108
107
109
def object_from_state (state , parms , frag_only , supportsMultipleInput , sourceField ):
108
110
# type: (Dict[unicode, WorkflowStateItem], List[Dict[unicode, Any]], bool, bool, unicode) -> Dict[unicode, Any]
0 commit comments