refactor: release tools read file_digest

core.hashing.file_digest is the streamed loop the release tools carried,
byte for byte: 1 MiB reads, read again each call. It replaces
compute_hashes with cache=False there.
This commit is contained in:
Abdessamad Derraz committed 2026-11-18 20:44:56 +01:00
1 parent 27bff61560
commit ba692da94f
4 files changed
+11 -9

No files matched your search

+3 -2
View File
@@ -7,9 +7,10 @@ import os
import re
import subprocess
from collections.abc import Iterable
from pathlib import Path
from typing import NamedTuple
from core.hashing import compute_hashes
from core.hashing import file_digest
from model.composition import composition_tier
from model.largefiles import LARGE_FILES_RELEASE, LARGE_FILES_REPO, asset_names, registered_paths
@@ -268,7 +269,7 @@ def cache_hashes(names: set[str], cache_dir: str = ".cache/large") -> dict[str,
for name in names:
path = os.path.join(cache_dir, name)
if os.path.isfile(path):
hashes[name] = compute_hashes(path, frozenset({"sha1"}), cache=False)["sha1"]
hashes[name] = file_digest(Path(path))
return hashes