Skip to main content

Module inverted

Module inverted 

Source
Expand description

Whole-workspace inverted edge builder for Python.

Walks each file once and resolves every reference to the callee fqn it names, via the shared [build_edges] driver. Python node fqns are dotted module paths (pkg.util.format_value, app.helper), so a reference resolves through the file’s import binder:

  • a from pkg.util import f binding resolves a bare f to pkg.util.f;
  • an import pkg.util as u binding resolves u.f to pkg.util.f;
  • a same-file/same-module name resolves to that declaration’s fqn.

Parameters and local assignments shadow same-named imports and module-level declarations (Python scopes are function-wide), matching the forward scan’s shadow handling so a local named like an import does not produce a false edge. A typed receiver — a recv: Foo parameter or a recv = Foo() local — resolves recv.method to Foo.method via the forward scan’s shared receiver typing ([collect_scope_facts] + resolve_receiver_type).

Structs§

PythonEdgeScan
The whole-pass state the per-file walk shares: the terminal-segment index over targets, and the namespace-candidate memo the walk fills as it goes.