Blocks
blocks
Top-level symbol block extraction from a libcst Module.
Block
dataclass
A top-level symbol definition extracted from a module.
Carries the CST statement that defines the symbol, the leading
formatting lines that immediately precede it (used to preserve
# --- Section --- comments), and the set of external names
referenced by its body.
Source code in packages/axm-anvil/src/axm_anvil/_cst/blocks.py
extract_blocks(tree, symbol_names)
Extract Block records for each requested top-level symbol.
Supports ClassDef, FunctionDef, Assign, and AnnAssign
at module scope. Missing symbols are silently omitted.