3030
3131
3232class AnnotatedVariablesExtractor (ast .NodeTransformer ):
33+ """AnnotatedVariablesExtractor removes the typing annotations
34+ from relative to ipython2cwl and identifies all the variables
35+ relative to an ipython2cwl typing annotation."""
3336 input_type_mapper = {
3437 (CWLFilePathInput .__name__ ,): (
3538 'File' ,
@@ -67,11 +70,15 @@ class AnnotatedVariablesExtractor(ast.NodeTransformer):
6770 }
6871
6972 def __init__ (self , * args , ** kwargs ):
73+ """Create an AnnotatedVariablesExtractor"""
7074 super ().__init__ (* args , ** kwargs )
7175 self .extracted_variables : List = []
7276 self .to_dump : List = []
7377
7478 def __get_annotation__ (self , type_annotation ):
79+ """Parses the annotation and returns it in a canonical format.
80+ If the annotation was a string 'CWLStringInput' the function
81+ will return you the object."""
7582 annotation = None
7683 if isinstance (type_annotation , ast .Name ):
7784 annotation = (type_annotation .id ,)
@@ -164,7 +171,8 @@ def visit_AnnAssign(self, node):
164171 pass
165172 return node
166173
167- def visit_Import (self , node : ast .Import ):
174+ def visit_Import (self , node : ast .Import ) -> Any :
175+ """Remove ipython2cwl imports """
168176 names = []
169177 for name in node .names : # type: ast.alias
170178 if name .name == 'ipython2cwl' or name .name .startswith ('ipython2cwl.' ):
@@ -177,6 +185,7 @@ def visit_Import(self, node: ast.Import):
177185 return None
178186
179187 def visit_ImportFrom (self , node : ast .ImportFrom ) -> Any :
188+ """Remove ipython2cwl imports """
180189 if node .module == 'ipython2cwl' or node .module .startswith ('ipython2cwl.' ):
181190 return None
182191 return node
0 commit comments