Back to the room

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

Code Observatory / function

line_chunks

codeintel.parsers.line_chunks

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 (3)
SymbolFileResolved by
ParseResultbase.pythrough an import
Symbolbase.pythrough an import
add_identifierbase.pyunique name
Called by (1)
SymbolFileResolved by
parse_file__init__.pysame file
Inside (1)
SymbolFileResolved by
parsers__init__.pysame file
codeintel.parsers.line_chunksbackend/app/codeintel/parsers/__init__.py, lines 32–62Open source
def line_chunks(path: str, source: str, language: str, reason: str) -> ParseResult:    """Fixed-size overlapping line windows for files without AST support."""    lines = source.splitlines()    total = max(1, len(lines))    symbols: list[Symbol] = []    step = FALLBACK_CHUNK_LINES - FALLBACK_OVERLAP_LINES    start = 0    while True:        end = min(start + FALLBACK_CHUNK_LINES, total)        window = lines[start:end]        first = next((ln.strip() for ln in window if ln.strip()), "")        sym = Symbol(            name=f"{path.rsplit('/', 1)[-1]}:{start + 1}-{end}",            qualified_name=f"{path}:{start + 1}-{end}",            kind="block",            start_line=start + 1,            end_line=end,            signature=first[:200],        )        for ident in _IDENT_RE.findall("\n".join(window)):            sym.add_identifier(ident)        symbols.append(sym)        if end >= total:            break        start += step    return ParseResult(        language=language,        parser="line-fallback",        symbols=symbols,        fallback_reason=reason,    )

What the index recorded

Signature
def line_chunks(path: str, source: str, language: str, reason: str) -> ParseResult:
File
backend/app/codeintel/parsers/__init__.py
Lines
32–62
Parser
python-ast
Git blob
02097151776f80e9d044e640b7d140f7f516c1d3
Call sites
13 named, 3 resolved, 10 left unlinked

Read it on GitHub at this commit