From b8144e4e713f8bd18786eb985c6fb1119542bcd1 Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Wed, 28 Oct 2026 05:59:35 +0100 Subject: [PATCH] fix: keep the region lines within the page budget The region outcome per core and per game says the BIOS each boot ran in fewer words, so the PlayStation system page stays under its visible word ceiling. --- scripts/region_check.py | 6 ++---- scripts/sitemeasurements.py | 28 +++++++++++++++------------- tests/test_region_check.py | 8 ++++---- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/scripts/region_check.py b/scripts/region_check.py index 76f509b6c..b7eff324f 100644 --- a/scripts/region_check.py +++ b/scripts/region_check.py @@ -209,13 +209,11 @@ def sentence(game_region: str, result: dict) -> str: return first + ", the other regions' BIOS do not." used = result.get("others_on") if used == BUILTIN: - return (first + ". With only the other regions' files it boots on its built-in BIOS, " - "the other regions' files were refused.") + return first + ", and on its built-in BIOS with the others' files refused." name = staged_name(used) if name: return first + f", and so does {name}, another region's BIOS." - return (first + ". With only the other regions' files staged it boots too, on a BIOS " - "its log does not name.") + return first + ", and with the others' files on a BIOS its log does not name." # -------------------------------------------------------------------------- diff --git a/scripts/sitemeasurements.py b/scripts/sitemeasurements.py index b0b3f90c1..ff5774c8e 100644 --- a/scripts/sitemeasurements.py +++ b/scripts/sitemeasurements.py @@ -550,17 +550,18 @@ OUTCOME_WORDS = {True: "boots", False: "does not boot", None: "no verdict"} def others_words(result: dict) -> str: - """What the run with only the other regions' files did, never calling a - boot the other region's BIOS unless the core's log names that file.""" + """What the run with only the other regions' files did, in a few words, + never calling a boot the other region's BIOS unless the core's log + names that file.""" boots = result.get("others_boot") if boots is not True: - return f"{OUTCOME_WORDS[boots]} with only the others" + return OUTCOME_WORDS[boots] used = result.get("others_on") if used == "builtin": - return "boots on its built-in BIOS with only the others, which were refused" + return "built-in BIOS, files refused" if used and used.startswith("staged:"): - return f"boots on {used.removeprefix('staged:')} with only the others" - return "boots with only the others, on a BIOS its log does not name" + return f"boots on {used.removeprefix('staged:')}" + return "boots, BIOS not named" def core_region_line(results: list[dict]) -> str: @@ -568,15 +569,16 @@ def core_region_line(results: list[dict]) -> str: on its own BIOS, then with only the other regions' files.""" own = {r["own_boots"] for r in results} others = {r["others_boot"] for r in results} - builtin = {r.get("others_on") for r in results} == {"builtin"} - if own == {True} and others == {True} and builtin: - return ("Each region's game boots on its own BIOS. With only the other regions' files it " - "boots on its built-in BIOS: those files were refused.") + used = {r.get("others_on") or "unknown" for r in results} + if own == {True} and others == {True} and used == {"builtin"}: + return "Each region's game boots on its own BIOS, and on its built-in BIOS with the others' files refused." + if own == {True} and others == {True} and all(u.startswith("staged:") for u in used): + return "Each region's game boots on its own BIOS, and on another region's file the log names." if own == {True} and others == {False}: return "Each region's game boots on its own BIOS only." - parts = [f"{REGION_SHORT.get(r['region'], r['region'])} game: {OUTCOME_WORDS[r['own_boots']]} " - f"on its BIOS, {others_words(r)}" for r in results] - return ", ".join(parts) + "." + parts = [f"{REGION_SHORT.get(r['region'], r['region'])}: {OUTCOME_WORDS[r['own_boots']]}, " + f"with the others {others_words(r)}" for r in results] + return ". ".join(parts) + "." def region_section(results: list[dict], level: int = 3) -> list[str]: diff --git a/tests/test_region_check.py b/tests/test_region_check.py index daae9a42e..09df7c33c 100644 --- a/tests/test_region_check.py +++ b/tests/test_region_check.py @@ -148,8 +148,8 @@ class Outcome(unittest.TestCase): result = rc.outcome(records, self.ENTRIES, "europe") # The log names no BIOS: the boot is not said to be the other region's. self.assertEqual(rc.sentence("europe", result), - "The European BIOS boots the European game. With only the other regions' files " - "staged it boots too, on a BIOS its log does not name.") + "The European BIOS boots the European game, and with the others' files on a " + "BIOS its log does not name.") records["others"] = record("x", ["scph5501.bin"], ["scph5501.bin"], [[0, "a"]], "boots", bios_used="staged:scph5501.bin") self.assertEqual(rc.sentence("europe", rc.outcome(records, self.ENTRIES, "europe")), @@ -167,8 +167,8 @@ class Outcome(unittest.TestCase): [[0, "a"]], "boots", bios_used="builtin")} result = rc.outcome(records, self.ENTRIES, "north-america") text = rc.sentence("north-america", result) - self.assertEqual(text, "The US BIOS boots the US game. With only the other regions' files it " - "boots on its built-in BIOS, the other regions' files were refused.") + self.assertEqual(text, "The US BIOS boots the US game, and on its built-in BIOS with the " + "others' files refused.") self.assertNotIn("so do the other regions", text) import sitemeasurements as sm line = sm.core_region_line([result])