@@ -311,7 +311,7 @@ def _get_rrules(self: Component) -> list[vRecur]:
311311
312312
313313def multi_language_text_property (
314- main_prop : str , compatibility_prop : str | None , doc : str
314+ main_prop : str , compatibility_prop : Optional [ str ] , doc : str
315315) -> property :
316316 """This creates a text property.
317317
@@ -323,7 +323,7 @@ def multi_language_text_property(
323323 doc (str): The documentation string
324324 """
325325
326- def fget (self : Component ) -> str | None :
326+ def fget (self : Component ) -> Optional [ str ] :
327327 """Get the property"""
328328 result = self .get (main_prop )
329329 if result is None and compatibility_prop is not None :
@@ -334,7 +334,7 @@ def fget(self: Component) -> str | None:
334334 return item
335335 return result
336336
337- def fset (self : Component , value : str | None ):
337+ def fset (self : Component , value : Optional [ str ] ):
338338 """Set the property."""
339339 fdel (self )
340340 if value is not None :
@@ -365,7 +365,7 @@ def fget(self: Component) -> int:
365365 except ValueError as e :
366366 raise InvalidCalendar (f"{ prop } must be an int" ) from e
367367
368- def fset (self : Component , value : int | None ):
368+ def fset (self : Component , value : Optional [ int ] ):
369369 """Set the property."""
370370 fdel (self )
371371 if value is not None :
@@ -393,7 +393,7 @@ def single_utc_property(name: str, docs: str) -> property:
393393 + docs
394394 )
395395
396- def fget (self : Component ) -> datetime | None :
396+ def fget (self : Component ) -> Optional [ datetime ] :
397397 """Get the value."""
398398 if name not in self :
399399 return None
@@ -407,7 +407,7 @@ def fget(self: Component) -> datetime | None:
407407 raise InvalidCalendar (f"{ name } must be a datetime in UTC, not { value } " )
408408 return tzp .localize_utc (value )
409409
410- def fset (self : Component , value : datetime | None ):
410+ def fset (self : Component , value : Optional [ datetime ] ):
411411 """Set the value"""
412412 if value is None :
413413 fdel (self )
@@ -425,7 +425,7 @@ def fdel(self: Component):
425425
426426
427427def single_string_property (
428- name : str , docs : str , other_name : str | None = None , default : str = ""
428+ name : str , docs : str , other_name : Optional [ str ] = None , default : str = ""
429429) -> property :
430430 """Create a property to access a single string value."""
431431
@@ -440,7 +440,7 @@ def fget(self: Component) -> str:
440440 return result [0 ]
441441 return result
442442
443- def fset (self : Component , value : str | None ):
443+ def fset (self : Component , value : Optional [ str ] ):
444444 """Set the value.
445445
446446 Setting the value to None will delete it.
@@ -560,7 +560,7 @@ def fdel(self: Component):
560560
561561def _get_categories (component : Component ) -> list [str ]:
562562 """Get all the categories."""
563- categories : vCategory | list [vCategory ] | None = component .get ("CATEGORIES" )
563+ categories : Optional [ vCategory | list [vCategory ]] = component .get ("CATEGORIES" )
564564 if isinstance (categories , list ):
565565 _set_categories (
566566 component ,
@@ -573,7 +573,7 @@ def _get_categories(component: Component) -> list[str]:
573573 return categories .cats
574574
575575
576- def _set_categories (component : Component , cats : Sequence [str ] | None ) -> None :
576+ def _set_categories (component : Component , cats : Optional [ Sequence [str ]] ) -> None :
577577 """Set the categories."""
578578 if not cats and cats != []:
579579 _del_categories (component )
@@ -871,7 +871,7 @@ def _del_attendees(self: Component):
871871
872872def create_single_property (
873873 prop : str ,
874- value_attr : str | None ,
874+ value_attr : Optional [ str ] ,
875875 value_type : tuple [type ],
876876 type_def : type ,
877877 doc : str ,
@@ -945,7 +945,7 @@ def p_del(self: Component):
945945)
946946
947947
948- def property_get_duration (self : Component ) -> timedelta | None :
948+ def property_get_duration (self : Component ) -> Optional [ timedelta ] :
949949 """Getter for property DURATION."""
950950 default = object ()
951951 duration = self .get ("duration" , default )
@@ -960,7 +960,7 @@ def property_get_duration(self: Component) -> timedelta | None:
960960 return None
961961
962962
963- def property_set_duration (self : Component , value : timedelta | None ):
963+ def property_set_duration (self : Component , value : Optional [ timedelta ] ):
964964 """Setter for property DURATION."""
965965 if value is None :
966966 self .pop ("duration" , None )
@@ -1015,7 +1015,7 @@ def fget(self: Component) -> list[str]:
10151015 return [descriptions ]
10161016 return descriptions
10171017
1018- def fset (self : Component , values : str | Sequence [str ] | None ):
1018+ def fset (self : Component , values : Optional [ str | Sequence [str ]] ):
10191019 """Set the values."""
10201020 fdel (self )
10211021 if values is None :
@@ -1087,7 +1087,7 @@ def fdel(self: Component):
10871087)
10881088
10891089
1090- def _get_organizer (self : Component ) -> vCalAddress | None :
1090+ def _get_organizer (self : Component ) -> Optional [ vCalAddress ] :
10911091 """ORGANIZER defines the organizer for a calendar component.
10921092
10931093 Property Parameters:
@@ -1126,7 +1126,7 @@ def _get_organizer(self: Component) -> vCalAddress | None:
11261126 return self .get ("ORGANIZER" )
11271127
11281128
1129- def _set_organizer (self : Component , value : vCalAddress | str | None ):
1129+ def _set_organizer (self : Component , value : Optional [ vCalAddress | str ] ):
11301130 """Set the value."""
11311131 _del_organizer (self )
11321132 if value is not None :
@@ -1448,7 +1448,7 @@ def timezone_datetime_property(name: str, docs: str):
14481448
14491449
14501450@property
1451- def rfc_7953_duration_property (self ) -> timedelta | None :
1451+ def rfc_7953_duration_property (self ) -> Optional [ timedelta ] :
14521452 """Compute the duration of this component.
14531453
14541454 If there is no :attr:`DTEND` or :attr:`DURATION` set, this is None.
@@ -1471,7 +1471,7 @@ def rfc_7953_duration_property(self) -> timedelta | None:
14711471
14721472
14731473@property
1474- def rfc_7953_end_property (self ) -> timedelta | None :
1474+ def rfc_7953_end_property (self ) -> Optional [ timedelta ] :
14751475 """Compute the duration of this component.
14761476
14771477 If there is no :attr:`DTEND` or :attr:`DURATION` set, this is None.
0 commit comments