refactor: read declared hashes with one helper

core.hashing.declared_hash_lists gives an entry's declared values per
field in the order written, and declared_hashes builds its sets on it.
The gap page, the doubled-destination report and the file lookup used
their own copies of that reader. The wanted page keeps its filters on
top of it. sitegen.lookup.hash_pairs replaces sorted_hash_values for
the lookup, the data exports and the structured data. The one-field
aliases parse_md5_list and reconcile.hash_values are gone, and
model.profiles reads HASH_FIELDS instead of a fourth tuple.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 10:29:37 +01:00
1 parent ea68e85c06
commit 02969dda06
30 files changed
+176 -195

No files matched your search

+4 -3
View File
@@ -10,7 +10,8 @@ from model.database import sha1_at
from model.systemnames import system_name
from model.profiles import is_emulator
from sitegen.config import SITE_URL
from sitegen.lookup import sorted_hash_values, site_path
from core.hashing import parse_hash_list
from sitegen.lookup import site_path
from sitegen.render import card_anchor, console_href
@@ -45,8 +46,8 @@ def system_index_items(db: dict, coverages: dict, profiles: dict) -> list[dict]:
ids = ([str(entry["system"])] if entry.get("system")
else [str(s) for s in entry.get("systems") or []] or
(own if len(own) == 1 else []))
found = {v for v in sorted_hash_values(entry.get("sha1")) if v in files}
for md5 in sorted_hash_values(entry.get("md5")):
found = {v for v in parse_hash_list(entry.get("sha1")) if v in files}
for md5 in parse_hash_list(entry.get("md5")):
match = by_md5.get(md5)
found.update([match] if isinstance(match, str) else match or [])
for sys_id in ids: