refactor: one copy of each duplicated helper

This commit is contained in:
Abdessamad Derraz committed 2026-11-18 22:16:55 +01:00
1 parent 2c8a9cfad8
commit 238f70c7a7
11 files changed
+49 -79

No files matched your search

+13
View File
@@ -2,7 +2,9 @@
from __future__ import annotations
import json
import os
from pathlib import Path
from core.cli import InputMissing
from model.sources import source_yaml
@@ -67,3 +69,14 @@ def list_release_pack_platforms(platforms_dir: str = "platforms") -> list[str]:
for name in list_registered_platforms(platforms_dir)
if registry.get(name, {}).get("release_pack") is True
]
VERSIONS_FILE = "data/.versions.json"
def _load_versions(versions_path: str = VERSIONS_FILE) -> dict[str, dict]:
path = Path(versions_path)
if not path.exists():
return {}
with open(path) as f:
return json.load(f)
+4
View File
@@ -536,3 +536,7 @@ def _prose_path(
before.rfind("(")) + 1:]
path = f"{word} {path}"
return path, role, path_start, (path_start, match.end("path"))
def span(first: int, last: int) -> str:
return str(first) if first == last else f"{first}-{last}"