66import logging
77from dataclasses import dataclass
88from datetime import date , timedelta
9- from typing import TYPE_CHECKING , Literal , NotRequired , TypedDict , cast
9+ from typing import TYPE_CHECKING , Literal , TypedDict , cast
1010from uuid import uuid4
1111
1212from homeassistant .config_entries import ConfigEntry
@@ -69,25 +69,6 @@ def _add_months(base: date, months: int) -> date:
6969 return date (target_year , target_month , day )
7070
7171
72- def _nth_weekday_of_month (
73- year : int , month : int , * , weekday : WeekdayIndex , occurrence : int
74- ) -> date :
75- """Return the nth weekday for a month (e.g., 2nd Tuesday)."""
76- if occurrence < 1 :
77- message = "occurrence must be >= 1"
78- raise ValueError (message )
79- first_weekday , days_in_month = calendar .monthrange (year , month )
80- offset = (weekday - first_weekday ) % 7
81- day = 1 + offset + (occurrence - 1 ) * 7
82- if day > days_in_month :
83- message = (
84- f"{ occurrence } occurrence for weekday { weekday } "
85- f"does not exist in { year } -{ month } "
86- )
87- raise ValueError (message )
88- return date (year , month , day )
89-
90-
9172@dataclass (slots = True )
9273class Recurrence :
9374 """Recurrence rule for a maintenance task."""
@@ -217,7 +198,6 @@ def to_dict(self) -> MaintTaskSerializedData:
217198 "description" : self .description ,
218199 "last_completed" : _serialize_date (self .last_completed ),
219200 "recurrence" : self .recurrence .to_dict (),
220- "next_scheduled" : _serialize_date (self .next_scheduled ),
221201 }
222202
223203 @classmethod
@@ -242,7 +222,6 @@ class MaintTaskSerializedData(TypedDict):
242222 description : str
243223 last_completed : str
244224 recurrence : RecurrenceSerialized
245- next_scheduled : NotRequired [str ]
246225
247226
248227class MaintTaskStoreData (TypedDict ):
0 commit comments