wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item API documentation

# wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item

View Source

      1from typing import Any, Dict, List, Type, TypeVar, Union
      2
      3import attr
      4
      5from ..models.v1_task_get_by_workspace_response_200_tasks_item_flavor_type_0 import \
      6    V1TaskGetByWorkspaceResponse200TasksItemFlavorType0
      7from ..models.v1_task_get_by_workspace_response_200_tasks_item_flavor_type_1 import \
      8    V1TaskGetByWorkspaceResponse200TasksItemFlavorType1
      9from ..models.v1_task_get_by_workspace_response_200_tasks_item_flavor_type_2 import \
     10    V1TaskGetByWorkspaceResponse200TasksItemFlavorType2
     11from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_0 import \
     12    V1TaskGetByWorkspaceResponse200TasksItemStatusType0
     13from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_1 import \
     14    V1TaskGetByWorkspaceResponse200TasksItemStatusType1
     15from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_2 import \
     16    V1TaskGetByWorkspaceResponse200TasksItemStatusType2
     17from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_3 import \
     18    V1TaskGetByWorkspaceResponse200TasksItemStatusType3
     19from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_4 import \
     20    V1TaskGetByWorkspaceResponse200TasksItemStatusType4
     21from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_5 import \
     22    V1TaskGetByWorkspaceResponse200TasksItemStatusType5
     23from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_6 import \
     24    V1TaskGetByWorkspaceResponse200TasksItemStatusType6
     25from ..models.v1_task_get_by_workspace_response_200_tasks_item_status_type_7 import \
     26    V1TaskGetByWorkspaceResponse200TasksItemStatusType7
     27
     28T = TypeVar("T", bound="V1TaskGetByWorkspaceResponse200TasksItem")
     29
     30@attr.s(auto_attribs=True)
     31class V1TaskGetByWorkspaceResponse200TasksItem:
     32    """
     33    Attributes:
     34        id (str):
     35        flavor (Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0,
     36            V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]):
     37        subject (str):
     38        status (Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0,
     39            V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2,
     40            V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4,
     41            V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6,
     42            V1TaskGetByWorkspaceResponse200TasksItemStatusType7]):
     43        attempt (int):
     44    """
     45
     46    id: str
     47    flavor: Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]
     48    subject: str
     49    status: Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0, V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2, V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4, V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6, V1TaskGetByWorkspaceResponse200TasksItemStatusType7]
     50    attempt: int
     51    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
     52
     53
     54    def to_dict(self) -> Dict[str, Any]:
     55        id = self.id
     56        flavor: Union[Dict[str, Any], str]
     57
     58        if isinstance(self.flavor, V1TaskGetByWorkspaceResponse200TasksItemFlavorType0):
     59            flavor = self.flavor.value
     60
     61        elif isinstance(self.flavor, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1):
     62            flavor = self.flavor.value
     63
     64        else:
     65            flavor = self.flavor.to_dict()
     66
     67
     68
     69        subject = self.subject
     70        status: Union[Dict[str, Any], str]
     71
     72        if isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType0):
     73            status = self.status.value
     74
     75        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType1):
     76            status = self.status.value
     77
     78        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType2):
     79            status = self.status.value
     80
     81        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType3):
     82            status = self.status.value
     83
     84        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType4):
     85            status = self.status.value
     86
     87        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType5):
     88            status = self.status.value
     89
     90        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType6):
     91            status = self.status.value
     92
     93        else:
     94            status = self.status.to_dict()
     95
     96
     97
     98        attempt = self.attempt
     99
    100        field_dict: Dict[str, Any] = {}
    101        field_dict.update(self.additional_properties)
    102        field_dict.update({
    103            "id": id,
    104            "flavor": flavor,
    105            "subject": subject,
    106            "status": status,
    107            "attempt": attempt,
    108        })
    109
    110        return field_dict
    111
    112
    113
    114    @classmethod
    115    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
    116        d = src_dict.copy()
    117        id = d.pop("id")
    118
    119        def _parse_flavor(data: object) -> Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]:
    120            try:
    121                if not isinstance(data, str):
    122                    raise TypeError()
    123                flavor_type_0 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType0(data)
    124
    125
    126
    127                return flavor_type_0
    128            except: # noqa: E722
    129                pass
    130            try:
    131                if not isinstance(data, str):
    132                    raise TypeError()
    133                flavor_type_1 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType1(data)
    134
    135
    136
    137                return flavor_type_1
    138            except: # noqa: E722
    139                pass
    140            if not isinstance(data, dict):
    141                raise TypeError()
    142            flavor_type_2 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType2.from_dict(data)
    143
    144
    145
    146            return flavor_type_2
    147
    148        flavor = _parse_flavor(d.pop("flavor"))
    149
    150
    151        subject = d.pop("subject")
    152
    153        def _parse_status(data: object) -> Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0, V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2, V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4, V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6, V1TaskGetByWorkspaceResponse200TasksItemStatusType7]:
    154            try:
    155                if not isinstance(data, str):
    156                    raise TypeError()
    157                status_type_0 = V1TaskGetByWorkspaceResponse200TasksItemStatusType0(data)
    158
    159
    160
    161                return status_type_0
    162            except: # noqa: E722
    163                pass
    164            try:
    165                if not isinstance(data, str):
    166                    raise TypeError()
    167                status_type_1 = V1TaskGetByWorkspaceResponse200TasksItemStatusType1(data)
    168
    169
    170
    171                return status_type_1
    172            except: # noqa: E722
    173                pass
    174            try:
    175                if not isinstance(data, str):
    176                    raise TypeError()
    177                status_type_2 = V1TaskGetByWorkspaceResponse200TasksItemStatusType2(data)
    178
    179
    180
    181                return status_type_2
    182            except: # noqa: E722
    183                pass
    184            try:
    185                if not isinstance(data, str):
    186                    raise TypeError()
    187                status_type_3 = V1TaskGetByWorkspaceResponse200TasksItemStatusType3(data)
    188
    189
    190
    191                return status_type_3
    192            except: # noqa: E722
    193                pass
    194            try:
    195                if not isinstance(data, str):
    196                    raise TypeError()
    197                status_type_4 = V1TaskGetByWorkspaceResponse200TasksItemStatusType4(data)
    198
    199
    200
    201                return status_type_4
    202            except: # noqa: E722
    203                pass
    204            try:
    205                if not isinstance(data, str):
    206                    raise TypeError()
    207                status_type_5 = V1TaskGetByWorkspaceResponse200TasksItemStatusType5(data)
    208
    209
    210
    211                return status_type_5
    212            except: # noqa: E722
    213                pass
    214            try:
    215                if not isinstance(data, str):
    216                    raise TypeError()
    217                status_type_6 = V1TaskGetByWorkspaceResponse200TasksItemStatusType6(data)
    218
    219
    220
    221                return status_type_6
    222            except: # noqa: E722
    223                pass
    224            if not isinstance(data, dict):
    225                raise TypeError()
    226            status_type_7 = V1TaskGetByWorkspaceResponse200TasksItemStatusType7.from_dict(data)
    227
    228
    229
    230            return status_type_7
    231
    232        status = _parse_status(d.pop("status"))
    233
    234
    235        attempt = d.pop("attempt")
    236
    237        v1_task_get_by_workspace_response_200_tasks_item = cls(
    238            id=id,
    239            flavor=flavor,
    240            subject=subject,
    241            status=status,
    242            attempt=attempt,
    243        )
    244
    245        v1_task_get_by_workspace_response_200_tasks_item.additional_properties = d
    246        return v1_task_get_by_workspace_response_200_tasks_item
    247
    248    @property
    249    def additional_keys(self) -> List[str]:
    250        return list(self.additional_properties.keys())
    251
    252    def __getitem__(self, key: str) -> Any:
    253        return self.additional_properties[key]
    254
    255    def __setitem__(self, key: str, value: Any) -> None:
    256        self.additional_properties[key] = value
    257
    258    def __delitem__(self, key: str) -> None:
    259        del self.additional_properties[key]
    260
    261    def __contains__(self, key: str) -> bool:
    262        return key in self.additional_properties

@attr.s(auto_attribs=True)
class V1TaskGetByWorkspaceResponse200TasksItem: View Source

     31@attr.s(auto_attribs=True)
     32class V1TaskGetByWorkspaceResponse200TasksItem:
     33    """
     34    Attributes:
     35        id (str):
     36        flavor (Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0,
     37            V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]):
     38        subject (str):
     39        status (Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0,
     40            V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2,
     41            V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4,
     42            V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6,
     43            V1TaskGetByWorkspaceResponse200TasksItemStatusType7]):
     44        attempt (int):
     45    """
     46
     47    id: str
     48    flavor: Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]
     49    subject: str
     50    status: Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0, V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2, V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4, V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6, V1TaskGetByWorkspaceResponse200TasksItemStatusType7]
     51    attempt: int
     52    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
     53
     54
     55    def to_dict(self) -> Dict[str, Any]:
     56        id = self.id
     57        flavor: Union[Dict[str, Any], str]
     58
     59        if isinstance(self.flavor, V1TaskGetByWorkspaceResponse200TasksItemFlavorType0):
     60            flavor = self.flavor.value
     61
     62        elif isinstance(self.flavor, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1):
     63            flavor = self.flavor.value
     64
     65        else:
     66            flavor = self.flavor.to_dict()
     67
     68
     69
     70        subject = self.subject
     71        status: Union[Dict[str, Any], str]
     72
     73        if isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType0):
     74            status = self.status.value
     75
     76        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType1):
     77            status = self.status.value
     78
     79        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType2):
     80            status = self.status.value
     81
     82        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType3):
     83            status = self.status.value
     84
     85        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType4):
     86            status = self.status.value
     87
     88        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType5):
     89            status = self.status.value
     90
     91        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType6):
     92            status = self.status.value
     93
     94        else:
     95            status = self.status.to_dict()
     96
     97
     98
     99        attempt = self.attempt
    100
    101        field_dict: Dict[str, Any] = {}
    102        field_dict.update(self.additional_properties)
    103        field_dict.update({
    104            "id": id,
    105            "flavor": flavor,
    106            "subject": subject,
    107            "status": status,
    108            "attempt": attempt,
    109        })
    110
    111        return field_dict
    112
    113
    114
    115    @classmethod
    116    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
    117        d = src_dict.copy()
    118        id = d.pop("id")
    119
    120        def _parse_flavor(data: object) -> Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]:
    121            try:
    122                if not isinstance(data, str):
    123                    raise TypeError()
    124                flavor_type_0 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType0(data)
    125
    126
    127
    128                return flavor_type_0
    129            except: # noqa: E722
    130                pass
    131            try:
    132                if not isinstance(data, str):
    133                    raise TypeError()
    134                flavor_type_1 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType1(data)
    135
    136
    137
    138                return flavor_type_1
    139            except: # noqa: E722
    140                pass
    141            if not isinstance(data, dict):
    142                raise TypeError()
    143            flavor_type_2 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType2.from_dict(data)
    144
    145
    146
    147            return flavor_type_2
    148
    149        flavor = _parse_flavor(d.pop("flavor"))
    150
    151
    152        subject = d.pop("subject")
    153
    154        def _parse_status(data: object) -> Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0, V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2, V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4, V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6, V1TaskGetByWorkspaceResponse200TasksItemStatusType7]:
    155            try:
    156                if not isinstance(data, str):
    157                    raise TypeError()
    158                status_type_0 = V1TaskGetByWorkspaceResponse200TasksItemStatusType0(data)
    159
    160
    161
    162                return status_type_0
    163            except: # noqa: E722
    164                pass
    165            try:
    166                if not isinstance(data, str):
    167                    raise TypeError()
    168                status_type_1 = V1TaskGetByWorkspaceResponse200TasksItemStatusType1(data)
    169
    170
    171
    172                return status_type_1
    173            except: # noqa: E722
    174                pass
    175            try:
    176                if not isinstance(data, str):
    177                    raise TypeError()
    178                status_type_2 = V1TaskGetByWorkspaceResponse200TasksItemStatusType2(data)
    179
    180
    181
    182                return status_type_2
    183            except: # noqa: E722
    184                pass
    185            try:
    186                if not isinstance(data, str):
    187                    raise TypeError()
    188                status_type_3 = V1TaskGetByWorkspaceResponse200TasksItemStatusType3(data)
    189
    190
    191
    192                return status_type_3
    193            except: # noqa: E722
    194                pass
    195            try:
    196                if not isinstance(data, str):
    197                    raise TypeError()
    198                status_type_4 = V1TaskGetByWorkspaceResponse200TasksItemStatusType4(data)
    199
    200
    201
    202                return status_type_4
    203            except: # noqa: E722
    204                pass
    205            try:
    206                if not isinstance(data, str):
    207                    raise TypeError()
    208                status_type_5 = V1TaskGetByWorkspaceResponse200TasksItemStatusType5(data)
    209
    210
    211
    212                return status_type_5
    213            except: # noqa: E722
    214                pass
    215            try:
    216                if not isinstance(data, str):
    217                    raise TypeError()
    218                status_type_6 = V1TaskGetByWorkspaceResponse200TasksItemStatusType6(data)
    219
    220
    221
    222                return status_type_6
    223            except: # noqa: E722
    224                pass
    225            if not isinstance(data, dict):
    226                raise TypeError()
    227            status_type_7 = V1TaskGetByWorkspaceResponse200TasksItemStatusType7.from_dict(data)
    228
    229
    230
    231            return status_type_7
    232
    233        status = _parse_status(d.pop("status"))
    234
    235
    236        attempt = d.pop("attempt")
    237
    238        v1_task_get_by_workspace_response_200_tasks_item = cls(
    239            id=id,
    240            flavor=flavor,
    241            subject=subject,
    242            status=status,
    243            attempt=attempt,
    244        )
    245
    246        v1_task_get_by_workspace_response_200_tasks_item.additional_properties = d
    247        return v1_task_get_by_workspace_response_200_tasks_item
    248
    249    @property
    250    def additional_keys(self) -> List[str]:
    251        return list(self.additional_properties.keys())
    252
    253    def __getitem__(self, key: str) -> Any:
    254        return self.additional_properties[key]
    255
    256    def __setitem__(self, key: str, value: Any) -> None:
    257        self.additional_properties[key] = value
    258
    259    def __delitem__(self, key: str) -> None:
    260        del self.additional_properties[key]
    261
    262    def __contains__(self, key: str) -> bool:
    263        return key in self.additional_properties

Attributes: id (str): flavor (Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]): subject (str): status (Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0, V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2, V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4, V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6, V1TaskGetByWorkspaceResponse200TasksItemStatusType7]): attempt (int):

V1TaskGetByWorkspaceResponse200TasksItem( id: str, flavor: Union[wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_flavor_type_0.V1TaskGetByWorkspaceResponse200TasksItemFlavorType0, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_flavor_type_1.V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_flavor_type_2.V1TaskGetByWorkspaceResponse200TasksItemFlavorType2], subject: str, status: Union[wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_0.V1TaskGetByWorkspaceResponse200TasksItemStatusType0, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_1.V1TaskGetByWorkspaceResponse200TasksItemStatusType1, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_2.V1TaskGetByWorkspaceResponse200TasksItemStatusType2, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_3.V1TaskGetByWorkspaceResponse200TasksItemStatusType3, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_4.V1TaskGetByWorkspaceResponse200TasksItemStatusType4, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_5.V1TaskGetByWorkspaceResponse200TasksItemStatusType5, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_6.V1TaskGetByWorkspaceResponse200TasksItemStatusType6, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_workspace_response_200_tasks_item_status_type_7.V1TaskGetByWorkspaceResponse200TasksItemStatusType7], attempt: int) View Source

    2def __init__(self, id, flavor, subject, status, attempt):
    3    self.id = id
    4    self.flavor = flavor
    5    self.subject = subject
    6    self.status = status
    7    self.attempt = attempt
    8    self.additional_properties = __attr_factory_additional_properties()

Method generated by attrs for class V1TaskGetByWorkspaceResponse200TasksItem.

def to_dict(self) -> Dict[str, Any]: View Source

     55    def to_dict(self) -> Dict[str, Any]:
     56        id = self.id
     57        flavor: Union[Dict[str, Any], str]
     58
     59        if isinstance(self.flavor, V1TaskGetByWorkspaceResponse200TasksItemFlavorType0):
     60            flavor = self.flavor.value
     61
     62        elif isinstance(self.flavor, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1):
     63            flavor = self.flavor.value
     64
     65        else:
     66            flavor = self.flavor.to_dict()
     67
     68
     69
     70        subject = self.subject
     71        status: Union[Dict[str, Any], str]
     72
     73        if isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType0):
     74            status = self.status.value
     75
     76        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType1):
     77            status = self.status.value
     78
     79        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType2):
     80            status = self.status.value
     81
     82        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType3):
     83            status = self.status.value
     84
     85        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType4):
     86            status = self.status.value
     87
     88        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType5):
     89            status = self.status.value
     90
     91        elif isinstance(self.status, V1TaskGetByWorkspaceResponse200TasksItemStatusType6):
     92            status = self.status.value
     93
     94        else:
     95            status = self.status.to_dict()
     96
     97
     98
     99        attempt = self.attempt
    100
    101        field_dict: Dict[str, Any] = {}
    102        field_dict.update(self.additional_properties)
    103        field_dict.update({
    104            "id": id,
    105            "flavor": flavor,
    106            "subject": subject,
    107            "status": status,
    108            "attempt": attempt,
    109        })
    110
    111        return field_dict

@classmethod
def from_dict(cls: Type[~T], src_dict: Dict[str, Any]) -> ~T: View Source

    115    @classmethod
    116    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
    117        d = src_dict.copy()
    118        id = d.pop("id")
    119
    120        def _parse_flavor(data: object) -> Union[V1TaskGetByWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByWorkspaceResponse200TasksItemFlavorType2]:
    121            try:
    122                if not isinstance(data, str):
    123                    raise TypeError()
    124                flavor_type_0 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType0(data)
    125
    126
    127
    128                return flavor_type_0
    129            except: # noqa: E722
    130                pass
    131            try:
    132                if not isinstance(data, str):
    133                    raise TypeError()
    134                flavor_type_1 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType1(data)
    135
    136
    137
    138                return flavor_type_1
    139            except: # noqa: E722
    140                pass
    141            if not isinstance(data, dict):
    142                raise TypeError()
    143            flavor_type_2 = V1TaskGetByWorkspaceResponse200TasksItemFlavorType2.from_dict(data)
    144
    145
    146
    147            return flavor_type_2
    148
    149        flavor = _parse_flavor(d.pop("flavor"))
    150
    151
    152        subject = d.pop("subject")
    153
    154        def _parse_status(data: object) -> Union[V1TaskGetByWorkspaceResponse200TasksItemStatusType0, V1TaskGetByWorkspaceResponse200TasksItemStatusType1, V1TaskGetByWorkspaceResponse200TasksItemStatusType2, V1TaskGetByWorkspaceResponse200TasksItemStatusType3, V1TaskGetByWorkspaceResponse200TasksItemStatusType4, V1TaskGetByWorkspaceResponse200TasksItemStatusType5, V1TaskGetByWorkspaceResponse200TasksItemStatusType6, V1TaskGetByWorkspaceResponse200TasksItemStatusType7]:
    155            try:
    156                if not isinstance(data, str):
    157                    raise TypeError()
    158                status_type_0 = V1TaskGetByWorkspaceResponse200TasksItemStatusType0(data)
    159
    160
    161
    162                return status_type_0
    163            except: # noqa: E722
    164                pass
    165            try:
    166                if not isinstance(data, str):
    167                    raise TypeError()
    168                status_type_1 = V1TaskGetByWorkspaceResponse200TasksItemStatusType1(data)
    169
    170
    171
    172                return status_type_1
    173            except: # noqa: E722
    174                pass
    175            try:
    176                if not isinstance(data, str):
    177                    raise TypeError()
    178                status_type_2 = V1TaskGetByWorkspaceResponse200TasksItemStatusType2(data)
    179
    180
    181
    182                return status_type_2
    183            except: # noqa: E722
    184                pass
    185            try:
    186                if not isinstance(data, str):
    187                    raise TypeError()
    188                status_type_3 = V1TaskGetByWorkspaceResponse200TasksItemStatusType3(data)
    189
    190
    191
    192                return status_type_3
    193            except: # noqa: E722
    194                pass
    195            try:
    196                if not isinstance(data, str):
    197                    raise TypeError()
    198                status_type_4 = V1TaskGetByWorkspaceResponse200TasksItemStatusType4(data)
    199
    200
    201
    202                return status_type_4
    203            except: # noqa: E722
    204                pass
    205            try:
    206                if not isinstance(data, str):
    207                    raise TypeError()
    208                status_type_5 = V1TaskGetByWorkspaceResponse200TasksItemStatusType5(data)
    209
    210
    211
    212                return status_type_5
    213            except: # noqa: E722
    214                pass
    215            try:
    216                if not isinstance(data, str):
    217                    raise TypeError()
    218                status_type_6 = V1TaskGetByWorkspaceResponse200TasksItemStatusType6(data)
    219
    220
    221
    222                return status_type_6
    223            except: # noqa: E722
    224                pass
    225            if not isinstance(data, dict):
    226                raise TypeError()
    227            status_type_7 = V1TaskGetByWorkspaceResponse200TasksItemStatusType7.from_dict(data)
    228
    229
    230
    231            return status_type_7
    232
    233        status = _parse_status(d.pop("status"))
    234
    235
    236        attempt = d.pop("attempt")
    237
    238        v1_task_get_by_workspace_response_200_tasks_item = cls(
    239            id=id,
    240            flavor=flavor,
    241            subject=subject,
    242            status=status,
    243            attempt=attempt,
    244        )
    245
    246        v1_task_get_by_workspace_response_200_tasks_item.additional_properties = d
    247        return v1_task_get_by_workspace_response_200_tasks_item

additional_keys: List[str]