1
1
import copy
2
- from .utils import aslist
3
- from . import expression
2
+
4
3
import avro
5
4
import schema_salad .validate as validate
6
5
from schema_salad .sourceline import SourceLine
7
6
from typing import Any , Callable , Text , Type , Union
7
+
8
+ from . import expression
8
9
from .errors import WorkflowException
10
+ from .pathmapper import PathMapper , adjustFileObjs , normalizeFilesDirs
9
11
from .stdfsaccess import StdFsAccess
10
- from .pathmapper import PathMapper , adjustFileObjs , adjustDirObjs , normalizeFilesDirs
12
+ from .utils import aslist
11
13
12
14
CONTENT_LIMIT = 64 * 1024
13
15
@@ -18,8 +20,8 @@ def substitute(value, replace): # type: (Text, Text) -> Text
18
20
else :
19
21
return value + replace
20
22
21
- class Builder (object ):
22
23
24
+ class Builder (object ):
23
25
def __init__ (self ): # type: () -> None
24
26
self .names = None # type: avro.schema.Names
25
27
self .schemaDefs = None # type: Dict[Text, Dict[Text, Any]]
@@ -39,8 +41,12 @@ def __init__(self): # type: () -> None
39
41
self .build_job_script = None # type: Callable[[List[str]], Text]
40
42
self .debug = False # type: bool
41
43
42
- def bind_input (self , schema , datum , lead_pos = [] , tail_pos = [] ):
44
+ def bind_input (self , schema , datum , lead_pos = None , tail_pos = None ):
43
45
# type: (Dict[Text, Any], Any, Union[int, List[int]], List[int]) -> List[Dict[Text, Any]]
46
+ if tail_pos is None :
47
+ tail_pos = []
48
+ if lead_pos is None :
49
+ lead_pos = []
44
50
bindings = [] # type: List[Dict[Text,Text]]
45
51
binding = None # type: Dict[Text,Any]
46
52
if "inputBinding" in schema and isinstance (schema ["inputBinding" ], dict ):
@@ -137,7 +143,6 @@ def _capture_files(f):
137
143
if schema ["type" ] == "Directory" :
138
144
self .files .append (datum )
139
145
140
-
141
146
# Position to front of the sort key
142
147
if binding :
143
148
for bi in bindings :
@@ -198,7 +203,7 @@ def do_eval(self, ex, context=None, pull_image=True, recursive=False):
198
203
# type: (Union[Dict[Text, Text], Text], Any, bool, bool) -> Any
199
204
if recursive :
200
205
if isinstance (ex , dict ):
201
- return {k : self .do_eval (v , context , pull_image , recursive ) for k ,v in ex .iteritems ()}
206
+ return {k : self .do_eval (v , context , pull_image , recursive ) for k , v in ex .iteritems ()}
202
207
if isinstance (ex , list ):
203
208
return [self .do_eval (v , context , pull_image , recursive ) for v in ex ]
204
209
0 commit comments