icalendar.cal.component_factory module#
A factory to create components.
- class icalendar.cal.component_factory.ComponentFactory(*args, **kwargs)[source]#
Bases:
CaselessDictRegistered components from RFC 7953 and RFC 5545.
To get a component, use this class as shown below.
>>> from icalendar import ComponentFactory >>> factory = ComponentFactory() >>> event_class = factory.get_component_class('VEVENT') >>> event_class() VEVENT({})
Automatically creates custom component classes for unknown names (X-components, IANA-components). Custom components are never dropped per RFC 5545.
>>> factory = ComponentFactory() >>> custom_class = factory.get_component_class('X-VENDOR') >>> custom_class() X-VENDOR({})
If a component class is not yet supported, it can be either created using
get_component_class()or added manually as a subclass ofComponent. See Custom components for details.Set keys to upper for initial dict.
- clear()#
Remove all items from ordered dict.
- classmethod fromkeys(iterable, value=None)#
Create a new ordered dictionary with keys from iterable and values set to value.
- get_component_class(name)[source]#
Get the component class from the factory.
This also creates and adds the component class if it does not exist.
- items()#
Return a set-like object providing a view on the dict's items.
- keys()#
Return a set-like object providing a view on the dict's keys.
- move_to_end(key, last=True)#
Move an existing element to the end (or beginning if last is false).
Raise KeyError if the element does not exist.
- values()#
Return an object providing a view on the dict's values.