Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
symbol_graph
codeintel.symbols.symbol_graph
PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.
PHAROS at 975a38dMIT license
Around this symbol
Search all symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| chunk_ref | symbols.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| hover | symbols.py | same file |
| lookup_symbol | router.py | through an import |
| build_mcp_server | native_server.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| symbols | symbols.py | same file |
codeintel.symbols.symbol_graphbackend/app/codeintel/symbols.py, lines 39–62Open source
def symbol_graph(db: Session, chunk_id: uuid.UUID, *, limit: int = 50) -> dict[str, list[dict]]: """Resolved callers, callees, containment and imports around one chunk.""" out: dict[str, list[dict]] = {"calls": [], "called_by": [], "contains": [], "contained_by": [], "imports": [], "imported_by": []} edges = db.execute( select(CodeEdge.source_chunk_id, CodeEdge.target_chunk_id, CodeEdge.edge_type, CodeEdge.resolution) .where(or_(CodeEdge.source_chunk_id == chunk_id, CodeEdge.target_chunk_id == chunk_id)) .limit(limit * 6) ).all() other_ids = {t if s == chunk_id else s for s, t, _, _ in edges if t is not None} chunks = { c.id: c for c in db.execute(select(DocumentChunk).where(DocumentChunk.id.in_(other_ids))).scalars() } if other_ids else {} inverse = {"calls": "called_by", "contains": "contained_by", "imports": "imported_by"} for src, dst, etype, resolution in edges: outgoing = src == chunk_id other = chunks.get(dst if outgoing else src) if other is None: continue relation = etype if outgoing else inverse[etype] if len(out[relation]) >= limit: continue out[relation].append(chunk_ref(other) | {"resolution": resolution}) return outWhat the index recorded
- Signature
def symbol_graph(db: Session, chunk_id: uuid.UUID, *, limit: int) -> dict[str, list[dict]]:- File
backend/app/codeintel/symbols.py- Lines
- 39–62
- Parser
- python-ast
- Git blob
abdbb1001335e092a3fd51dcc000a89cac57e3a4- Call sites
- 12 named, 3 resolved, 9 left unlinked
- Outside this subset
- 3 more edges reach code outside the graph shown here
