Back to the room

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

Code Observatory / function

parse_file

codeintel.parsers.parse_file

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 (5)
SymbolFileResolved by
detect_languagelanguages.pythrough an import
_module_path__init__.pysame file
line_chunks__init__.pysame file
parse_pythonpython_parser.pythrough an import
parse_treesittertreesitter_parser.pythrough an import
Called by (1)
SymbolFileResolved by
_index_batchindexer.pythrough an import
Inside (1)
SymbolFileResolved by
parsers__init__.pysame file
codeintel.parsers.parse_filebackend/app/codeintel/parsers/__init__.py, lines 65–89Open source
def parse_file(path: str, source: str) -> ParseResult | None:    """Parse ``source`` (the content of repository-relative ``path``).    Returns None for files that are not indexable source code.    """    spec = detect_language(path)    if spec is None:        return None    if spec.parser == "python-ast":        result = parse_python(path, source)        return result if result is not None else line_chunks(path, source, spec.name, "syntax_error")    if spec.parser == "tree-sitter":        try:            result = parse_treesitter(path, source, spec.name, spec.grammar, _module_path(path))        except ImportError as exc:            return line_chunks(path, source, spec.name, str(exc))        if len(result.symbols) <= 1 and result.partial:            # Only the module symbol and the tree is broken: line chunks            # retrieve better than one opaque whole-file chunk.            return line_chunks(path, source, spec.name, "parse_error")        return result    return line_chunks(path, source, spec.name, "unsupported_language")

What the index recorded

Signature
def parse_file(path: str, source: str) -> ParseResult | None:
File
backend/app/codeintel/parsers/__init__.py
Lines
65–89
Parser
python-ast
Git blob
02097151776f80e9d044e640b7d140f7f516c1d3
Call sites
7 named, 5 resolved, 2 left unlinked
Outside this subset
17 more edges reach code outside the graph shown here

Read it on GitHub at this commit