예제 #1
0
파일: patchedast.py 프로젝트: Kha/rope
 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)
예제 #2
0
파일: similarfinder.py 프로젝트: Kha/rope
 def _check_statements(self, node):
     for child in ast.get_children(node):
         if isinstance(child, (list, tuple)):
             self.__check_stmt_list(child)
예제 #3
0
파일: similarfinder.py 프로젝트: Kha/rope
 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)]
예제 #4
0
 def _check_statements(self, node):
     for child in ast.get_children(node):
         if isinstance(child, (list, tuple)):
             self.__check_stmt_list(child)