Skip to content

Commit 3c6e208

Browse files
committed
pruning
1 parent 57948e1 commit 3c6e208

File tree

2 files changed

+4
-14
lines changed

2 files changed

+4
-14
lines changed

appdaemon/utils.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -377,17 +377,6 @@ def format_timedelta(td: str | int | float | timedelta | None) -> str:
377377
return res
378378

379379

380-
def parse_offset(input_: str) -> timedelta:
381-
if m := re.search(r"\s+(?P<sign>[+-])\s+", input_):
382-
offset = parse_timedelta(input_[m.span()[1]:])
383-
match m.group("sign"):
384-
case "-":
385-
offset *= -1
386-
case "+":
387-
pass
388-
return offset
389-
390-
391380
def now_is_between(
392381
now: datetime,
393382
start_time: str | time | datetime,

tests/unit/datetime/test_parse_datetime.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
from functools import partial
33
from typing import Literal
44

5-
import appdaemon.parse
65
import pytest
7-
from appdaemon import utils
86
from astral import SunDirection
97
from astral.location import Location
108
from pytz import BaseTzInfo
119

10+
import appdaemon.parse
11+
from appdaemon.parse import resolve_time_str
12+
1213
from .utils import ParameterBuilder
1314

1415
pytestmark = [
@@ -73,7 +74,7 @@ def test_parse_sun_offsets(
7374
assert result.tzinfo is not None
7475

7576
type_ = input_.split()[0]
76-
offset = utils.parse_offset(input_)
77+
_, offset = resolve_time_str(input_, now=now, location=location)
7778

7879
match now_str, when, type_:
7980
case (_, "today", "sunrise"):

0 commit comments

Comments
 (0)