7
7
from collections import namedtuple
8
8
from copy import deepcopy
9
9
from pathlib import Path
10
- from typing import Dict , Any , List
10
+ from typing import Dict , Any , List , Tuple
11
11
12
- import astor
13
- import nbconvert
12
+ import astor # type: ignore
13
+ import nbconvert # type: ignore
14
14
import yaml
15
- from nbformat .notebooknode import NotebookNode
15
+ from nbformat .notebooknode import NotebookNode # type: ignore
16
16
17
17
from .iotypes import CWLFilePathInput , CWLBooleanInput , CWLIntInput , CWLStringInput , CWLFilePathOutput , \
18
18
CWLDumpableFile , CWLDumpableBinaryFile , CWLDumpable
@@ -33,7 +33,7 @@ class AnnotatedVariablesExtractor(ast.NodeTransformer):
33
33
"""AnnotatedVariablesExtractor removes the typing annotations
34
34
from relative to ipython2cwl and identifies all the variables
35
35
relative to an ipython2cwl typing annotation."""
36
- input_type_mapper = {
36
+ input_type_mapper : Dict [ Tuple [ str , ...], Tuple [ str , str ]] = {
37
37
(CWLFilePathInput .__name__ ,): (
38
38
'File' ,
39
39
'pathlib.Path' ,
@@ -186,7 +186,7 @@ def visit_Import(self, node: ast.Import) -> Any:
186
186
187
187
def visit_ImportFrom (self , node : ast .ImportFrom ) -> Any :
188
188
"""Remove ipython2cwl imports """
189
- if node .module == 'ipython2cwl' or node .module . startswith ('ipython2cwl.' ):
189
+ if node .module == 'ipython2cwl' or ( node .module is not None and node . module . startswith ('ipython2cwl.' ) ):
190
190
return None
191
191
return node
192
192
0 commit comments