Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / function

_candidates

codeintel.describe._candidates

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

Calls (1)
SymbolFileResolved by
path_roleretrieval.pythrough an import
Called by (1)
SymbolFileResolved by
describe_repositorydescribe.pysame file
Inside (1)
SymbolFileResolved by
describedescribe.pysame file
codeintel.describe._candidatesbackend/app/codeintel/describe.py, lines 77–100Open source
def _candidates(db: Session, repository_id, only_undocumented: bool, limit: int | None):    rows = db.execute(        select(DocumentChunk, Resource.content_sha)        .join(Resource, Resource.id == DocumentChunk.resource_id)        .where(DocumentChunk.repository_id == repository_id, DocumentChunk.ast_node_type.in_(KINDS))        .order_by(DocumentChunk.chunk_metadata["path"].as_string(), DocumentChunk.start_line)    ).all()    cached = {        (sha, sym) for sha, sym in db.execute(            select(ChunkDescription.content_sha, ChunkDescription.symbol_name)            .where(ChunkDescription.content_sha.in_({sha for _, sha in rows if sha}))        )    }    out = []    for chunk, sha in rows:        meta = chunk.chunk_metadata or {}        if not sha or (sha, chunk.symbol_name) in cached or path_role(meta.get("path", "")) != "source":            continue        if only_undocumented and meta.get("docstring"):            continue        out.append((chunk, sha))    # Undocumented first: they gain most.    out.sort(key=lambda item: bool((item[0].chunk_metadata or {}).get("docstring")))    return out[:limit] if limit else out

What the index recorded

Signature
def _candidates(db: Session, repository_id, only_undocumented: bool, limit: int | None):
File
backend/app/codeintel/describe.py
Lines
77–100
Parser
python-ast
Git blob
9e70d40ab4a4d664b1b0e8b0ac225e7a134fa3f2
Call sites
13 named, 3 resolved, 10 left unlinked
Outside this subset
2 more edges reach code outside the graph shown here

Read it on GitHub at this commit