Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / module
source
codeintel.source
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 |
|---|---|---|
| _FileCache | source.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| _fetch_https | source.py | same file |
| _FileCache | source.py | same file |
| _load | source.py | same file |
| _resolve_one | source.py | same file |
| _slice | source.py | same file |
| git_blob_sha | source.py | same file |
| resolve_sources | source.py | same file |
| SourceRequest | source.py | same file |
| SourceResult | source.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| git_source | git_source.py | through an import |
codeintel.sourcebackend/app/codeintel/source.py, lines 1–40Open source
"""On-demand source resolution for hybrid storage.Pharos stores pointers (repository, commit, path, line span) instead ofsource code. This module turns a pointer back into code:* **local repositories** — ``git cat-file`` from the registered checkout's object database (works offline, no network);* **GitHub / GitLab / Bitbucket** — the host's raw-file endpoint at the pinned commit, over https, from an allowlist of hosts, without following redirects, with a size cap and a short timeout.Every fetched file is checked against the git blob SHA recorded at indextime (``sha1("blob <len>\\0" + bytes)``). A mismatch is reported as``unavailable:content_mismatch`` instead of returning code that may not bewhat was indexed. Because URLs pin a commit, fetched files are immutable andare cached in-process."""from __future__ import annotationsimport concurrent.futuresimport hashlibimport loggingimport threadingfrom collections import OrderedDictfrom dataclasses import dataclassfrom urllib.parse import urlsplitfrom .git_source import RAW_CONTENT_HOSTS, GitError, local_git_dir, raw_file_url, read_file_at_commitlogger = logging.getLogger(__name__)MAX_FETCH_BYTES = 2_000_000FETCH_TIMEOUT_SECONDS = 5.0FETCH_CONCURRENCY = 8CACHE_FILES = 256@dataclassclass SourceRequest:Shows the first 40 of 173 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
module backend.app.codeintel.source- File
backend/app/codeintel/source.py- Lines
- 1–173
- Parser
- python-ast
- Git blob
c9f05cf7bf871b09919d64e9fdaf8380ecc3df2c- Call sites
- 2 named, 1 resolved, 1 left unlinked
