From 61e84bd8747b06c273d76edbedda4a9da64f2dcf Mon Sep 17 00:00:00 2001 From: Sean Breckenridge Date: Tue, 26 Apr 2022 12:39:40 -0700 Subject: [PATCH] make via_location stats a bit more configurable --- my/time/tz/via_location.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/my/time/tz/via_location.py b/my/time/tz/via_location.py index abfe8c2..5f3c239 100644 --- a/my/time/tz/via_location.py +++ b/my/time/tz/via_location.py @@ -200,11 +200,13 @@ def stats() -> Stats: # TODO not sure what would be a good stat() for this module... # might be nice to print some actual timezones? # there aren't really any great iterables to expose + import os + VIA_LOCATION_START_YEAR = int(os.environ.get("VIA_LOCATION_START_YEAR", 1990)) def localized_years(): last = datetime.now().year + 2 # note: deliberately take + 2 years, so the iterator exhausts. otherwise stuff might never get cached # need to think about it... - for Y in range(1990, last): + for Y in range(VIA_LOCATION_START_YEAR, last): dt = datetime.fromisoformat(f'{Y}-01-01 01:01:01') yield localize(dt) return stat(localized_years)