Pydantic models for call-site analysis.
These models represent function/method call locations found via
tree-sitter parsing, used by the caller analysis feature.
CallSite
Bases: BaseModel
A single function/method call location.
Example
cs = CallSite(
... module="cli",
... symbol="greet",
... line=42,
... column=8,
... context="main",
... call_expression='greet("world")',
... )
cs.module
'cli'
Source code in packages/axm-ast/src/axm_ast/models/calls.py
| Python |
|---|
| class CallSite(BaseModel):
"""A single function/method call location.
Example:
>>> cs = CallSite(
... module="cli",
... symbol="greet",
... line=42,
... column=8,
... context="main",
... call_expression='greet("world")',
... )
>>> cs.module
'cli'
"""
model_config = ConfigDict(extra="forbid")
module: str = Field(description="Dotted module name")
symbol: str = Field(description="Called symbol name")
line: int = Field(description="Line number (1-indexed)")
column: int = Field(description="Column offset (0-indexed)")
context: str | None = Field(
default=None,
description="Enclosing function/class name",
)
call_expression: str = Field(
description="Raw text of the call expression",
)
confidence: float = Field(
default=1.0,
description=(
"Syntactic match confidence in [0, 1]. Matching is by name only "
"(the receiver type is never resolved), so this is a heuristic "
"derived purely from call syntax: 1.0 for a direct call or a "
"``self``/``cls`` method call, lower for an attribute call on "
"another receiver (``obj.foo()``), which is more likely to be a "
"false-positive caller of a like-named symbol. Additive and "
"backward-compatible: defaults to 1.0 and never changes which "
"call-sites are returned."
),
)
|