Back to the room

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 symbols

Loading

Called by (2)
SymbolFileResolved by
lookup_symbolrouter.pythrough an import
build_mcp_servernative_server.pythrough an import
Inside (1)
SymbolFileResolved by
symbolssymbols.pysame 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

Read it on GitHub at this commit