/
githubmirror
/
zulip
Обзор
Документация
Войти
/
githubmirror
/
zulip
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
zerver/lib/timezone.py
19 строк
553 B
Anders Kaseorg
requirements: Remove dateutil.
10 май 2026, 10:21
10 май 2026, 10:21
d4d503f
Код
Авторство
О чём код?
from functools import cache from scripts.lib.zulip_tools import get_tzdata_zi @cache def get_canonical_timezone_map() -> dict[str, str]: canonical = {} with get_tzdata_zi() as f: for line in f: fields = line.split() if fields and "link".startswith(fields[0].lower()): # zic(8) accepts any prefix of Link _code, name, alias = fields canonical[alias] = name return canonical def canonicalize_timezone(key: str) -> str: return get_canonical_timezone_map().get(key, key)