Extract
extract
Language-dispatching parse/extract entry points.
The public parse_file / extract_module_info in :mod:axm_ast.core.parser
are the Python implementation (and the body of :class:PythonBackend). This
module is the multi-language layer above them: it routes a path to the backend
that owns its suffix, so callers that may see .py or .ts files use
one entry point and never branch on language themselves.
For .py files this is byte-identical to calling parser directly (the
registry returns the Python backend, which delegates to parser), so existing
Python-only call paths are unaffected.
extract_calls(module, module_name=None)
Extract call-sites from module via the backend that owns its file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
ModuleInfo
|
A parsed :class: |
required |
module_name
|
str | None
|
Dotted module name for |
None
|
Returns:
| Type | Description |
|---|---|
list[CallSite]
|
The module's call-sites in the language-agnostic model. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no backend is registered for the module's suffix. |
Source code in packages/axm-ast/src/axm_ast/core/extract.py
extract_module(path)
Extract :class:ModuleInfo from path via its language backend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Source file in any supported language. |
required |
Returns:
| Type | Description |
|---|---|
ModuleInfo
|
The language-agnostic :class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no backend is registered for the file's suffix. |
FileNotFoundError
|
If the file does not exist. |
Source code in packages/axm-ast/src/axm_ast/core/extract.py
parse_path(path)
Parse path with the backend that owns its suffix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Source file in any supported language ( |
required |
Returns:
| Type | Description |
|---|---|
Tree
|
The parsed tree-sitter |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no backend is registered for the file's suffix. |
FileNotFoundError
|
If the file does not exist. |