wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_status_and_workspace_response_200_tasks_item API documentation

# wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_status_and_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_status_and_workspace_response_200_tasks_item_flavor_type_0 import \
      6    V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0
      7from ..models.v1_task_get_by_status_and_workspace_response_200_tasks_item_flavor_type_1 import \
      8    V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1
      9from ..models.v1_task_get_by_status_and_workspace_response_200_tasks_item_flavor_type_2 import \
     10    V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2
     11
     12T = TypeVar("T", bound="V1TaskGetByStatusAndWorkspaceResponse200TasksItem")
     13
     14@attr.s(auto_attribs=True)
     15class V1TaskGetByStatusAndWorkspaceResponse200TasksItem:
     16    """
     17    Attributes:
     18        id (str):
     19        flavor (Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0,
     20            V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1,
     21            V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]):
     22        subject (str):
     23        attempt (int):
     24    """
     25
     26    id: str
     27    flavor: Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]
     28    subject: str
     29    attempt: int
     30    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
     31
     32
     33    def to_dict(self) -> Dict[str, Any]:
     34        id = self.id
     35        flavor: Union[Dict[str, Any], str]
     36
     37        if isinstance(self.flavor, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0):
     38            flavor = self.flavor.value
     39
     40        elif isinstance(self.flavor, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1):
     41            flavor = self.flavor.value
     42
     43        else:
     44            flavor = self.flavor.to_dict()
     45
     46
     47
     48        subject = self.subject
     49        attempt = self.attempt
     50
     51        field_dict: Dict[str, Any] = {}
     52        field_dict.update(self.additional_properties)
     53        field_dict.update({
     54            "id": id,
     55            "flavor": flavor,
     56            "subject": subject,
     57            "attempt": attempt,
     58        })
     59
     60        return field_dict
     61
     62
     63
     64    @classmethod
     65    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
     66        d = src_dict.copy()
     67        id = d.pop("id")
     68
     69        def _parse_flavor(data: object) -> Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]:
     70            try:
     71                if not isinstance(data, str):
     72                    raise TypeError()
     73                flavor_type_0 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0(data)
     74
     75
     76
     77                return flavor_type_0
     78            except: # noqa: E722
     79                pass
     80            try:
     81                if not isinstance(data, str):
     82                    raise TypeError()
     83                flavor_type_1 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1(data)
     84
     85
     86
     87                return flavor_type_1
     88            except: # noqa: E722
     89                pass
     90            if not isinstance(data, dict):
     91                raise TypeError()
     92            flavor_type_2 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2.from_dict(data)
     93
     94
     95
     96            return flavor_type_2
     97
     98        flavor = _parse_flavor(d.pop("flavor"))
     99
    100
    101        subject = d.pop("subject")
    102
    103        attempt = d.pop("attempt")
    104
    105        v1_task_get_by_status_and_workspace_response_200_tasks_item = cls(
    106            id=id,
    107            flavor=flavor,
    108            subject=subject,
    109            attempt=attempt,
    110        )
    111
    112        v1_task_get_by_status_and_workspace_response_200_tasks_item.additional_properties = d
    113        return v1_task_get_by_status_and_workspace_response_200_tasks_item
    114
    115    @property
    116    def additional_keys(self) -> List[str]:
    117        return list(self.additional_properties.keys())
    118
    119    def __getitem__(self, key: str) -> Any:
    120        return self.additional_properties[key]
    121
    122    def __setitem__(self, key: str, value: Any) -> None:
    123        self.additional_properties[key] = value
    124
    125    def __delitem__(self, key: str) -> None:
    126        del self.additional_properties[key]
    127
    128    def __contains__(self, key: str) -> bool:
    129        return key in self.additional_properties

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

     15@attr.s(auto_attribs=True)
     16class V1TaskGetByStatusAndWorkspaceResponse200TasksItem:
     17    """
     18    Attributes:
     19        id (str):
     20        flavor (Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0,
     21            V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1,
     22            V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]):
     23        subject (str):
     24        attempt (int):
     25    """
     26
     27    id: str
     28    flavor: Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]
     29    subject: str
     30    attempt: int
     31    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
     32
     33
     34    def to_dict(self) -> Dict[str, Any]:
     35        id = self.id
     36        flavor: Union[Dict[str, Any], str]
     37
     38        if isinstance(self.flavor, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0):
     39            flavor = self.flavor.value
     40
     41        elif isinstance(self.flavor, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1):
     42            flavor = self.flavor.value
     43
     44        else:
     45            flavor = self.flavor.to_dict()
     46
     47
     48
     49        subject = self.subject
     50        attempt = self.attempt
     51
     52        field_dict: Dict[str, Any] = {}
     53        field_dict.update(self.additional_properties)
     54        field_dict.update({
     55            "id": id,
     56            "flavor": flavor,
     57            "subject": subject,
     58            "attempt": attempt,
     59        })
     60
     61        return field_dict
     62
     63
     64
     65    @classmethod
     66    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
     67        d = src_dict.copy()
     68        id = d.pop("id")
     69
     70        def _parse_flavor(data: object) -> Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]:
     71            try:
     72                if not isinstance(data, str):
     73                    raise TypeError()
     74                flavor_type_0 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0(data)
     75
     76
     77
     78                return flavor_type_0
     79            except: # noqa: E722
     80                pass
     81            try:
     82                if not isinstance(data, str):
     83                    raise TypeError()
     84                flavor_type_1 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1(data)
     85
     86
     87
     88                return flavor_type_1
     89            except: # noqa: E722
     90                pass
     91            if not isinstance(data, dict):
     92                raise TypeError()
     93            flavor_type_2 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2.from_dict(data)
     94
     95
     96
     97            return flavor_type_2
     98
     99        flavor = _parse_flavor(d.pop("flavor"))
    100
    101
    102        subject = d.pop("subject")
    103
    104        attempt = d.pop("attempt")
    105
    106        v1_task_get_by_status_and_workspace_response_200_tasks_item = cls(
    107            id=id,
    108            flavor=flavor,
    109            subject=subject,
    110            attempt=attempt,
    111        )
    112
    113        v1_task_get_by_status_and_workspace_response_200_tasks_item.additional_properties = d
    114        return v1_task_get_by_status_and_workspace_response_200_tasks_item
    115
    116    @property
    117    def additional_keys(self) -> List[str]:
    118        return list(self.additional_properties.keys())
    119
    120    def __getitem__(self, key: str) -> Any:
    121        return self.additional_properties[key]
    122
    123    def __setitem__(self, key: str, value: Any) -> None:
    124        self.additional_properties[key] = value
    125
    126    def __delitem__(self, key: str) -> None:
    127        del self.additional_properties[key]
    128
    129    def __contains__(self, key: str) -> bool:
    130        return key in self.additional_properties

Attributes: id (str): flavor (Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]): subject (str): attempt (int):

V1TaskGetByStatusAndWorkspaceResponse200TasksItem( id: str, flavor: Union[wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_status_and_workspace_response_200_tasks_item_flavor_type_0.V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_status_and_workspace_response_200_tasks_item_flavor_type_1.V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1, wallaroo.wallaroo_ml_ops_api_client.models.v1_task_get_by_status_and_workspace_response_200_tasks_item_flavor_type_2.V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2], subject: str, attempt: int) View Source

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

Method generated by attrs for class V1TaskGetByStatusAndWorkspaceResponse200TasksItem.

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

    34    def to_dict(self) -> Dict[str, Any]:
    35        id = self.id
    36        flavor: Union[Dict[str, Any], str]
    37
    38        if isinstance(self.flavor, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0):
    39            flavor = self.flavor.value
    40
    41        elif isinstance(self.flavor, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1):
    42            flavor = self.flavor.value
    43
    44        else:
    45            flavor = self.flavor.to_dict()
    46
    47
    48
    49        subject = self.subject
    50        attempt = self.attempt
    51
    52        field_dict: Dict[str, Any] = {}
    53        field_dict.update(self.additional_properties)
    54        field_dict.update({
    55            "id": id,
    56            "flavor": flavor,
    57            "subject": subject,
    58            "attempt": attempt,
    59        })
    60
    61        return field_dict

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

     65    @classmethod
     66    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
     67        d = src_dict.copy()
     68        id = d.pop("id")
     69
     70        def _parse_flavor(data: object) -> Union[V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1, V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2]:
     71            try:
     72                if not isinstance(data, str):
     73                    raise TypeError()
     74                flavor_type_0 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType0(data)
     75
     76
     77
     78                return flavor_type_0
     79            except: # noqa: E722
     80                pass
     81            try:
     82                if not isinstance(data, str):
     83                    raise TypeError()
     84                flavor_type_1 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType1(data)
     85
     86
     87
     88                return flavor_type_1
     89            except: # noqa: E722
     90                pass
     91            if not isinstance(data, dict):
     92                raise TypeError()
     93            flavor_type_2 = V1TaskGetByStatusAndWorkspaceResponse200TasksItemFlavorType2.from_dict(data)
     94
     95
     96
     97            return flavor_type_2
     98
     99        flavor = _parse_flavor(d.pop("flavor"))
    100
    101
    102        subject = d.pop("subject")
    103
    104        attempt = d.pop("attempt")
    105
    106        v1_task_get_by_status_and_workspace_response_200_tasks_item = cls(
    107            id=id,
    108            flavor=flavor,
    109            subject=subject,
    110            attempt=attempt,
    111        )
    112
    113        v1_task_get_by_status_and_workspace_response_200_tasks_item.additional_properties = d
    114        return v1_task_get_by_status_and_workspace_response_200_tasks_item

additional_keys: List[str]