Component#

class Component(**properties: Any)#

Superclasses: Object, Object

This is the ICalComponent instance.

Constructors#

class Component
classmethod new(kind: ComponentKind) Component#

Creates a new Component with specific type.

Added in version 1.0.

Parameters:

kind – The ComponentKind

classmethod new_from_string(str: str) Component#

Creates a new Component based on a string.

Added in version 1.0.

Parameters:

str – The string used to create Component

classmethod new_vagenda() Component#

Creates a Component with the type to be vagenda.

Added in version 1.0.

classmethod new_valarm() Component#

Creates a Component with the type to be valarm.

Added in version 1.0.

classmethod new_vavailability() Component#

Creates a Component with the type to be vavailability.

Added in version 1.0.

classmethod new_vcalendar() Component#

Creates a Component with the type to be vcalendar.

Added in version 1.0.

classmethod new_vevent() Component#

Creates a Component with the type to be vevent.

Added in version 1.0.

classmethod new_vfreebusy() Component#

Creates a Component with the type to be vfreebusy.

Added in version 1.0.

classmethod new_vjournal() Component#

Creates a Component with the type to be vjournal.

Added in version 1.0.

classmethod new_vpoll() Component#

Creates a Component with the type to be vpoll.

Added in version 1.0.

classmethod new_vquery() Component#

Creates a Component with the type to be vquery.

Added in version 1.0.

classmethod new_vtimezone() Component#

Creates a Component with the type to be vtimezone.

Added in version 1.0.

classmethod new_vtodo() Component#

Creates a Component with the type to be vtodo.

Added in version 1.0.

classmethod new_vvoter() Component#

Creates a Component with the type to be vvoter.

Added in version 1.0.

classmethod new_x(x_name: str) Component#

Creates a new Component based on name of x property.

Added in version 1.0.

Parameters:

x_name – The name of x property

classmethod new_xavailable() Component#

Creates a Component with the type to be xavailable.

Added in version 1.0.

classmethod new_xdaylight() Component#

Creates a Component with the type to be xdaylight.

Added in version 1.0.

classmethod new_xstandard() Component#

Creates a Component with the type to be xstandard.

Added in version 1.0.

classmethod new_xvote() Component#

Creates a Component with the type to be xvote.

Added in version 1.0.

Methods#

class Component
add_component(child: Component) None#

Adds a Component into another Component as a child component.

Added in version 1.0.

Parameters:

child – A child Component

add_property(property: Property) None#

Adds an Property into Component.

Added in version 1.0.

Parameters:

property – An Property

as_ical_string() str#

Converts a Component to a string.

Added in version 1.0.

begin_component(kind: ComponentKind) CompIter#

Gets the CompIter pointing to the first child Component.

Added in version 1.0.

Parameters:

kind – A ComponentKind

check_restrictions() int#

Checks the number of restrictions in Component.

Added in version 1.0.

clone() Component#

Deeply clone a Component.

Added in version 1.0.

convert_errors() None#

Converts some X-LIC-ERROR properties into RETURN-STATUS properties.

Added in version 1.0.

count_components(kind: ComponentKind) int#

Counts the child Component with the target kind in the parent one.

Added in version 1.0.

Parameters:

kind – The target ComponentKind

count_errors() int#

Counts the number of errors in Component.

Added in version 1.0.

count_properties(kind: PropertyKind) int#

Counts the number of Property in Component.

Added in version 1.0.

Parameters:

kind – A PropertyKind

end_component(kind: ComponentKind) CompIter#

Gets the CompIter pointing to the end child Component.

Added in version 1.0.

Parameters:

kind – A ComponentKind

foreach_recurrence(start: Time, end: Time, callback: Callable[[Component, TimeSpan, Any], None], user_data: Any = None) None#

Cycles through all recurrences of an event. This function will call the specified callback function for once for the base value of DTSTART, and foreach recurring date/time value. It will filter out events that are specified as an EXDATE or an EXRULE.

Added in version 3.0.5.

Parameters:
  • start – Ignore timespans before this

  • end – Ignore timespans after this

  • callback – Function called for each timespan within the range

  • user_data – The user data for callback function

foreach_tzid(callback: Callable[[Parameter, Any], None], user_data: Any = None) None#

Applies the same manipulation on every tzid in Component.

Added in version 3.0.5.

Parameters:
  • callback – The callback function

  • user_data – The data for callback function

get_comment() str#

Gets the comment of the Component.

Added in version 1.0.

get_current_component() Component#

Gets the current Component in Component.

Added in version 1.0.

get_current_property() Property#

Gets the current Property in Component.

Added in version 1.0.

get_description() str#

Gets the description of the Component.

Added in version 1.0.

get_dtend() Time#

Gets the dtend of the Component.

Added in version 1.0.

get_dtstamp() Time#

Gets the dtstamp of the Component.

Added in version 1.0.

get_dtstart() Time#

Gets the dtstart of the Component.

Added in version 1.0.

get_due() Time#

Gets the due of the Component.

Added in version 1.0.

get_duration() Duration#

Gets the duration of the Component.

Added in version 1.0.

get_first_component(kind: ComponentKind) Component | None#

Gets the first Component with specific kind in Component.

Added in version 1.0.

Parameters:

kind – A ComponentKind

get_first_property(kind: PropertyKind) Property | None#

Gets the first Property with specific kind in Component.

Added in version 1.0.

Parameters:

kind – A PropertyKind

get_first_real_component() Component#

For VCOMPONENT: Returns a reference to the first VEVENT, VTODO or VJOURNAL.

Added in version 1.0.

get_inner() Component | None#

Returns the first VEVENT, VTODO or VJOURNAL sub-component of cop, or comp if it is one of those types.

Added in version 1.0.

get_location() str#

Gets the location of the Component.

Added in version 1.0.

get_method() PropertyMethod#

Gets the method of the Component.

Added in version 1.0.

get_next_component(kind: ComponentKind) Component | None#

Gets the next Component with specific kind in Component.

Added in version 1.0.

Parameters:

kind – A ComponentKind

get_next_property(kind: PropertyKind) Property | None#

Gets the next Property with specific kind in Component.

Added in version 1.0.

Parameters:

kind – A PropertyKind

get_parent() Component | None#

Gets the parent component of the component.

Added in version 3.0.

get_recurrenceid() Time#

Gets the recurrenceid of the Component.

Added in version 1.0.

get_relcalid() str#

Gets the relcalid of the Component.

Added in version 1.0.

get_sequence() int#

Gets the sequence of the Component.

Added in version 1.0.

get_span() TimeSpan#

For VEVENT, VTODO, VJOURNAL and VTIMEZONE: reports the start and end times of an event in UTC.

Added in version 1.0.

get_status() PropertyStatus#

Gets the status of the Component.

Added in version 1.0.

get_summary() str#

Gets the summary of the Component.

Added in version 1.0.

get_timezone(tzid: str) Timezone | None#

Returns the icaltimezone in the component corresponding to the TZID, or NULL if it can’t be found.

Added in version 1.0.

Parameters:

tzid – A string representing timezone

get_uid() str#

Gets the uid of the Component.

Added in version 1.0.

is_valid() bool#

Checks whether Component is valid.

Added in version 1.0.

isa() ComponentKind#

Gets the type of Component.

Added in version 1.0.

isa_component() int#

Checks whether the native part of Component is icalcomponent.

Added in version 1.0.

classmethod kind_from_string() ComponentKind#

Converts a string to a ComponentKind.

Added in version 1.0.

classmethod kind_is_valid() bool#

Checks if a ComponentKind is valid.

Added in version 1.0.

classmethod kind_to_string() str#

Converts a ComponentKind to a string.

Added in version 1.0.

merge_component(comp_to_merge: Component) None#

Takes 2 VCALENDAR components and merges the second one into the first, resolving any problems with conflicting TZIDs. comp_to_merge will no longer exist after calling this function.

Added in version 1.0.

Parameters:

comp_to_merge – A Component. After merged it will not exist any more.

remove_component(child: Component) None#

Removes a child Component from another Component.

Added in version 1.0.

Parameters:

child – A child Component

remove_property(property: Property) None#

Removes Property from Component. Caution: The compare is based on address. So you must use the original Property as the target.

Added in version 1.0.

Parameters:

property – A Property

set_comment(v: str) None#

Sets the comment of the Component.

Added in version 1.0.

Parameters:

v – A string representing comment

set_description(v: str) None#

Sets the description of the Component.

Added in version 1.0.

Parameters:

v – A string representing description

set_dtend(v: Time) None#

Sets the dtend of the Component.

Added in version 1.0.

Parameters:

v – A Time

set_dtstamp(v: Time) None#

Sets the dtstamp of the Component.

Added in version 1.0.

Parameters:

v – A Time

set_dtstart(v: Time) None#

Sets the dtstart of the Component.

Added in version 1.0.

Parameters:

v – A Time

set_due(v: Time) None#

Sets the due of the Component.

Added in version 1.0.

Parameters:

v – A Time

set_duration(v: Duration) None#

Sets the duration of the Component.

Added in version 1.0.

Parameters:

v – A Duration

set_location(v: str) None#

Sets the location of the Component.

Added in version 1.0.

Parameters:

v – A string representing location

set_method(method: PropertyMethod) None#

Sets the method of the Component.

Added in version 1.0.

Parameters:

method – A PropertyMethod

set_parent(parent: Component | None = None) None#

Sets the parent Component of the specified component.

Added in version 3.0.

Parameters:

parent – An Component, a new parent

set_recurrenceid(v: Time) None#

Sets the recurrenceid of the Component.

Added in version 1.0.

Parameters:

v – A Time

set_relcalid(v: str) None#

Sets the relcalid of the Component.

Added in version 1.0.

Parameters:

v – A string representing relcalid

set_sequence(v: int) None#

Sets the sequence of the Component.

Added in version 1.0.

Parameters:

v – The sequence number

set_status(status: PropertyStatus) None#

Sets the status of the Component.

Added in version 1.0.

Parameters:

status – A PropertyStatus

set_summary(v: str) None#

Sets the summary of the Component.

Added in version 1.0.

Parameters:

v – A string representing summary

set_uid(v: str) None#

Sets the uid of the Component.

Added in version 1.0.

Parameters:

v – A string representing uid

strip_errors() None#

Removes all X-LIC-ERROR properties.

Added in version 1.0.