(tree: ast.AST, node: ast.AST, rebuild: bool = False)
Get parent of node in tree.
Get parent of node in tree.
Get parent of node in tree .
def get_parent(tree: ast.AST, node: ast.AST, rebuild: bool = False) -> ast.AST:
    """Get parent of node in tree."""
    if node not in _parents or rebuild:
        _build_parents(tree)

    try:
        return _parents[node]
    except IndexError:
        raise NodeNotFound('Parent for {} not found'.format(node))
def get_parent ( tree : ast . AST , node : ast . AST , rebuild : bool = False ) -> ast . AST : if node not in _parents or rebuild : _build_parents ( tree ) try : return _parents [ node ] except IndexError : raise NodeNotFound ( 'Parent for {} not found' . format ( node ) )