Inspect resolve
inspect_resolve
Symbol resolution helpers for InspectTool.
find_module_for_symbol(pkg, symbol)
Find the module containing a symbol.
Supports two lookup modes:
- Object (
FunctionInfo/ClassInfo): identity-first match, then name fallback. - String: name-based search across functions, methods, and classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg
|
PackageInfo
|
Analyzed package info. |
required |
symbol
|
str | FunctionInfo | ClassInfo | VariableInfo
|
Symbol name or object to locate. |
required |
Returns:
| Type | Description |
|---|---|
ModuleInfo | None
|
The |
Source code in packages/axm-ast/src/axm_ast/core/analyzer.py
find_symbol_abs_path(pkg, sym)
Find the absolute file path for a symbol within the package.
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
find_symbol_file(pkg, sym)
Find the relative file path for a symbol within the package.
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
inspect_dotted(pkg, symbol, *, source=False)
Resolve a dotted symbol (module, module.symbol, or Class.method).
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
inspect_module(pkg, name)
Try to resolve name as a module name and return module metadata.
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
resolve_class_method(pkg, dotted, *, source=False)
Try to resolve dotted as ClassName.method_name.
Returns None if no class matches.
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
resolve_module(pkg, name)
Resolve a name to a module via exact or substring match.
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
resolve_module_symbol(pkg, dotted, *, source=False)
Try to resolve dotted as module_name.symbol_name.
Tries longest module prefix first (e.g. core.checker before core).
Returns None if no module prefix matches.
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
resolve_path(path)
Resolve and validate project path.
Source code in packages/axm-ast/src/axm_ast/tools/inspect_resolve.py
search_symbols(pkg, *, name=None, returns=None, kind=None, inherits=None)
Search for symbols across a package with filters.
All filters are AND-combined. A symbol must match all provided filters to be included in results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pkg
|
PackageInfo
|
Analyzed package info. |
required |
name
|
str | None
|
Filter by symbol name (substring match). |
None
|
returns
|
str | None
|
Filter functions by return type (substring match). |
None
|
kind
|
SymbolKind | None
|
Filter by SymbolKind (function, method, property, classmethod, staticmethod, abstract, class, variable). |
None
|
inherits
|
str | None
|
Filter classes by base class name. |
None
|
Returns:
| Type | Description |
|---|---|
list[FunctionInfo | ClassInfo | VariableInfo]
|
List of matching symbols. |
Example
results = search_symbols(pkg, returns="str") [r.name for r in results]['greet', 'version']