Back to the room

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

Code Observatory / function

_resolve_relative

codeintel.parsers.python_parser._resolve_relative

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

Called by (1)
SymbolFileResolved by
visit_ImportFrompython_parser.pysame file
Inside (1)
SymbolFileResolved by
python_parserpython_parser.pysame file
codeintel.parsers.python_parser._resolve_relativebackend/app/codeintel/parsers/python_parser.py, lines 37–49Open source
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);    # for a package's __init__, level 1 means the package itself.    drop = level - 1 if is_package else level    if drop > len(base):        base = []    elif drop:        base = base[: len(base) - drop]    if module:        base = base + module.split(".")    return ".".join(base)

What the index recorded

Signature
def _resolve_relative(module_path: str, is_package: bool, level: int, module: str | None) -> str:
File
backend/app/codeintel/parsers/python_parser.py
Lines
37–49
Parser
python-ast
Git blob
63495bcda67d5742151d40ab76540e513f44e088
Call sites
3 named, 0 resolved, 3 left unlinked

Read it on GitHub at this commit