5
5
6
6
from .process import scandeps , shortname
7
7
8
- from typing import Union , Any , cast , Callable , Dict , Tuple , Type , IO
8
+ from typing import Union , Any , cast , Callable , Dict , Tuple , Type , IO , Text
9
9
10
- def flatten_deps (d , files ): # type: (Any, Set[unicode ]) -> None
10
+ def flatten_deps (d , files ): # type: (Any, Set[Text ]) -> None
11
11
if isinstance (d , list ):
12
12
for s in d :
13
13
flatten_deps (s , files )
@@ -16,7 +16,7 @@ def flatten_deps(d, files): # type: (Any, Set[unicode]) -> None
16
16
if "secondaryFiles" in d :
17
17
flatten_deps (d ["secondaryFiles" ], files )
18
18
19
- def find_run (d , runs ): # type: (Any, Set[unicode ]) -> None
19
+ def find_run (d , runs ): # type: (Any, Set[Text ]) -> None
20
20
if isinstance (d , list ):
21
21
for s in d :
22
22
find_run (s , runs )
@@ -27,7 +27,7 @@ def find_run(d, runs): # type: (Any, Set[unicode]) -> None
27
27
find_run (s , runs )
28
28
29
29
def replace_refs (d , rewrite , stem , newstem ):
30
- # type: (Any, Dict[unicode, unicode ], unicode, unicode ) -> None
30
+ # type: (Any, Dict[Text, Text ], Text, Text ) -> None
31
31
if isinstance (d , list ):
32
32
for s ,v in enumerate (d ):
33
33
if isinstance (v , (str , unicode )) and v .startswith (stem ):
@@ -45,16 +45,16 @@ def replace_refs(d, rewrite, stem, newstem):
45
45
replace_refs (v , rewrite , stem , newstem )
46
46
47
47
def pack (document_loader , processobj , uri , metadata ):
48
- # type: (Loader, Union[Dict[unicode , Any], List[Dict[unicode , Any]]], unicode , Dict[unicode, unicode ]) -> Dict[unicode , Any]
48
+ # type: (Loader, Union[Dict[Text , Any], List[Dict[Text , Any]]], Text , Dict[Text, Text ]) -> Dict[Text , Any]
49
49
def loadref (b , u ):
50
- # type: (unicode, unicode ) -> Union[Dict, List, unicode ]
50
+ # type: (Text, Text ) -> Union[Dict, List, Text ]
51
51
return document_loader .resolve_ref (u , base_url = b )[0 ]
52
52
deps = scandeps (uri , processobj , set (("run" ,)), set (), loadref )
53
53
54
54
fdeps = set ((uri ,))
55
55
flatten_deps (deps , fdeps )
56
56
57
- runs = set () # type: Set[unicode ]
57
+ runs = set () # type: Set[Text ]
58
58
for f in fdeps :
59
59
find_run (document_loader .idx [f ], runs )
60
60
@@ -69,9 +69,9 @@ def loadref(b, u):
69
69
rewrite [r ] = "#" + shortname (r )
70
70
71
71
packed = {"$graph" : [], "cwlVersion" : metadata ["cwlVersion" ]
72
- } # type: Dict[unicode , Any]
72
+ } # type: Dict[Text , Any]
73
73
for r ,v in rewrite .items ():
74
- dc = cast (Dict [unicode , Any ], copy .deepcopy (document_loader .idx [r ]))
74
+ dc = cast (Dict [Text , Any ], copy .deepcopy (document_loader .idx [r ]))
75
75
dc ["id" ] = v
76
76
for n in ("name" , "package" , "cwlVersion" ):
77
77
if n in dc :
0 commit comments