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.
Structs§
- Python
Module Spellings - Every workspace Python module’s project-root name, keyed by its last component.
- Python
Source Root Module - A module whose project-root name ends with an absolute specifier, and the source root that spelling would have to be written against.
Traits§
- Python
Source - 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.
- Python
Usage Source PythonSourceplus 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 - import_
binder_ from_ imports - import_
bindings_ from_ imports - Resolve each structured import without collapsing repeated local names.
- public_
declarations_ in_ module - python_
module_ file_ under_ source_ root - The file an absolute
module_fqnames when it is written against a source root the workspace’s own structure establishes. - render_
skeleton_ recursive - resolve_
base_ class - resolve_
module_ code_ unit - The module
module_fqnames, as written inimporter. - 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. - retain_
modules_ for_ importer - Keep only the candidates an absolute import written in
importercan mean.