API reference
python:astx:astx.WithStmt
class WithStmt
WithStmt(manager: astx.AST, body: astx.Block, target: astx.AST | None = None, loc: SourceLocation = NO_SOURCE_LOCATION, parent: astx.ASTNodes | None = None)
Source: packages/astx/src/astx/context.py:18
Declared as: python:astx:astx.context.WithStmt
Internal context-manager statement node.
Model source forms equivalent to with manager as target: body while keeping the manager expression, optional target, and body as regular ASTx child nodes.
Attributes
-
manager — Type: astx.AST
-
body — Type: astx.Block
-
target — Type: astx.AST | None
Methods
-
__init__ — Initialize one with statement.
-
__str__ — Return a compact display string.
-
get_struct — Return the structured representation.