mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-01 07:33:45 -06:00
feat: read measurements at a pinned commit
measurements-pin.json names the measurements repository and the commit read. sync_measurements.py reads the clone in .cache/measurements at that commit, checks every line against its id and sidecar, and writes the site index and the SQLite databases. --fetch refuses a remote that changed or removed a line the pin holds, --bump moves the pin. validate_schemas checks every line and sidecar against their schemas, check_freshness flags a pin behind the remote head.
This commit is contained in:
1 parent
6109d7abd5
commit
effa9e332f
6 files changed
+662
-10
No files matched your search
@@ -8,6 +8,7 @@ from __future__ import annotations
|
||||
|
||||
from collections.abc import Callable, Iterator
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
import re
|
||||
@@ -24,6 +25,15 @@ _TIMESTAMP_PATTERNS = [
|
||||
re.compile(r'<time datetime="[^"]*">Data as of [^<]*</time>'),
|
||||
]
|
||||
|
||||
def json_text(value: object) -> str:
|
||||
"""Stable scalar representation for CSV and SQLite exports."""
|
||||
if value is None:
|
||||
return ""
|
||||
if isinstance(value, (dict, list, tuple, bool)):
|
||||
return json.dumps(value, ensure_ascii=False, sort_keys=True)
|
||||
return str(value)
|
||||
|
||||
|
||||
def write_if_changed(
|
||||
path: str, content: str, normalize: Callable[[str], str] | None = None
|
||||
) -> bool:
|
||||
|
||||
Reference in new issue
Block a user