API reference
python:arxjit:arxjit.source.ExtractedSource
class ExtractedSource
ExtractedSource(filename: str, source: str, lineno: int, node: ast.FunctionDef | ast.AsyncFunctionDef, globalns: Mapping[str, Any] | None = None, freevars: frozenset[str] = frozenset(), qualname: str = '')
Source: packages/arxjit/src/arxjit/source.py:275
The extracted source of a decorated function.
Attributes
-
filename — Type: str; The file defining the function, or "<unknown>".
-
source — Type: str; Verbatim file text of the function definition with the decorator lines removed; the first line is the def statement, and the original indentation is preserved so string literals are untouched.
-
lineno — Type: int; One-based line of the def statement in
filename. -
node — Type: ast.FunctionDef | ast.AsyncFunctionDef; The parsed function definition with an empty decorator list. Line numbers match
filename, so they can be reported in diagnostics directly. Column offsets are raw astcol_offsetvalues (zero- based UTF-8 byte offsets) that point into the real file line, because the source is parsed without modifying its indentation; only the byte-to-character conversion is needed at the boundary that produces a diagnostic. -
globalns — Type: Mapping[str, Any] | None; The module namespace the function was defined in, or None when the object has no globals. Carried so later stages can detect module- level shadowing of a name the compiler treats as a builtin, which the AST alone cannot reveal. Excluded from repr and equality: it is incidental runtime context, not part of the extracted source.
-
freevars — Type: frozenset[str]; The names the function captures from enclosing scopes, empty when it captures nothing. Carried for the same reason as
globalns: a captured name is indistinguishable from a builtin in the AST alone. -
qualname — Type: str; The function's qualname, or "" when the object has none. Carried for the same reason as
globalns: a method is an ordinary function in the AST, and only the qualified name records the class it was defined in. It records the definition site, not which class owns the descriptor now, so it cannot reveal a function assigned into a class body or attached to a class afterwards.
Methods
- __init__ —