Back to the room

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

Code Observatory / function

_load

codeintel.source._load

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 (6)
SymbolFileResolved by
local_git_dirgit_source.pythrough an import
raw_file_urlgit_source.pythrough an import
read_file_at_commitgit_source.pythrough an import
_fetch_httpssource.pysame file
getsource.pysame file
putsource.pysame file
Called by (1)
SymbolFileResolved by
_resolve_onesource.pysame file
Inside (1)
SymbolFileResolved by
sourcesource.pysame file
codeintel.source._loadbackend/app/codeintel/source.py, lines 121–138Open source
def _load(req: SourceRequest, token: str | None) -> tuple[bytes, str]:    cache_key = f"{req.repository_url}@{req.commit}:{req.path}"    cached = _cache.get(cache_key)    if cached is not None:        return cached, "cache"    if req.source_type == "local":        if not req.local_path:            raise FileNotFoundError("local repository path not recorded")        data = read_file_at_commit(local_git_dir(req.local_path), req.commit, req.path)        origin = "git"    else:        url = raw_file_url(req.repository_url, req.commit, req.path)        if url is None:            raise LookupError("no raw-content endpoint for this host")        data = _fetch_https(url, token)        origin = "https"    _cache.put(cache_key, data)    return data, origin

What the index recorded

Signature
def _load(req: SourceRequest, token: str | None) -> tuple[bytes, str]:
File
backend/app/codeintel/source.py
Lines
121–138
Parser
python-ast
Git blob
c9f05cf7bf871b09919d64e9fdaf8380ecc3df2c
Call sites
8 named, 6 resolved, 2 left unlinked

Read it on GitHub at this commit