83 lines
2.3 KiB
Python
83 lines
2.3 KiB
Python
from typing import Any, Dict, List, Type, TypeVar, Union
|
|
|
|
import attr
|
|
|
|
from ..models.axis import Axis
|
|
from ..models.direction import Direction
|
|
from ..types import UNSET, Unset
|
|
|
|
MS = TypeVar("MS", bound="AxisDirectionPair")
|
|
|
|
|
|
@attr.s(auto_attribs=True)
|
|
class AxisDirectionPair:
|
|
"""An [`Axis`] paired with a [`Direction`].""" # noqa: E501
|
|
|
|
axis: Union[Unset, Axis] = UNSET
|
|
direction: Union[Unset, Direction] = UNSET
|
|
|
|
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
axis: Union[Unset, Axis] = UNSET
|
|
if not isinstance(self.axis, Unset):
|
|
axis = self.axis
|
|
direction: Union[Unset, Direction] = UNSET
|
|
if not isinstance(self.direction, Unset):
|
|
direction = self.direction
|
|
|
|
field_dict: Dict[str, Any] = {}
|
|
field_dict.update(self.additional_properties)
|
|
field_dict.update({})
|
|
if axis is not UNSET:
|
|
field_dict["axis"] = axis
|
|
if direction is not UNSET:
|
|
field_dict["direction"] = direction
|
|
|
|
return field_dict
|
|
|
|
@classmethod
|
|
def from_dict(cls: Type[MS], src_dict: Dict[str, Any]) -> MS:
|
|
d = src_dict.copy()
|
|
_axis = d.pop("axis", UNSET)
|
|
axis: Union[Unset, Axis]
|
|
if isinstance(_axis, Unset):
|
|
axis = UNSET
|
|
if _axis is None:
|
|
axis = UNSET
|
|
else:
|
|
axis = _axis
|
|
|
|
_direction = d.pop("direction", UNSET)
|
|
direction: Union[Unset, Direction]
|
|
if isinstance(_direction, Unset):
|
|
direction = UNSET
|
|
if _direction is None:
|
|
direction = UNSET
|
|
else:
|
|
direction = _direction
|
|
|
|
axis_direction_pair = cls(
|
|
axis=axis,
|
|
direction=direction,
|
|
)
|
|
|
|
axis_direction_pair.additional_properties = d
|
|
return axis_direction_pair
|
|
|
|
@property
|
|
def additional_keys(self) -> List[str]:
|
|
return list(self.additional_properties.keys())
|
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
return self.additional_properties[key]
|
|
|
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
self.additional_properties[key] = value
|
|
|
|
def __delitem__(self, key: str) -> None:
|
|
del self.additional_properties[key]
|
|
|
|
def __contains__(self, key: str) -> bool:
|
|
return key in self.additional_properties
|