Back to the room

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

Code Observatory / function

_render

codeintel.context._render

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 (2)
SymbolFileResolved by
takecontext.pysame file
_render_memorycontext.pysame file
Called by (1)
SymbolFileResolved by
assemble_contextcontext.pysame file
Inside (1)
SymbolFileResolved by
contextcontext.pysame file
codeintel.context._renderbackend/app/codeintel/context.py, lines 321–360Open source
def _render(query: str, chunks: list[dict], related: list[dict], rules: list[dict], budget: _Budget,            memory: dict | None = None) -> str:    parts: list[str] = []    header = budget.take(f"# Code context for: {query}\n")    if header:        parts.append(header)    if memory and (memory.get("briefs") or memory.get("items") or memory.get("skills")):        block = budget.take(_render_memory(memory, min(MEMORY_CHARS, max(0, budget.limit // 3))))        if block:            parts.append(block)    for c in chunks:        cite = f"{c['repository']['name']}:{c['path']}:{c['start_line']}-{c['end_line']}"        title = f"\n## [{c['rank']}] {c['symbol'] or c['path']} ({c['kind']}) — {cite}\n"        body = title        if c.get("code"):            body += f"```{c['language'] or ''}\n{c['code']}\n```\n"        else:            body += f"{c['summary']}\n"        taken = budget.take(body)        if taken is None:            break        parts.append(taken)    if related:        lines = ["\n## Related code (call graph)\n"]        for r in related:            lines.append(f"- {r['relation']}: {r['symbol']} — {r['path']}:{r['start_line']}-{r['end_line']}\n")        taken = budget.take("".join(lines))        if taken:            parts.append(taken)    if rules:        profile = rules[0].get("profile_id")        lines = [f"\n## Coding rules (profile {profile})\n" if profile else "\n## Coding rules for this repository\n"]        for r in rules:            lines.append(f"- **{r['name']}**: {r['description']}\n")            if r.get("example"):                lines.append(f"  Example: `{r['example']}`\n")        taken = budget.take("".join(lines))        if taken:            parts.append(taken)    return "".join(parts)

What the index recorded

Signature
def _render(query: str, chunks: list[dict], related: list[dict], rules: list[dict], budget: _Budget, memory: dict | None) -> str:
File
backend/app/codeintel/context.py
Lines
321–360
Parser
python-ast
Git blob
0c4a7dd4639651a5c13142d168630e344439f22a
Call sites
7 named, 2 resolved, 5 left unlinked

Read it on GitHub at this commit