Visitors
visitors
CST visitors for reference collection and dotted-name extraction.
ReferenceCollector
Bases: CSTVisitor
Collect referenced names within a CST node.
Visits all Name occurrences and records only the root of any
Attribute chain (foo.bar.baz -> "foo").
Source code in packages/axm-anvil/src/axm_anvil/_cst/visitors.py
visit_Attribute(node)
Record only the root of an Attribute chain; skip nested visit.
Source code in packages/axm-anvil/src/axm_anvil/_cst/visitors.py
StringForwardRefScanner
Bases: CSTVisitor
Detect string annotations that forward-reference a moved symbol.
Scans Annotation nodes whose value is a SimpleString or
ConcatenatedString. The string content is parsed with
cst.parse_expression and its Name nodes are intersected with
moved_names (whole-identifier match, never a substring). Each hit
appends a structured, actionable message to :attr:warnings. This is
detection-only: the visitor never mutates the tree.
Source code in packages/axm-anvil/src/axm_anvil/_cst/visitors.py
leave_FunctionDef(original_node)
visit_AnnAssign(node)
Scan an annotated assignment's string annotation.
visit_FunctionDef(node)
Track the enclosing function and scan its return annotation.
Source code in packages/axm-anvil/src/axm_anvil/_cst/visitors.py
visit_Param(node)
Scan a parameter's string annotation.
Source code in packages/axm-anvil/src/axm_anvil/_cst/visitors.py
dotted_name(node)
Convert a Name / Attribute chain to its dotted string form.
Returns an empty string for any other node type.