Raise

class astroid.nodes.Raise(lineno: int | None, col_offset: int | None, parent: NodeNG | None, *, end_lineno: int | None, end_col_offset: int | None)[source]

Bases: Statement

Class representing an ast.Raise node.

>>> import astroid
>>> node = astroid.extract_node('raise RuntimeError("Something bad happened!")')
>>> node
<Raise l.1 at 0x7f23b2e9e828>
cause: NodeNG | None

The exception being used to raise this one.

exc: NodeNG | None

What is being raised.

get_children()[source]

Get the child nodes below this node.

postinit(exc: NodeNG | None, cause: NodeNG | None) None[source]
raises_not_implemented() bool[source]

Check if this node raises a NotImplementedError.

Returns:

Whether this node raises a NotImplementedError.