Download stackgo/stackbuild/repo_model.py from s0duku/the-stack-go: direct link, hf CLI and curl.
- Browser
- Download file 2.84 kB
-
https://huggingface.co/datasets/s0duku/the-stack-go/resolve/main/stackgo/stackbuild/repo_model.py
- Command line
-
hf download hf://datasets/s0duku/the-stack-go/stackgo/stackbuild/repo_model.py
-
curl -L -o repo_model.py https://huggingface.co/datasets/s0duku/the-stack-go/resolve/main/stackgo/stackbuild/repo_model.py
2.84 kB
| """Immutable input and output models for repository analysis.""" | |
| from __future__ import annotations | |
| from dataclasses import dataclass, field | |
| from typing import Iterable, Iterator | |
| class RepoFile: | |
| """A file in one repository snapshot. | |
| ``content`` may be bytes or text. Analysis is read-only and never writes | |
| back to the repository. Metadata fields are intentionally optional so the | |
| model can be built directly from The Stack v2 rows. | |
| """ | |
| path: str | |
| content: bytes | str | |
| language: str | None = None | |
| encoding: str | None = None | |
| blob_id: str | None = None | |
| is_vendor: bool | None = None | |
| is_generated: bool | None = None | |
| class Repo: | |
| """One immutable repository revision.""" | |
| repo_id: str | |
| revision_id: str | |
| files: Iterable[RepoFile] | |
| def iter_files(self) -> Iterator[RepoFile]: | |
| return iter(self.files) | |
| class DependencyEdge: | |
| source: str | |
| target: str | |
| kind: str | |
| confidence: float | |
| status: str = "resolved" | |
| evidence: str | None = None | |
| class Diagnostic: | |
| path: str | |
| level: str | |
| message: str | |
| extractor: str | None = None | |
| class FileInfo: | |
| path: str | |
| language: str | None | |
| bytes: int | |
| sha1: str | None = None | |
| references: tuple[str, ...] = () | |
| class ReferenceInfo: | |
| source_path: str | |
| name: str | |
| kind: str | |
| status: str | |
| target_path: str | None = None | |
| candidates: tuple[str, ...] = () | |
| confidence: float = 0.0 | |
| evidence: str | None = None | |
| resolver_evidence: str | None = None | |
| class ConcatenationNode: | |
| """One node in the deterministic repository concatenation suggestion tree. | |
| ``kind`` is ``repo``, ``cycle`` or ``file``. File leaves occur exactly | |
| once. A depth-first traversal therefore produces a complete, stable, | |
| dependency-first repository sequence. | |
| """ | |
| kind: str | |
| name: str | |
| order: int | |
| path: str | None = None | |
| language: str | None = None | |
| bytes: int = 0 | |
| depends_on: tuple[str, ...] = () | |
| children: tuple["ConcatenationNode", ...] = () | |
| class RepoInfo: | |
| """Serializable analysis result for one repository revision.""" | |
| repo_id: str | |
| revision_id: str | |
| files: tuple[FileInfo, ...] | |
| edges: tuple[DependencyEdge, ...] | |
| topological_order: tuple[str, ...] | |
| strongly_connected_components: tuple[tuple[str, ...], ...] = () | |
| diagnostics: tuple[Diagnostic, ...] = () | |
| stats: dict[str, int] = field(default_factory=dict) | |
| references: tuple[ReferenceInfo, ...] = () | |
| concatenation_tree: ConcatenationNode | None = None | |