TryStar#

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

Bases: MultiLineWithElseBlockNode, Statement

Class representing an ast.TryStar node.

block_range(lineno: int) tuple[int, int][source]#

Get a range from a given line number to where this node ends.

body: list[NodeNG]#

The contents of the block to catch exceptions from.

finalbody: list[NodeNG]#

The contents of the finally block.

get_children()[source]#

Get the child nodes below this node.

handlers: list[ExceptHandler]#

The exception handlers.

orelse: list[NodeNG]#

The contents of the else block.

postinit(*, body: list[NodeNG] | None = None, handlers: list[ExceptHandler] | None = None, orelse: list[NodeNG] | None = None, finalbody: list[NodeNG] | None = None) None[source]#

Do some setup after initialisation. :param body: The contents of the block to catch exceptions from. :param handlers: The exception handlers. :param orelse: The contents of the else block. :param finalbody: The contents of the finally block.