10
10
'draft-3.dev4' , 'draft-3.dev5' , 'draft-3' , 'draft-4.dev1' ,
11
11
'draft-4.dev2' , 'draft-4.dev3' , 'v1.0.dev4' , 'v1.0' ]
12
12
DEF_VERSION = 'v1.0'
13
- NON_NULL_CWL_TYPE = ['boolean' , 'int' , 'long' , 'float' , 'double' , 'string' , 'File' ,
14
- 'Directory' , 'stdout' ]
15
- CWL_TYPE = ['null' , 'boolean' , 'int' , 'long' , 'float' , 'double' , 'string' , 'File' ,
16
- 'Directory' , 'stdout' , None ]
17
- DEF_TYPE = 'null'
13
+
14
+
15
+ class CwlTypes :
16
+ DEF_TYPE = "null"
17
+
18
+ NULL = "null"
19
+ BOOLEAN = "boolean"
20
+ INT = "integer"
21
+ LONG = "long"
22
+ FLOAT = "float"
23
+ DOUBLE = "double"
24
+ STRING = "string"
25
+ FILE = "File"
26
+ DIRECTORY = "Directory"
27
+ STDOUT = "stdout"
28
+
29
+ NON_NULL_TYPES = [BOOLEAN , INT , LONG , FLOAT , DOUBLE , STRING , FILE , DIRECTORY , STDOUT ]
30
+ TYPES = [NULL , None , BOOLEAN , INT , LONG , FLOAT , DOUBLE , STRING , FILE , DIRECTORY , STDOUT ]
18
31
19
32
20
33
def parse_type (param_type , requires_type = False ):
@@ -46,13 +59,13 @@ def parse_type(param_type, requires_type=False):
46
59
if len (cwltype ) > 2 and cwltype [- 2 :] == "[]" :
47
60
array_type = CommandInputArraySchema (items = cwltype [:- 2 ])
48
61
# How to make arrays optional input: https://www.biostars.org/p/233562/#234089
49
- return [DEF_TYPE , array_type ] if optional else array_type
62
+ return [CwlTypes . DEF_TYPE , array_type ] if optional else array_type
50
63
51
- if cwltype not in CWL_TYPE :
64
+ if cwltype not in CwlTypes . TYPES :
52
65
_LOGGER .warning ("The type '{param_type}' is not a valid CWLType, expected one of: {types}"
53
- .format (param_type = param_type , types = ", " .join (str (x ) for x in CWL_TYPE )))
54
- _LOGGER .warning ("type is set to {}." .format (DEF_TYPE ))
55
- return DEF_TYPE
66
+ .format (param_type = param_type , types = ", " .join (str (x ) for x in CwlTypes . TYPES )))
67
+ _LOGGER .warning ("type is set to {}." .format (CwlTypes . DEF_TYPE ))
68
+ return CwlTypes . DEF_TYPE
56
69
return param_type
57
70
58
71
elif isinstance (param_type , list ):
@@ -62,7 +75,7 @@ def parse_type(param_type, requires_type=False):
62
75
return param_type # validate if required
63
76
else :
64
77
_LOGGER .warning ("Unable to detect type of param '{param_type}'" .format (param_type = param_type ))
65
- return DEF_TYPE
78
+ return CwlTypes . DEF_TYPE
66
79
67
80
68
81
def get_type_dict (param_type ):
0 commit comments