Source code for icalendar.prop.inline

from typing import Any

from icalendar.parser import Parameters
from icalendar.parser_tools import DEFAULT_ENCODING, to_unicode


[docs] class vInline(str): """This is an especially dumb class that just holds raw unparsed text and has parameters. Conversion of inline values are handled by the Component class, so no further processing is needed. """ params: Parameters __slots__ = ("params",) def __new__( cls, value, encoding=DEFAULT_ENCODING, /, params: dict[str, Any] | None = None, ): value = to_unicode(value, encoding=encoding) self = super().__new__(cls, value) self.params = Parameters(params) return self
[docs] def to_ical(self): return self.encode(DEFAULT_ENCODING)
[docs] @classmethod def from_ical(cls, ical): return cls(ical)
__all__ = ["vInline"]