2023-05-04 00:58:06 -07:00
|
|
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
|
|
|
|
|
|
|
import attr
|
|
|
|
|
2023-05-23 14:24:13 -07:00
|
|
|
from ..models.modeling_cmd_id import ModelingCmdId
|
2023-05-04 00:58:06 -07:00
|
|
|
from ..types import UNSET, Unset
|
2023-05-23 14:24:13 -07:00
|
|
|
from .modeling_error import ModelingError
|
2023-05-04 00:58:06 -07:00
|
|
|
|
|
|
|
Success = Any
|
|
|
|
|
|
|
|
|
2023-05-23 14:24:13 -07:00
|
|
|
Error = ModelingError
|
2023-05-04 00:58:06 -07:00
|
|
|
|
|
|
|
|
2023-07-07 19:22:51 -07:00
|
|
|
E = TypeVar("E", bound="Cancelled")
|
2023-05-04 00:58:06 -07:00
|
|
|
|
|
|
|
|
|
|
|
@attr.s(auto_attribs=True)
|
|
|
|
class Cancelled:
|
2023-05-23 14:24:13 -07:00
|
|
|
what_failed: Union[Unset, ModelingCmdId] = UNSET
|
2023-05-04 00:58:06 -07:00
|
|
|
|
|
|
|
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
|
|
|
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
|
|
if not isinstance(self.what_failed, Unset):
|
|
|
|
what_failed = self.what_failed
|
|
|
|
|
|
|
|
field_dict: Dict[str, Any] = {}
|
|
|
|
field_dict.update(self.additional_properties)
|
|
|
|
field_dict.update({})
|
|
|
|
if what_failed is not UNSET:
|
|
|
|
field_dict["what_failed"] = what_failed
|
|
|
|
|
|
|
|
return field_dict
|
|
|
|
|
|
|
|
@classmethod
|
2023-07-07 19:22:51 -07:00
|
|
|
def from_dict(cls: Type[E], src_dict: Dict[str, Any]) -> E:
|
2023-05-04 00:58:06 -07:00
|
|
|
d = src_dict.copy()
|
|
|
|
_what_failed = d.pop("what_failed", UNSET)
|
2023-05-23 14:24:13 -07:00
|
|
|
what_failed: Union[Unset, ModelingCmdId]
|
2023-05-04 00:58:06 -07:00
|
|
|
if isinstance(_what_failed, Unset):
|
|
|
|
what_failed = UNSET
|
|
|
|
else:
|
2023-05-23 14:24:13 -07:00
|
|
|
what_failed = ModelingCmdId(_what_failed)
|
2023-05-04 00:58:06 -07:00
|
|
|
|
|
|
|
cancelled = cls(
|
|
|
|
what_failed=what_failed,
|
|
|
|
)
|
|
|
|
|
|
|
|
cancelled.additional_properties = d
|
|
|
|
return cancelled
|
|
|
|
|
|
|
|
@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
|
|
|
|
|
|
|
|
|
2023-05-23 14:24:13 -07:00
|
|
|
ModelingOutcome = Union[Success, Error, Cancelled]
|