Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / method
_build_rows
codeintel.indexer.CodeIndexer._build_rows
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 |
|---|---|---|
| raw_url | git_source.py | unique name |
| _PreparedChunk | indexer.py | same file |
| _utcnow | indexer.py | same file |
| lang | indexer.py | same file |
| body_excerpt | text.py | through an import |
| search_text | text.py | through an import |
| semantic_summary | text.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| _index_batch | indexer.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| CodeIndexer | indexer.py | same file |
codeintel.indexer.CodeIndexer._build_rowsbackend/app/codeintel/indexer.py, lines 392–451Open source
def _build_rows(self, repo_id, ref: RepoRef, commit: str, entry: TreeEntry, text: str, parsed: ParseResult, stats: IndexStats) -> tuple[Resource, list[_PreparedChunk]]: lang = stats.lang(parsed.language) lang.files += 1 if parsed.parser == "line-fallback": lang.fallback_files += 1 lang.fallback_reasons[parsed.fallback_reason or "unknown"] += 1 else: lang.ast_files += 1 line_count = text.count("\n") + (0 if text.endswith("\n") else 1) stats.source_bytes_indexed += entry.size stats.lines_indexed += line_count now = _utcnow() resource = Resource( title=entry.path, description=f"{parsed.language} source file", source=ref.canonical_url, identifier=entry.path, coverage=commit, type="code_file", format=f"text/x-{parsed.language}", language=parsed.language[:16], subject=[parsed.language], relation=[f"repository:{ref.canonical_url}"], ingestion_status="completed", ingestion_completed_at=now, repository_id=repo_id, content_sha=entry.blob_sha, is_stale=False, last_indexed_sha=commit, last_indexed_at=now, ) raw_url = ref.raw_url(commit, entry.path) module_name = parsed.symbols[0].qualified_name if parsed.symbols else "" chunks: list[_PreparedChunk] = [] source_lines = text.splitlines() descriptions = dict(self.db.execute( select(ChunkDescription.symbol_name, ChunkDescription.description) .where(ChunkDescription.content_sha == entry.blob_sha) ).all()) for idx, sym in enumerate(parsed.symbols[:MAX_SYMBOLS_PER_FILE]): summary = semantic_summary(sym, language=parsed.language, path=entry.path, module_name=module_name, body=body_excerpt(source_lines, sym), description=descriptions.get(sym.qualified_name[:512], "")) meta = { "path": entry.path, "name": sym.name, "parent": sym.parent, "calls": sym.calls, } if sym.signature: meta["signature"] = sym.signature[:500] if sym.docstring: meta["docstring"] = sym.docstring[:2000] if parsed.parser == "line-fallback": meta["fallback_reason"] = parsed.fallback_reason if parsed.partial: meta["partial_parse"] = TrueShows the first 60 of 86 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
def _build_rows(self, repo_id, ref: RepoRef, commit: str, entry: TreeEntry, text: str, parsed: ParseResult, stats: IndexStats) -> tuple[Resource, list[_PreparedChunk]]:- File
backend/app/codeintel/indexer.py- Lines
- 392–477
- Parser
- python-ast
- Git blob
e8fdfa7b5545e821f7649d68cfadd2aae85b89d0- Call sites
- 25 named, 11 resolved, 14 left unlinked
- Outside this subset
- 4 more edges reach code outside the graph shown here
