From bcdb4c3b788deec0551cc468dfaa3b9be7aa52d4 Mon Sep 17 00:00:00 2001 From: saphid <4596216+saphid@users.noreply.github.com> Date: Wed, 14 Oct 2026 13:01:46 +1100 Subject: [PATCH] Usage statistics: no country for clock-rule zones, and Johnston Atoll is UM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From review: EET and WET link to Athens and Lisbon but name clock rules, not Greece or Portugal, so they and the other rule names (CET, EST5EDT, …) send nothing. Pacific/Johnston has left zone.tab, which made its Honolulu group look only American; it's set to UM by hand. Co-Authored-By: Claude Opus 5.5 --- scripts/timezones.py | 9 ++++++++- tests/test_telemetry.py | 4 +++- ui/frame_timezones.py | 9 +-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/scripts/timezones.py b/scripts/timezones.py index 9f60016..e11a9ab 100644 --- a/scripts/timezones.py +++ b/scripts/timezones.py @@ -34,9 +34,16 @@ def resolve(z): countries_of = {} for zone, cc in country.items(): countries_of.setdefault(resolve(zone), set()).add(cc) +# Clock rules rather than places (EET links to Athens, WET to Lisbon): no country. +GENERIC = {'CET', 'EET', 'MET', 'WET', 'EST', 'MST', 'HST', 'CST6CDT', 'EST5EDT', 'MST7MDT', 'PST8PDT'} +# Places that have left zone.tab, so their target's group looks like another country's. +PLACES = {'Pacific/Johnston': 'UM'} dropped = [] for alias in links: - if alias in country: + if alias in country or alias in GENERIC or alias.startswith('Etc/'): + continue + if alias in PLACES: + country[alias] = PLACES[alias] continue ccs = countries_of.get(resolve(alias), set()) if len(ccs) == 1: diff --git a/tests/test_telemetry.py b/tests/test_telemetry.py index 2a15a74..7fca09a 100644 --- a/tests/test_telemetry.py +++ b/tests/test_telemetry.py @@ -172,7 +172,9 @@ class Lifecycle(Base): for tz, want in (("America/Argentina/Buenos_Aires", "AR"), ("Asia/Calcutta", "IN"), ("US/Pacific", "US"), ("Europe/Vaduz", "LI"), ("Africa/Asmera", "ER"), ("Africa/Asmara", "ER"), ("Pacific/Truk", "FM"), ("Pacific/Ponape", "FM"), ("America/Montreal", "CA"), ("America/Nassau", "BS"), - ("Europe/Amsterdam", "NL"), ("Etc/GMT+10", None), ("CET", None), ("UTC", None), ("alice", None), + ("Europe/Amsterdam", "NL"), ("Etc/GMT+10", None), ("CET", None), + ("EET", None), ("WET", None), ("PST8PDT", None), ("HST", None), ("Pacific/Johnston", "UM"), + ("Japan", "JP"), ("UTC", None), ("alice", None), ("home/alex/private", None), ("America/alex", None), ("../etc/passwd", None)): with mock.patch.dict(os.environ, {"FRAME_CONTROL_TIMEZONE": tz}): self.assertEqual(tm.country(), want, tz) diff --git a/ui/frame_timezones.py b/ui/frame_timezones.py index 35621e2..5b05936 100644 --- a/ui/frame_timezones.py +++ b/ui/frame_timezones.py @@ -376,7 +376,6 @@ COUNTRY = { 'Brazil/DeNoronha': 'BR', 'Brazil/East': 'BR', 'Brazil/West': 'BR', - 'CST6CDT': 'US', 'Canada/Atlantic': 'CA', 'Canada/Central': 'CA', 'Canada/Eastern': 'CA', @@ -388,8 +387,6 @@ COUNTRY = { 'Chile/Continental': 'CL', 'Chile/EasterIsland': 'CL', 'Cuba': 'CU', - 'EET': 'GR', - 'EST5EDT': 'US', 'Egypt': 'EG', 'Eire': 'IE', 'Europe/Amsterdam': 'NL', @@ -458,7 +455,6 @@ COUNTRY = { 'Europe/Zurich': 'CH', 'GB': 'GB', 'GB-Eire': 'GB', - 'HST': 'US', 'Hongkong': 'HK', 'Iceland': 'IS', 'Indian/Antananarivo': 'MG', @@ -478,7 +474,6 @@ COUNTRY = { 'Japan': 'JP', 'Kwajalein': 'MH', 'Libya': 'LY', - 'MST7MDT': 'US', 'Mexico/BajaNorte': 'MX', 'Mexico/BajaSur': 'MX', 'Mexico/General': 'MX', @@ -486,7 +481,6 @@ COUNTRY = { 'NZ-CHAT': 'NZ', 'Navajo': 'US', 'PRC': 'CN', - 'PST8PDT': 'US', 'Pacific/Apia': 'WS', 'Pacific/Auckland': 'NZ', 'Pacific/Bougainville': 'PG', @@ -503,7 +497,7 @@ COUNTRY = { 'Pacific/Guadalcanal': 'SB', 'Pacific/Guam': 'GU', 'Pacific/Honolulu': 'US', - 'Pacific/Johnston': 'US', + 'Pacific/Johnston': 'UM', 'Pacific/Kanton': 'KI', 'Pacific/Kiritimati': 'KI', 'Pacific/Kosrae': 'FM', @@ -550,5 +544,4 @@ COUNTRY = { 'US/Pacific': 'US', 'US/Samoa': 'AS', 'W-SU': 'RU', - 'WET': 'PT', }