File: float.py

package info (click to toggle)
python-ical 9.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,448 kB
  • sloc: python: 13,877; sh: 9; makefile: 5
file content (19 lines) | stat: -rw-r--r-- 483 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""Library for parsing and encoding FLOAT values."""

from ical.parsing.property import ParsedProperty

from .data_types import DATA_TYPE


@DATA_TYPE.register("FLOAT")
class FloatEncoder:
    """Encode a float ICS value."""

    @classmethod
    def __property_type__(cls) -> type:
        return float

    @classmethod
    def __parse_property_value__(cls, prop: ParsedProperty) -> float:
        """Parse a rfc5545 property into a text value."""
        return float(prop.value)