Path 1: 36 calls (1.0)

Raise (36)

False (27) True (9)

1def is_node_inside_try_except(node: nodes.Raise) -> bool:
2    """Check if the node is directly under a Try/Except statement
3    (but not under an ExceptHandler!).
4
5    Args:
6        node (nodes.Raise): the node raising the exception.
7
8    Returns:
9        bool: True if the node is inside a try/except statement, False otherwise.
10    """
11    context = find_try_except_wrapper_node(node)
12    return isinstance(context, nodes.TryExcept)