icalendar.prop.factory module#

Factory class for all the property types.

class icalendar.prop.factory.TypesFactory(*args, **kwargs)[source]#

Bases: CaselessDict

Factory for all value types defined in RFC 5545 and subsequent.

The value and parameter names don't overlap. So one factory is enough for both kinds.

Set keys to upper for initial dict

clear()#

Remove all items from ordered dict.

for_property(name, value_param=None)[source]#

Returns the type class for a property or parameter.

Parameters:
  • name – Property or parameter name

  • value_param (str | None) – Optional VALUE parameter, for example, "DATE", "DATE-TIME", or other string.

Return type:

type

Returns:

The appropriate value type class.

from_ical(name, value)[source]#

Decodes a named property or parameter value from an icalendar encoded string to a primitive python type.

classmethod fromkeys(iterable, value=None)#

Create a new ordered dictionary with keys from iterable and values set to value.

instance()[source]#

Return a singleton instance of this class.

Return type:

TypesFactory

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.

to_ical(name, value)[source]#

Encodes a named value from a primitive python type to an icalendar encoded string.

types_map = {'ACKNOWLEDGED': 'date-time', 'ACTION': 'text', 'ADR': 'adr', 'ALTREP': 'uri', 'ATTACH': 'uri', 'ATTENDEE': 'cal-address', 'CALSCALE': 'text', 'CATEGORIES': 'categories', 'CLASS': 'text', 'CN': 'text', 'COMMENT': 'text', 'COMPLETED': 'date-time', 'CONCEPT': 'uri', 'CONFERENCE': 'uri', 'CONTACT': 'text', 'CREATED': 'date-time', 'CUTYPE': 'text', 'DELEGATED-FROM': 'cal-address', 'DELEGATED-TO': 'cal-address', 'DESCRIPTION': 'text', 'DIR': 'uri', 'DTEND': 'date-time', 'DTSTAMP': 'date-time', 'DTSTART': 'date-time', 'DUE': 'date-time', 'DURATION': 'duration', 'ENCODING': 'text', 'EXDATE': 'date-time-list', 'EXRULE': 'recur', 'FBTYPE': 'text', 'FMTTYPE': 'text', 'FREEBUSY': 'period', 'GAP': 'duration', 'GEO': 'geo', 'LABEL': 'text', 'LANGUAGE': 'text', 'LAST-MODIFIED': 'date-time', 'LINK': 'uri', 'LINKREL': 'text', 'LOCATION': 'text', 'MEMBER': 'cal-address', 'METHOD': 'text', 'N': 'n', 'ORG': 'org', 'ORGANIZER': 'cal-address', 'PARTSTAT': 'text', 'PERCENT-COMPLETE': 'integer', 'PRIORITY': 'integer', 'PRODID': 'text', 'RANGE': 'text', 'RDATE': 'date-time-list', 'RECURRENCE-ID': 'date-time', 'REFID': 'text', 'REFRESH-INTERVAL': 'duration', 'RELATED': 'text', 'RELATED-TO': 'text', 'RELTYPE': 'text', 'REPEAT': 'integer', 'REQUEST-STATUS': 'text', 'RESOURCES': 'text', 'ROLE': 'text', 'RRULE': 'recur', 'RSVP': 'boolean', 'SENT-BY': 'cal-address', 'SEQUENCE': 'integer', 'SOURCE': 'uri', 'STATUS': 'text', 'SUMMARY': 'text', 'TRANSP': 'text', 'TRIGGER': 'duration', 'TZID': 'text', 'TZNAME': 'text', 'TZOFFSETFROM': 'utc-offset', 'TZOFFSETTO': 'utc-offset', 'TZURL': 'uri', 'UID': 'text', 'URL': 'uri', 'VALUE': 'text', 'VERSION': 'text'}#
values()#

Return an object providing a view on the dict's values.