Back to the room

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

Code Observatory / module

python_parser

codeintel.parsers.python_parser

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 (7)
SymbolFileResolved by
_docstringpython_parser.pysame file
_Extractorpython_parser.pysame file
_resolve_relativepython_parser.pysame file
_signaturepython_parser.pysame file
_start_linepython_parser.pysame file
module_path_forpython_parser.pysame file
parse_pythonpython_parser.pysame file
Imports (1)
SymbolFileResolved by
basebase.pythrough an import
Imported by (1)
SymbolFileResolved by
parsers__init__.pythrough an import
codeintel.parsers.python_parserbackend/app/codeintel/parsers/python_parser.py, lines 1–40Open source
"""Python symbol extraction with the standard-library ``ast`` module."""from __future__ import annotationsimport astfrom .base import (    MAX_DOCSTRING_CHARS,    MAX_SIGNATURE_CHARS,    ParseResult,    Symbol,    clip,)def module_path_for(path: str) -> str:    """``pkg/sub/mod.py`` -> ``pkg.sub.mod``; ``pkg/__init__.py`` -> ``pkg``.    A leading ``src/`` (the PyPA "src layout") is not part of the import    path: ``src/flask/app.py`` is ``flask.app``, which is also what other    files import, so call/import resolution can match it.    """    parts = path.split("/")    if len(parts) > 2 and parts[0] == "src":        parts = parts[1:]    last = parts[-1]    for suffix in (".pyi", ".py"):        if last.endswith(suffix):            last = last[: -len(suffix)]            break    parts[-1] = last    if parts[-1] == "__init__":        parts = parts[:-1]    return ".".join(p for p in parts if p)def _resolve_relative(module_path: str, is_package: bool, level: int, module: str | None) -> str:    """Absolute module name for ``from <level dots><module> import …``."""    base = module_path.split(".") if module_path else []    # For a module, level 1 means "my package" (drop the module itself);

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

What the index recorded

Signature
module backend.app.codeintel.parsers.python_parser
File
backend/app/codeintel/parsers/python_parser.py
Lines
1–225
Parser
python-ast
Git blob
63495bcda67d5742151d40ab76540e513f44e088
Outside this subset
1 more edges reach code outside the graph shown here

Read it on GitHub at this commit