Source code for tdw_catalog.metadata.list_field

from typing import List, Optional

from tdw_catalog.utils import MetadataFieldType
import tdw_catalog.metadata.field as field


[docs]class Field(field.MetadataField[str]): """ A preconfigured set of options where one of the options may be applied to a :class:`.Dataset` Attributes ---------- list_items : Optional[List[str]] An optional list of values from which a user may choose a value """ list_items: Optional[List[str]] def __init__(self, key: str, value: Optional[field.T], list_items: Optional[List[str]]) -> None: super().__init__( key, value, ) self.list_items = list_items def serialize(self) -> dict: res = super().serialize() res["value"] = self.value res["field_type"] = MetadataFieldType.FT_LIST return res