Source code for maptekblastlogic.models.custom_property_schema_float_range_settings

from __future__ import annotations

from collections.abc import Mapping
from typing import Any, TypeVar, cast

from attrs import define as _attrs_define

from ..types import UNSET, Unset

T = TypeVar("T", bound="CustomPropertySchemaFloatRangeSettings")


[docs] @_attrs_define class CustomPropertySchemaFloatRangeSettings: """Settings specific to 'FloatRange' type custom properties.""" unit: None | str | Unset = UNSET """ The unit of measurement the float range values are expressed as. Can be null if the unit of measurement is not specified. """
[docs] def to_dict(self) -> dict[str, Any]: unit: None | str | Unset if isinstance(self.unit, Unset): unit = UNSET else: unit = self.unit field_dict: dict[str, Any] = {} field_dict.update({}) if unit is not UNSET: field_dict["unit"] = unit return field_dict
[docs] @classmethod def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) def _parse_unit(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data return cast(None | str | Unset, data) unit = _parse_unit(d.pop("unit", UNSET)) custom_property_schema_float_range_settings = cls( unit=unit, ) return custom_property_schema_float_range_settings