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:17
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 — Manager.; Type: astx.AST
-
body — Statements forming the body.; Type: astx.Block
-
target — Destination of the operation.; Type: astx.AST | None
-
loc — Type: SourceLocation
-
kind — Type: ASTKind
-
comment — Type: str
-
parent — Type: Optional[ASTNodes]
-
ref — Type: str
Methods
-
__init__ — Initialize one with statement.
-
__str__ — Return a compact display string.
-
get_struct — Return the structured representation.