icalendar.attr module#
Attributes of Components and properties.
- icalendar.attr.create_single_property(prop: str, value_attr: str | None, value_type: tuple[type], type_def: type, doc: str, vProp: type = <class 'icalendar.prop.vDDDTypes'>)[source]#
Create a single property getter and setter.
- Parameters:
prop – The name of the property.
value_attr – The name of the attribute to get the value from.
value_type – The type of the value.
type_def – The type of the property.
doc – The docstring of the property.
vProp – The type of the property from
icalendar.prop.
- icalendar.attr.get_duration_property(component: Component) timedelta[source]#
Get the duration property with fallback calculation from start and end.
- Parameters:
component – The component from which to get its duration property.
- Returns:
The duration as a timedelta.
- icalendar.attr.get_end_property(component: Component, end_property: str) date | datetime[source]#
Get the end property with fallback logic for
EventandTodocomponents.- Parameters:
component – The component to get end from
end_property – The end property name, either
DTENDforEventorDUEforTodo.
- Returns:
The computed end value.
- Raises:
IncompleteComponent – If the provided information is incomplete to compute the end property.
- icalendar.attr.get_start_end_duration_with_validation(component: Component, start_property: str, end_property: str, component_name: str) tuple[date | datetime | None, date | datetime | None, timedelta | None][source]#
Validate the component and return start, end, and duration.
This tests validity according to RFC 5545 rules for
EventandTodocomponents.- Parameters:
component – The component to validate, either
EventorTodo.start_property – The start property name,
DTSTART.end_property – The end property name, either
DTENDforEventorDUEforTodo.component_name – The component name for error messages, either
VEVENTorVTODO.
- Returns:
(start, end, duration) values from the component.
- Return type:
- Raises:
InvalidCalendar – If the component violates RFC 5545 constraints.
- icalendar.attr.get_start_property(component: Component) date | datetime[source]#
Get the start property with validation.
- Parameters:
component – The component from which to get its start property.
- Returns:
The
DTSTARTvalue.- Raises:
IncompleteComponent – If no
DTSTARTis present.
- icalendar.attr.multi_language_text_property(main_prop: str, compatibility_prop: str | None, doc: str) property[source]#
This creates a text property.
This property can be defined several times with different
LANGUAGEparameters.
- icalendar.attr.multi_string_property(name: str, doc: str)[source]#
A property for an iCalendar Property that can occur multiple times.
- icalendar.attr.property_get_duration(self: Component) timedelta | None[source]#
Getter for property DURATION.
- icalendar.attr.property_set_duration(self: Component, value: timedelta | None)[source]#
Setter for property DURATION.
- icalendar.attr.set_duration_with_locking(component: Component, duration: timedelta | None, locked: Literal['start', 'end'], end_property: str) None[source]#
Set the duration with explicit locking behavior for
EventandTodo.- Parameters:
component – The component to modify, either
EventorTodo.duration – The duration to set, or
Noneto convert toDURATIONproperty.locked – Which property to keep unchanged, either
startorend.end_property – The end property name, either
DTENDforEventorDUEforTodo.
- icalendar.attr.set_end_with_locking(component: Component, end: date | datetime, locked: Literal['start', 'duration'], end_property: str) None[source]#
Set the end with explicit locking behavior for Event and Todo components.
- Parameters:
component – The component to modify, either
EventorTodo.end – The end time to set.
locked – Which property to keep unchanged, either
startorduration.end_property – The end property name, either
DTENDforEventorDUEforTodo.
- icalendar.attr.set_start_with_locking(component: Component, start: date | datetime, locked: Literal['duration', 'end'] | None, end_property: str) None[source]#
Set the start with explicit locking behavior for
EventandTodocomponents.- Parameters:
component – The component to modify, either
EventorTodo.start – The start time to set.
locked – Which property to keep unchanged, either
duration,end, orNonefor auto-detect.end_property – The end property name, either
DTENDforEventorDUEforTodo.