Skip to content

Commit

Permalink
[deps-] make zoneinfo an optional dependency
Browse files Browse the repository at this point in the history
Add missing backport dep #2094

Thanks @pacien!
  • Loading branch information
anjakefala committed Oct 30, 2023
1 parent 5f77e12 commit dd67e97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ psutil # procmgr
numpy # npy pandas hdf5 arrow
tomli; python_version < '3.11' # toml
pyconll # conll/conllu
backports.zoneinfo; python_version < '3.9' #f5log

requests_cache # scraper
beautifulsoup4 # scraper
Expand Down
8 changes: 4 additions & 4 deletions visidata/loaders/f5log.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
from datetime import datetime, timedelta
from ipaddress import ip_address

try:
import zoneinfo
except ImportError:
from backports import zoneinfo
import re
import traceback
from typing import Any, Dict, Optional
Expand Down Expand Up @@ -1043,6 +1039,10 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# the default F5 logs don't have the year so we have to guess from the file ctime
# TODO: make this overridable
try:
import zoneinfo
except ImportError:
from backports import zoneinfo
self._log_tz = zoneinfo.ZoneInfo("UTC")
try:
self._year = int(
Expand Down

0 comments on commit dd67e97

Please sign in to comment.