Back to the room

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

Code Observatory / module

parsers

codeintel.parsers

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

Contains (3)
SymbolFileResolved by
_module_path__init__.pysame file
line_chunks__init__.pysame file
parse_file__init__.pysame file
Imports (4)
SymbolFileResolved by
languageslanguages.pythrough an import
basebase.pythrough an import
python_parserpython_parser.pythrough an import
treesitter_parsertreesitter_parser.pythrough an import
Imported by (2)
SymbolFileResolved by
indexerindexer.pythrough an import
routerrouter.pythrough an import
codeintel.parsersbackend/app/codeintel/parsers/__init__.py, lines 1–40Open source
"""Symbol extraction entry point.:func:`parse_file` always returns a :class:`ParseResult`. When ASTextraction is not possible the result has ``parser="line-fallback"`` and amachine-readable ``fallback_reason`` — fallbacks are visible in chunkmetadata, ingestion stats and the API, never reported as AST output."""from __future__ import annotationsimport refrom ..languages import detect_languagefrom .base import ParseResult, Symbolfrom .python_parser import module_path_for, parse_pythonfrom .treesitter_parser import grammar_status, parse_treesitter__all__ = ["ParseResult", "Symbol", "grammar_status", "parse_file", "line_chunks"]FALLBACK_CHUNK_LINES = 60FALLBACK_OVERLAP_LINES = 10_IDENT_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_]{1,63}")def _module_path(path: str) -> str:    if path.endswith((".py", ".pyi")):        return module_path_for(path)    stem = path.rsplit(".", 1)[0] if "." in path.rsplit("/", 1)[-1] else path    return stem.replace("/", ".")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)

Shows the first 40 of 89 lines. The rest is on GitHub at this commit.

What the index recorded

Signature
module backend.app.codeintel.parsers
File
backend/app/codeintel/parsers/__init__.py
Lines
1–89
Parser
python-ast
Git blob
02097151776f80e9d044e640b7d140f7f516c1d3
Call sites
1 named, 0 resolved, 1 left unlinked
Outside this subset
5 more edges reach code outside the graph shown here

Read it on GitHub at this commit