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

default_value_type(name)[source]#

Return the default jCal value type for a property.

The result is a lowercase RFC 7265 value type, for example "date-time" for DTSTART or "duration" for TRIGGER. This is the value type a property uses when no explicit VALUE parameter is given, so it tells Component.from_jcal() whether a VALUE parameter has to be restored from the jCal type field.

Parameters:

name (str) – Property name.

Return type:

str

Returns:

The default jCal value type as a lowercase string.

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.

instance()[source]#

Return a singleton instance of this class.

Return type:

TypesFactory

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'}#