Skip to content

Commit

Permalink
Resolve deprecation warning for importlib.resources.open_text
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Jan 3, 2024
1 parent dccf553 commit b50be4a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions funnel/views/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@
# --- Timezone data --------------------------------------------------------------------

# Get all known timezones from zoneinfo and make a lowercased lookup table
valid_timezones = {tz.lower(): tz for tz in zoneinfo.available_timezones()}
valid_timezones = {_tz.lower(): _tz for _tz in zoneinfo.available_timezones()}
# Get timezone aliases from tzinfo.zi and place them in the lookup table
with resources.open_text('tzdata.zoneinfo', 'tzdata.zi') as _tzdata:
with (resources.files('tzdata.zoneinfo') / 'tzdata.zi').open(
'r', encoding='utf-8', errors='strict'
) as _tzdata:
for _tzline in _tzdata.readlines():
if _tzline.startswith('L'):
_tzlink, _tznew, _tzold = _tzline.strip().split()
Expand Down

0 comments on commit b50be4a

Please sign in to comment.