Skip to main content

Module graph_support

Module graph_support 

Source
Expand description

The language half of Python’s resolution logic: module lookup, the export index, the import binder, base-class resolution and the skeleton renderer, written as free functions over a source trait instead of as methods on PythonAnalyzer.

PythonAnalyzer (in brokk-bifrost-analysis) owns the lazy cells (seven moka caches, one OnceLock and two PoolSafeMemos) and implements PythonSource out of its own accessors, so the functions below reach back for the memoized products they need without naming the analyzer type.

Traits§

PythonSource
The analyzer-resident products Python’s language logic resolves through, on top of the two core capability traits it reads declarations and imports with. The analyzer is the only implementor and every method forwards to one of its own accessors, so the cells stay where they are and no free function can reach past this surface.
PythonUsageSource
PythonSource plus the built usage index. Everything reached from the export/importer walks needs it; the index build itself must not.

Functions§

compute_export_index_of
export_index_from_file_facts
extract_type_identifiers
import_binder_from_imports
import_bindings_from_imports
Resolve each structured import without collapsing repeated local names.
public_declarations_in_module
render_skeleton_recursive
resolve_base_class
resolve_module_code_unit
resolve_module_code_units_batch
Batched sibling of resolve_module_code_unit: resolves every FQN’s path-symbol lookup in one store transaction instead of one per FQN, then falls back to the (unbatched, rarer) definition-lookup path per FQN exactly as the single-FQN version does. Preserves its per-item semantics precisely, including that a path lookup which succeeds but finds no module unit does not fall through to the definition lookup.