1717import warnings
1818from collections import defaultdict
1919from datetime import datetime , timedelta , timezone
20- from typing import TYPE_CHECKING , Any , Optional
20+ from typing import TYPE_CHECKING , Any , ClassVar , Optional
2121from urllib .parse import ParseResult , SplitResult
2222
2323import icalendar
2424from dateutil .rrule import rrulestr
2525from icalendar import vCalAddress , vText
2626
27- try :
28- from typing import ClassVar , Optional
29-
30- TimeStamp = Optional [date | datetime ]
31- except :
32- pass
33-
3427if TYPE_CHECKING :
3528 from icalendar import vCalAddress
3629
@@ -142,9 +135,7 @@ def __init__(
142135 CalendarObjectResource has an additional parameter for its constructor:
143136 * data = "...", vCal data for the event
144137 """
145- super (CalendarObjectResource , self ).__init__ (
146- client = client , url = url , parent = parent , id = id , props = props
147- )
138+ super ().__init__ (client = client , url = url , parent = parent , id = id , props = props )
148139 if data is not None :
149140 self .data = data
150141 if id and self ._get_component_type_cheap ():
@@ -871,9 +862,9 @@ def _put(self, retry_on_failure=True):
871862 except ImportError :
872863 retry_on_failure = False
873864 if retry_on_failure :
874- ## This looks like a noop, but the object may be "cleaned" .
865+ ## Accessing vobject_instance may "clean" the object.
875866 ## See https://github.com/python-caldav/caldav/issues/43
876- self .vobject_instance
867+ self .get_vobject_instance ()
877868 return self ._put (False )
878869 else :
879870 raise error .PutError (errmsg (r ))
@@ -895,7 +886,7 @@ async def _async_put(self, retry_on_failure=True):
895886 except ImportError :
896887 retry_on_failure = False
897888 if retry_on_failure :
898- self .vobject_instance
889+ self .get_vobject_instance ()
899890 return await self ._async_put (False )
900891 else :
901892 raise error .PutError (errmsg (r ))
@@ -950,7 +941,10 @@ def change_attendee_status(self, attendee: Any | None = None, **kwargs) -> None:
950941 attendee_lines = ical_obj ["attendee" ]
951942 if isinstance (attendee_lines , str ):
952943 attendee_lines = [attendee_lines ]
953- strip_mailto = lambda x : str (x ).lower ().replace ("mailto:" , "" )
944+
945+ def strip_mailto (x ):
946+ return str (x ).lower ().replace ("mailto:" , "" )
947+
954948 for attendee_line in attendee_lines :
955949 if strip_mailto (attendee_line ) == strip_mailto (attendee ):
956950 attendee_line .params .update (kwargs )
@@ -1855,7 +1849,7 @@ def is_pending(self, i=None) -> bool | None:
18551849 if i .get ("STATUS" , "NEEDS-ACTION" ) in ("CANCELLED" , "COMPLETED" ):
18561850 return False
18571851 ## input data does not conform to the RFC
1858- assert False
1852+ raise AssertionError
18591853
18601854 def uncomplete (self ) -> None :
18611855 """Undo completion - marks a completed task as not completed"""
0 commit comments