Esempio n. 1
0
 def __call__(self, node):
     method = getattr(self, '_' + node.__class__.__name__, None)
     if method is not None:
         return method(node)
     # ???: Unknown node; what should we do here?
     warnings.warn('Unknown node type <%s>; please report!'
                   % node.__class__.__name__, RuntimeWarning)
     node.region = (self.source.offset, self.source.offset)
     if self.children:
         node.sorted_children = ast.get_children(node)
Esempio n. 2
0
 def _check_statements(self, node):
     for child in ast.get_children(node):
         if isinstance(child, (list, tuple)):
             self.__check_stmt_list(child)
Esempio n. 3
0
 def _get_children(self, node):
     """Return not `ast.expr_context` children of `node`"""
     children = ast.get_children(node)
     return [child for child in children if not isinstance(child, ast.expr_context)]
Esempio n. 4
0
 def _check_statements(self, node):
     for child in ast.get_children(node):
         if isinstance(child, (list, tuple)):
             self.__check_stmt_list(child)