Back to the room

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

Code Observatory / method

_count_lines

codeintel.indexer.CodeIndexer._count_lines

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 (1)
SymbolFileResolved by
indexindexer.pysame file
Inside (1)
SymbolFileResolved by
CodeIndexerindexer.pysame file
codeintel.indexer.CodeIndexer._count_linesbackend/app/codeintel/indexer.py, lines 554–563Open source
    def _count_lines(self, repo_id) -> int:        # A file's length is the largest end_line among its chunks.        per_file = (            select(func.max(DocumentChunk.end_line).label("n"))            .where(DocumentChunk.repository_id == repo_id)            .group_by(DocumentChunk.resource_id)            .subquery()        )        total = self.db.execute(select(func.coalesce(func.sum(per_file.c.n), 0))).scalar_one()        return int(total or 0)

What the index recorded

Signature
def _count_lines(self, repo_id) -> int:
File
backend/app/codeintel/indexer.py
Lines
554–563
Parser
python-ast
Git blob
e8fdfa7b5545e821f7649d68cfadd2aae85b89d0
Call sites
11 named, 2 resolved, 9 left unlinked
Outside this subset
2 more edges reach code outside the graph shown here

Read it on GitHub at this commit