def search_nodes(node: astroid.node_classes.NodeNG, type_searched: type) -> List[astroid.node_classes.NodeNG]: """ Search recursively for all nodes of a certain type. :param node: Node which is visited. :param type_searched: Type of node where is searched for. """ found: List = [] for child in node.get_children(): found += ASTUtil.search_nodes(child, type_searched) if isinstance(node, type_searched): found.append(node) return found
def is_error(node: astroid.node_classes.NodeNG) -> bool: """return true if the function does nothing but raising an exception""" for child_node in node.get_children(): if isinstance(child_node, astroid.Raise): return True return False
def visit_generic(self, node: astroid.node_classes.NodeNG) -> None: """Propagate the visit to the children.""" for child in node.get_children(): self.visit(child)