コード例 #1
0
ファイル: ast.py プロジェクト: MarkHaakman/dslinter
    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
コード例 #2
0
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
コード例 #3
0
 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)
コード例 #4
0
ファイル: utils.py プロジェクト: aluoch-sheila/NEIGHBOURHOOD
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