@@ -23,9 +23,11 @@ def _get_type(tp):
23
23
24
24
def check_types (srctype , sinktype , linkMerge , valueFrom ):
25
25
# type: (Any, Any, Optional[Text], Optional[Text]) -> Text
26
- """Check if the source and sink types are "pass", "warning", or "exception".
27
26
"""
27
+ Check if the source and sink types are correct.
28
28
29
+ Acceptable types are "pass", "warning", or "exception".
30
+ """
29
31
if valueFrom is not None :
30
32
return "pass"
31
33
if linkMerge is None :
@@ -44,9 +46,7 @@ def check_types(srctype, sinktype, linkMerge, valueFrom):
44
46
45
47
def merge_flatten_type (src ):
46
48
# type: (Any) -> Any
47
- """Return the merge flattened type of the source type
48
- """
49
-
49
+ """Return the merge flattened type of the source type."""
50
50
if isinstance (src , MutableSequence ):
51
51
return [merge_flatten_type (t ) for t in src ]
52
52
if isinstance (src , MutableMapping ) and src .get ("type" ) == "array" :
@@ -55,15 +55,15 @@ def merge_flatten_type(src):
55
55
56
56
57
57
def can_assign_src_to_sink (src , sink , strict = False ): # type: (Any, Any, bool) -> bool
58
- """Check for identical type specifications, ignoring extra keys like inputBinding.
58
+ """
59
+ Check for identical type specifications, ignoring extra keys like inputBinding.
59
60
60
61
src: admissible source types
61
62
sink: admissible sink types
62
63
63
64
In non-strict comparison, at least one source type must match one sink type.
64
65
In strict comparison, all source types must match at least one sink type.
65
66
"""
66
-
67
67
if src == "Any" or sink == "Any" :
68
68
return True
69
69
if isinstance (src , MutableMapping ) and isinstance (sink , MutableMapping ):
@@ -100,12 +100,12 @@ def can_assign_src_to_sink(src, sink, strict=False): # type: (Any, Any, bool) -
100
100
101
101
def _compare_records (src , sink , strict = False ):
102
102
# type: (MutableMapping[Text, Any], MutableMapping[Text, Any], bool) -> bool
103
- """Compare two records, ensuring they have compatible fields.
103
+ """
104
+ Compare two records, ensuring they have compatible fields.
104
105
105
106
This handles normalizing record names, which will be relative to workflow
106
107
step, so that they can be compared.
107
108
"""
108
-
109
109
def _rec_fields (rec ): # type: (MutableMapping[Text, Any]) -> MutableMapping[Text, Any]
110
110
out = {}
111
111
for field in rec ["fields" ]:
@@ -136,9 +136,7 @@ def missing_subset(fullset, subset):
136
136
137
137
def static_checker (workflow_inputs , workflow_outputs , step_inputs , step_outputs , param_to_step ):
138
138
# type: (List[Dict[Text, Any]], List[Dict[Text, Any]], List[Dict[Text, Any]], List[Dict[Text, Any]], Dict[Text, Dict[Text, Any]]) -> None
139
- """Check if all source and sink types of a workflow are compatible before run time.
140
- """
141
-
139
+ """Check if all source and sink types of a workflow are compatible before run time."""
142
140
# source parameters: workflow_inputs and step_outputs
143
141
# sink parameters: step_inputs and workflow_outputs
144
142
@@ -225,10 +223,11 @@ def static_checker(workflow_inputs, workflow_outputs, step_inputs, step_outputs,
225
223
226
224
def check_all_types (src_dict , sinks , sourceField ):
227
225
# type: (Dict[Text, Any], List[Dict[Text, Any]], Text) -> Dict[Text, List[SrcSink]]
228
- # sourceField is either "soure" or "outputSource"
229
- """Given a list of sinks, check if their types match with the types of their sources.
230
226
"""
227
+ Given a list of sinks, check if their types match with the types of their sources.
231
228
229
+ sourceField is either "soure" or "outputSource"
230
+ """
232
231
validation = {"warning" : [], "exception" : []} # type: Dict[Text, List[SrcSink]]
233
232
for sink in sinks :
234
233
if sourceField in sink :
0 commit comments