77from collections import namedtuple
88from copy import deepcopy
99from pathlib import Path
10- from typing import Dict , Any , List
10+ from typing import Dict , Any , List , Tuple
1111
12- import astor
13- import nbconvert
12+ import astor # type: ignore
13+ import nbconvert # type: ignore
1414import yaml
15- from nbformat .notebooknode import NotebookNode
15+ from nbformat .notebooknode import NotebookNode # type: ignore
1616
1717from .iotypes import CWLFilePathInput , CWLBooleanInput , CWLIntInput , CWLStringInput , CWLFilePathOutput , \
1818 CWLDumpableFile , CWLDumpableBinaryFile , CWLDumpable
@@ -33,7 +33,7 @@ class AnnotatedVariablesExtractor(ast.NodeTransformer):
3333 """AnnotatedVariablesExtractor removes the typing annotations
3434 from relative to ipython2cwl and identifies all the variables
3535 relative to an ipython2cwl typing annotation."""
36- input_type_mapper = {
36+ input_type_mapper : Dict [ Tuple [ str , ...], Tuple [ str , str ]] = {
3737 (CWLFilePathInput .__name__ ,): (
3838 'File' ,
3939 'pathlib.Path' ,
@@ -186,7 +186,7 @@ def visit_Import(self, node: ast.Import) -> Any:
186186
187187 def visit_ImportFrom (self , node : ast .ImportFrom ) -> Any :
188188 """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.' ) ):
190190 return None
191191 return node
192192
0 commit comments