astx.context

astx.context

Source: packages/astx/src/astx/context.py

title: ASTx context-manager AST nodes.
summary: >-
  Provide a small facade node for Python-like ``with`` statements until
  upstream ASTx exposes a canonical context-manager construct.

Classes

WithStmt(astx.StatementType)

title: Internal context-manager statement node.
summary: >-
  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

get_struct(self, simplified: bool=False) -> ReprStruct
title: Return the structured representation.
parameters:
  simplified:
    type: bool
returns:
  type: ReprStruct