misc: replace uses of pytz.utc with timezone.utc where it makes sense

This commit is contained in:
Dima Gerasimov 2023-06-09 03:04:54 +01:00
parent f38a21ba41
commit dba1fb64ee
9 changed files with 24 additions and 42 deletions

View file

@ -4,11 +4,9 @@ Github events and their metadata: comments/issues/pull requests
from ..core import __NOT_HPI_MODULE__
from datetime import datetime
from datetime import datetime, timezone
from typing import Optional, NamedTuple, Iterable, Set, Tuple
import pytz
from ..core import warn_if_empty, LazyLogger
from ..core.error import Res
@ -48,7 +46,7 @@ def merge_events(*sources: Results) -> Results:
def parse_dt(s: str) -> datetime:
# TODO isoformat?
return pytz.utc.localize(datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ'))
return datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=timezone.utc)
# experimental way of supportint event ids... not sure