Skip to content

Commit

Permalink
Remove pytz from the list of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Nov 19, 2021
1 parent 8d117d2 commit e384b71
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
5 changes: 2 additions & 3 deletions grafanimate/model.py
Expand Up @@ -3,11 +3,10 @@
# License: GNU Affero General Public License, Version 3
import dataclasses
import logging
from datetime import datetime
from datetime import datetime, timezone
from enum import Enum
from typing import Generator, List, Optional, Union

import pytz
from dataclass_property import dataclass
from dateutil.rrule import rrule

Expand Down Expand Up @@ -42,7 +41,7 @@ class AnimationSequence:
def __post_init__(self):

# Convert start/stop timestamps, resolving relative timestamps.
now = datetime.now(tz=pytz.UTC)
now = datetime.now(tz=timezone.utc)
self._start = convert_input_timestamp(self.__start, relative_to=now)
if isinstance(self.__stop, str) and self.__stop.startswith("start"):
stop = self.__stop.replace("start", "")
Expand Down
4 changes: 2 additions & 2 deletions grafanimate/timecontrol.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# (c) 2019 Andreas Motl <andreas@hiveeyes.org>
# License: GNU Affero General Public License, Version 3
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone

from datetime_interval import Interval

Expand Down Expand Up @@ -89,7 +89,7 @@ def print_header(title):


def create_dope_sheet_blueprint():
now = datetime.now()
now = datetime.now(tz=timezone.utc)
yesterday = now - timedelta(days=1)
tomorrow = now + timedelta(days=1)

Expand Down
5 changes: 2 additions & 3 deletions grafanimate/timeutil.py
Expand Up @@ -2,11 +2,10 @@
# (c) 2018-2021 Andreas Motl <andreas.motl@panodata.org>
# License: GNU Affero General Public License, Version 3
import dataclasses
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import Optional, Union

import dateutil.parser
import pytz
from dateutil.relativedelta import relativedelta
from dateutil.rrule import DAILY, HOURLY, MINUTELY, MONTHLY, SECONDLY, WEEKLY, YEARLY
from pytimeparse2 import parse as parse_human_time
Expand Down Expand Up @@ -198,7 +197,7 @@ def convert_input_timestamp(value: Union[datetime, str], relative_to: Optional[d
"""
if isinstance(value, str):
if value == "now":
return datetime.now(tz=pytz.UTC)
return datetime.now(tz=timezone.utc)
try:
delta = parse_human_time(value)
if not delta:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Expand Up @@ -20,7 +20,6 @@
"python-dateutil>=2.7,<3",
"datetime-interval==0.2",
"pytimeparse2>=1.3,<2",
"pytz>=2021.3",
]

extras = {
Expand Down

0 comments on commit e384b71

Please sign in to comment.