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 symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| detect_language | languages.py | through an import |
| _module_path | __init__.py | same file |
| line_chunks | __init__.py | same file |
| parse_python | python_parser.py | through an import |
| parse_treesitter | treesitter_parser.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| _index_batch | indexer.py | through an import |
| Symbol | File | Resolved by |
|---|---|---|
| parsers | __init__.py | same 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
