1
0
mirror of https://github.com/b4tman/sync_ics2gcal synced 2026-03-05 04:54:14 +00:00

ical: fix Optional[Calendar] to Calendar cast

This commit is contained in:
2026-03-01 11:53:13 +03:00
committed by Dmitry Belyaev
parent caa7b388a1
commit a5967b1043

View File

@@ -1,6 +1,6 @@
import datetime
import logging
from typing import Union, Dict, Callable, Optional, Mapping, TypedDict
from typing import Union, Dict, Callable, Optional, Mapping, TypedDict, cast
from icalendar import Calendar, Event
from pytz import utc
@@ -192,7 +192,10 @@ class CalendarConverter:
def events_to_gcal(self) -> EventList:
"""Convert events to google calendar resources"""
calendar: Calendar = self.calendar
if self.calendar is None:
raise ValueError("calendar not set")
calendar: Calendar = cast(Calendar, self.calendar)
ics_events = calendar.walk(name="VEVENT")
self.logger.info("%d events read", len(ics_events))