Back to the room

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

Code Observatory / function

source_requests

codeintel.context.source_requests

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
SourceRequestsource.pythrough an import
Called by (2)
SymbolFileResolved by
assemble_contextcontext.pysame file
lookup_symbolrouter.pythrough an import
Inside (1)
SymbolFileResolved by
contextcontext.pysame file
codeintel.context.source_requestsbackend/app/codeintel/context.py, lines 116–151Open source
def source_requests(db: Session, hits: list[Hit]) -> list[SourceRequest]:    if not hits:        return []    repo_rows = {        str(r.id): r        for r in db.execute(            select(Repository).where(Repository.id.in_({uuid.UUID(h.repository_id) for h in hits}))        ).scalars()    }    blob = dict(        db.execute(            select(Resource.id, Resource.content_sha).where(                Resource.id.in_({uuid.UUID(h.resource_id) for h in hits if h.resource_id})            )        ).all()    )    reqs = []    for h in hits:        repo = repo_rows[h.repository_id]        start, end = h.start_line or 1, h.end_line or 1        if h.kind == "module":            end = min(end, start + MODULE_CODE_LINES - 1)        reqs.append(            SourceRequest(                key=h.chunk_id,                source_type=repo.source_type,                repository_url=repo.url,                local_path=repo.local_path,                commit=h.commit_sha or "",                path=h.path,                start_line=start,                end_line=end,                blob_sha=blob.get(uuid.UUID(h.resource_id)) if h.resource_id else None,            )        )    return reqs

What the index recorded

Signature
def source_requests(db: Session, hits: list[Hit]) -> list[SourceRequest]:
File
backend/app/codeintel/context.py
Lines
116–151
Parser
python-ast
Git blob
0c4a7dd4639651a5c13142d168630e344439f22a
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