Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
module_path_for
codeintel.parsers.python_parser.module_path_for
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 |
|---|---|---|
| _module_path | __init__.py | through an import |
| parse_python | python_parser.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| python_parser | python_parser.py | same file |
codeintel.parsers.python_parser.module_path_forbackend/app/codeintel/parsers/python_parser.py, lines 16–34Open source
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)What the index recorded
- Signature
def module_path_for(path: str) -> str:- File
backend/app/codeintel/parsers/python_parser.py- Lines
- 16–34
- Parser
- python-ast
- Git blob
63495bcda67d5742151d40ab76540e513f44e088- Call sites
- 4 named, 0 resolved, 4 left unlinked
- Outside this subset
- 1 more edges reach code outside the graph shown here
