mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-26 03:18:52 -06:00
refactor: reuse the shared helpers left copied
Copies of helpers the first pass created, replaced by the helper: - source_yaml_file for our YAML sources (generate_db read them in the locale's encoding, a syntax error named no file); - data_dir_registry_at in registry_bundles, platform_registry_at (new, beside load_platform_registry) in the manifest; - DATA_DIRS_FILE for the registry path five modules spelled; - load_optional_database, sha1_at, VERSIONS_FILE, installer_module; - DerivedView where a cache was keyed by id() of a dict; - count_text and series where a plural or a list was written by hand.
This commit is contained in:
1 parent
32a4ca1fa1
commit
036a6ebf29
35 files changed
+141
-170
No files matched your search
@@ -10,10 +10,11 @@ from collections.abc import Iterable
|
||||
from pathlib import Path
|
||||
from typing import NamedTuple
|
||||
|
||||
from core.paths import EMULATORS_DIR
|
||||
from core.paths import DATA_DIRS_FILE, EMULATORS_DIR
|
||||
from core.hashing import file_digest
|
||||
from core.sizes import size_text
|
||||
from model.composition import composition_tier
|
||||
from model.registry import data_dir_registry_at
|
||||
from model.largefiles import (
|
||||
LARGE_FILES_RELEASE,
|
||||
LARGE_FILES_REPO,
|
||||
@@ -235,14 +236,10 @@ def profile_descriptions(emulators_dir: str = EMULATORS_DIR) -> dict[str, str]:
|
||||
return found
|
||||
|
||||
|
||||
def registry_bundles(registry_path: str = "platforms/_data_dirs.yml") -> dict[str, str]:
|
||||
def registry_bundles(registry_path: str = DATA_DIRS_FILE) -> dict[str, str]:
|
||||
"""Asset name -> description for data directories served from the release."""
|
||||
from model.safeparse import yaml_load
|
||||
|
||||
with open(registry_path, encoding="utf-8") as handle:
|
||||
registry = yaml_load(handle) or {}
|
||||
bundles: dict[str, str] = {}
|
||||
for entry in (registry.get("data_directories") or registry).values():
|
||||
for entry in data_dir_registry_at(registry_path, required=True).values():
|
||||
if not isinstance(entry, dict):
|
||||
continue
|
||||
url = str(entry.get("source_url") or "")
|
||||
|
||||
@@ -161,8 +161,7 @@ def gather_thanks(run: Run | None = None, repo: str = REPO) -> list[str]:
|
||||
("Help in issues", helped)):
|
||||
if people:
|
||||
names = [f"@{login}" for login in sorted(people, key=str.casefold)]
|
||||
listed = names[0] if len(names) == 1 else f"{', '.join(names[:-1])} and {names[-1]}"
|
||||
lines.append(f"- **{label}**: {listed}.")
|
||||
lines.append(f"- **{label}**: {series(names)}.")
|
||||
return lines
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user