Skip to content

Commit 57948e1

Browse files
committed
Merge branch 'datetime-parsing'
1 parent c605b3b commit 57948e1

File tree

9 files changed

+690
-392
lines changed

9 files changed

+690
-392
lines changed

appdaemon/adapi.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from appdaemon.events import EventCallback
2323
from appdaemon.logging import Logging
2424
from appdaemon.models.config.app import AppConfig
25+
from appdaemon.parse import resolve_time_str
2526
from appdaemon.state import StateCallback
2627

2728
T = TypeVar("T")
@@ -241,7 +242,7 @@ def log(
241242
stack_info: bool = False,
242243
stacklevel: int = 1,
243244
extra: Mapping[str, object] | None = None,
244-
**kwargs,
245+
**kwargs: Any,
245246
) -> None:
246247
"""Logs a message to AppDaemon's main logfile.
247248
@@ -2443,7 +2444,6 @@ async def parse_time(
24432444
"""
24442445
return await self.AD.sched.parse_time(
24452446
time_str=time_str,
2446-
name=name or self.name,
24472447
aware=aware,
24482448
today=today,
24492449
days_offset=days_offset,
@@ -2508,7 +2508,6 @@ async def parse_datetime(
25082508
"""
25092509
return await self.AD.sched.parse_datetime(
25102510
input_=time_str,
2511-
name=name or self.name,
25122511
aware=aware,
25132512
today=today,
25142513
days_offset=days_offset,
@@ -2537,18 +2536,6 @@ async def get_now_ts(self, aware: bool = False) -> float:
25372536
"""
25382537
return (await self.get_now(aware)).timestamp()
25392538

2540-
@overload
2541-
@utils.sync_decorator
2542-
async def now_is_between(self, start_time: str, end_time: str) -> bool: ...
2543-
2544-
@overload
2545-
@utils.sync_decorator
2546-
async def now_is_between(self, start_time: str, end_time: str, name: str) -> bool: ...
2547-
2548-
@overload
2549-
@utils.sync_decorator
2550-
async def now_is_between(self, start_time: str, end_time: str, now: str) -> bool: ...
2551-
25522539
@utils.sync_decorator
25532540
async def now_is_between(
25542541
self,
@@ -2977,7 +2964,7 @@ async def run_at(
29772964
raise ValueError(f"Invalid sun event: {start_str}")
29782965

29792966
now = await self.get_now() # type: ignore
2980-
_, offset = utils.parse_time_str(start_str, now=now, location=self.AD.sched.location)
2967+
_, offset = resolve_time_str(start_str, now=now, location=self.AD.sched.location)
29812968
func = functools.partial(func, *args, repeat=True, offset=offset)
29822969
case _:
29832970
start = await self.AD.sched.parse_datetime(start, aware=True)
@@ -3069,7 +3056,7 @@ async def run_daily(
30693056
raise ValueError(f"Invalid sun event: {start_str}")
30703057

30713058
now = await self.get_now() # type: ignore
3072-
_, offset = utils.parse_time_str(start_str, now=now, location=self.AD.sched.location)
3059+
_, offset = resolve_time_str(start_str, now=now, location=self.AD.sched.location)
30733060
func = functools.partial(func, callback, *args, repeat=True, offset=offset)
30743061
case _:
30753062
func = functools.partial(

0 commit comments

Comments
 (0)