|
| 1 | +from typing import Any, Dict, Type, TypeVar, Union |
| 2 | + |
| 3 | +import attr |
| 4 | + |
| 5 | +from ..models.ordinates import Ordinates |
| 6 | +from ..types import UNSET, Unset |
| 7 | + |
| 8 | +T = TypeVar("T", bound="CoordinateSequence") |
| 9 | + |
| 10 | + |
| 11 | +@attr.s(auto_attribs=True) |
| 12 | +class CoordinateSequence: |
| 13 | + """ |
| 14 | + Attributes: |
| 15 | + dimension (Union[Unset, int]): |
| 16 | + measures (Union[Unset, int]): |
| 17 | + spatial (Union[Unset, int]): |
| 18 | + ordinates (Union[Unset, Ordinates]): |
| 19 | + has_z (Union[Unset, bool]): |
| 20 | + has_m (Union[Unset, bool]): |
| 21 | + z_ordinate_index (Union[Unset, int]): |
| 22 | + m_ordinate_index (Union[Unset, int]): |
| 23 | + count (Union[Unset, int]): |
| 24 | + """ |
| 25 | + |
| 26 | + dimension: Union[Unset, int] = UNSET |
| 27 | + measures: Union[Unset, int] = UNSET |
| 28 | + spatial: Union[Unset, int] = UNSET |
| 29 | + ordinates: Union[Unset, Ordinates] = UNSET |
| 30 | + has_z: Union[Unset, bool] = UNSET |
| 31 | + has_m: Union[Unset, bool] = UNSET |
| 32 | + z_ordinate_index: Union[Unset, int] = UNSET |
| 33 | + m_ordinate_index: Union[Unset, int] = UNSET |
| 34 | + count: Union[Unset, int] = UNSET |
| 35 | + |
| 36 | + def to_dict(self) -> Dict[str, Any]: |
| 37 | + dimension = self.dimension |
| 38 | + measures = self.measures |
| 39 | + spatial = self.spatial |
| 40 | + ordinates: Union[Unset, str] = UNSET |
| 41 | + if not isinstance(self.ordinates, Unset): |
| 42 | + ordinates = self.ordinates.value |
| 43 | + |
| 44 | + has_z = self.has_z |
| 45 | + has_m = self.has_m |
| 46 | + z_ordinate_index = self.z_ordinate_index |
| 47 | + m_ordinate_index = self.m_ordinate_index |
| 48 | + count = self.count |
| 49 | + |
| 50 | + field_dict: Dict[str, Any] = {} |
| 51 | + field_dict.update({}) |
| 52 | + if dimension is not UNSET: |
| 53 | + field_dict["dimension"] = dimension |
| 54 | + if measures is not UNSET: |
| 55 | + field_dict["measures"] = measures |
| 56 | + if spatial is not UNSET: |
| 57 | + field_dict["spatial"] = spatial |
| 58 | + if ordinates is not UNSET: |
| 59 | + field_dict["ordinates"] = ordinates |
| 60 | + if has_z is not UNSET: |
| 61 | + field_dict["hasZ"] = has_z |
| 62 | + if has_m is not UNSET: |
| 63 | + field_dict["hasM"] = has_m |
| 64 | + if z_ordinate_index is not UNSET: |
| 65 | + field_dict["zOrdinateIndex"] = z_ordinate_index |
| 66 | + if m_ordinate_index is not UNSET: |
| 67 | + field_dict["mOrdinateIndex"] = m_ordinate_index |
| 68 | + if count is not UNSET: |
| 69 | + field_dict["count"] = count |
| 70 | + |
| 71 | + return field_dict |
| 72 | + |
| 73 | + @classmethod |
| 74 | + def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T: |
| 75 | + d = src_dict.copy() |
| 76 | + dimension = d.pop("dimension", UNSET) |
| 77 | + |
| 78 | + measures = d.pop("measures", UNSET) |
| 79 | + |
| 80 | + spatial = d.pop("spatial", UNSET) |
| 81 | + |
| 82 | + _ordinates = d.pop("ordinates", UNSET) |
| 83 | + ordinates: Union[Unset, Ordinates] |
| 84 | + if isinstance(_ordinates, Unset): |
| 85 | + ordinates = UNSET |
| 86 | + else: |
| 87 | + ordinates = Ordinates(_ordinates) |
| 88 | + |
| 89 | + has_z = d.pop("hasZ", UNSET) |
| 90 | + |
| 91 | + has_m = d.pop("hasM", UNSET) |
| 92 | + |
| 93 | + z_ordinate_index = d.pop("zOrdinateIndex", UNSET) |
| 94 | + |
| 95 | + m_ordinate_index = d.pop("mOrdinateIndex", UNSET) |
| 96 | + |
| 97 | + count = d.pop("count", UNSET) |
| 98 | + |
| 99 | + coordinate_sequence = cls( |
| 100 | + dimension=dimension, |
| 101 | + measures=measures, |
| 102 | + spatial=spatial, |
| 103 | + ordinates=ordinates, |
| 104 | + has_z=has_z, |
| 105 | + has_m=has_m, |
| 106 | + z_ordinate_index=z_ordinate_index, |
| 107 | + m_ordinate_index=m_ordinate_index, |
| 108 | + count=count, |
| 109 | + ) |
| 110 | + |
| 111 | + return coordinate_sequence |
0 commit comments