INNER CODE UNIT · Python
pinned
pineforge-4pass/pineforge-engine · benchmarks/check_provenance.py:113
def pinned(self, commit: str, path: str) -> str:
self.reads.append(f"{commit}:{path}")
res = self._git("show", f"{commit}:{path}")
if res.returncode:
raise Unsourced(f"pinned {commit}:{path} is not in this clone")
return res.stdout
def is_commit(self, sha: str) -> bool:
return self._git("cat-file", "-e", f"{sha}^{{commit}}").returncode == 0
@dataclass(frozen=True)
class Num:
"""A derived value; the README may round it to the digits it prints."""
value: float
slack: float = 0.0 # rounding the source itself already carries
scale: float = 1.0 # the printed unit: 1e3 for "603k", 1e6 for "0.64 M"