Merge branch 'main' into seasons-ship-3

This commit is contained in:
swaits committed 2026-11-20 11:35:19 -07:00
commit 072d568977
53 files changed
+811 -19

No files matched your search

+16 -5
View File
@@ -41,20 +41,31 @@ def check_season(tid, hike, errors):
errors.append(
f"{tid}: hike.season_basis must be one of {', '.join(BASES)}, not {basis!r}")
if basis == "estimate":
if has_method:
method = hike.get("season_method")
if not isinstance(method, str) or not method.strip():
errors.append(f"{tid}: hike.season_method is required with season_basis \"estimate\"")
if basis not in ("estimate", "sources"):
errors.append(
f"{tid}: hike.season_method is only given with season_basis \"estimate\" "
"or \"sources\"")
elif not isinstance(method, str) or not method.strip():
errors.append(f"{tid}: hike.season_method must not be empty")
elif len(method) >= 400:
errors.append(f"{tid}: hike.season_method must be under 400 characters")
elif has_method:
errors.append(f"{tid}: hike.season_method is only given with season_basis \"estimate\"")
elif basis == "estimate":
errors.append(f"{tid}: hike.season_method is required with season_basis \"estimate\"")
naming_season = _naming(sources, "season")
if basis in ("primary", "source"):
if not naming_season:
errors.append(
f"{tid}: hike.season_basis \"{basis}\" needs a [[hike.source]] naming season")
elif basis == "source":
publishers = {str(s.get("publisher", "")).strip().casefold()
for s in naming_season}
if len(publishers) != 1:
errors.append(
f"{tid}: hike.season_basis \"source\" needs exactly one publisher "
"naming season (two or more is \"sources\")")
elif basis == "sources":
publishers = {str(s.get("publisher", "")).strip().casefold()
for s in naming_season if str(s.get("publisher", "")).strip()}