Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
find_symbol
codeintel.symbols.find_symbol
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 |
|---|---|---|
| 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.find_symbolbackend/app/codeintel/symbols.py, lines 13–36Open source
def find_symbol(db: Session, name: str, *, repository_ids: list[uuid.UUID] | None = None, limit: int = 10) -> list[DocumentChunk]: """Chunks whose qualified name equals ``name`` or ends with ``.name``. Exact qualified matches sort first, then shorter names (``Cart.total`` before ``shop.cart.Cart.total`` when searching ``total``). """ name = name.strip() if not name or len(name) > 512: return [] escaped = name.replace("\\", "\\\\").replace("%", r"\%").replace("_", r"\_") stmt = select(DocumentChunk).where( DocumentChunk.repository_id.isnot(None), DocumentChunk.ast_node_type.notin_(["block"]), or_( DocumentChunk.symbol_name == name, DocumentChunk.symbol_name.like(f"%.{escaped}", escape="\\"), ), ) if repository_ids: stmt = stmt.where(DocumentChunk.repository_id.in_(repository_ids)) rows = db.execute(stmt.limit(200)).scalars().all() rows.sort(key=lambda c: (c.symbol_name != name, len(c.symbol_name or ""), c.symbol_name or "")) return rows[:limit]What the index recorded
- Signature
def find_symbol(db: Session, name: str, *, repository_ids: list[uuid.UUID] | None, limit: int) -> list[DocumentChunk]:- File
backend/app/codeintel/symbols.py- Lines
- 13–36
- Parser
- python-ast
- Git blob
abdbb1001335e092a3fd51dcc000a89cac57e3a4- Call sites
- 15 named, 2 resolved, 13 left unlinked
- Outside this subset
- 3 more edges reach code outside the graph shown here
