icalendar.parser.content_line module#
parsing and generation of content lines
- class icalendar.parser.content_line.Contentline(value, strict=False, encoding='utf-8')[source]#
Bases:
strA content line is basically a string that can be folded and parsed into parts.
- classmethod from_ical(ical, strict=False)[source]#
Unfold the content lines in an iCalendar into long content lines.
- classmethod from_parts(name, params, values, sorted=True)[source]#
Turn a parts into a content line.
- parts()[source]#
Split the content line into
name,parameters, andvaluesparts.Properly handles escaping with backslashes and double-quote sections to avoid corrupting URL-encoded characters in values.
Example with parameter:
DESCRIPTION;ALTREP="cid:part1.0001@example.org":The Fall'98 Wild
Example without parameters:
DESCRIPTION:The Fall'98 Wild
- Return type:
tuple[str,Parameters,str]
- strict#
- value_separator_index()[source]#
Return the index of the colon that separates the value.
This is the first colon that is not inside a quoted parameter section. A colon inside a quoted parameter value (for example
ALTREP="http://x") is skipped, and a colon that belongs to the value (TEXTdoes not escape:) is not mistaken for the separator. Backslash has no special meaning in the parameter grammar (RFC 5545 Section 3.1), so it is treated as an ordinary character.- Return type:
- Returns:
An integer representing the index position of the separator, or
-1if there is none.
- class icalendar.parser.content_line.Contentlines(iterable=(), /)[source]#
Bases:
list[Contentline]I assume that iCalendar files generally are a few kilobytes in size. Then this should be efficient. for Huge files, an iterator should probably be used instead.