Build a lexical repository symbol index
Input maps virtual Python paths to source text. Parse without importing or executing. List class, function, and async-function definitions that occur directly in module, class, or function bodies, including nested definitions. Return path, dotted lexical name, one-based line, and kind; sort by path, line, name. This deliberately bounded index does not traverse definitions inside conditional/loop blocks or resolve runtime dispatch. Invalid syntax raises ValueError containing the path. All data remains in memory.
Your task
- Complete the starter function using the contract above.
- Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
- Run tests to record your result, then compare with the explained reference solution.
Examples
Inputa.py contains class Box with method get
OutputBox at line 1; Box.get at line 2
InputSource raises at module level then defines safe
OutputIndex includes safe without raising RuntimeError
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor