Source code for tdw_catalog.metadata.decimal
from typing import Optional
from tdw_catalog.utils import MetadataFieldType
import tdw_catalog.metadata.field as field
[docs]class Field(field.MetadataField[float]):
"""
A field for confidence values or other fractional information
Attributes
----------
None
"""
def __init__(self, key: str, value: Optional[float]) -> None:
super().__init__(key, value)
def serialize(self) -> dict:
res = super().serialize()
res["value"] = str(self.value)
res["field_type"] = MetadataFieldType.FT_DECIMAL
return res