wallaroo.wallaroo_ml_ops_api_client.models.models_upload_multipart_data API documentation

# wallaroo.wallaroo_ml_ops_api_client.models.models_upload_multipart_data

View Source

     1from typing import Any, Dict, List, Type, TypeVar
     2
     3import attr
     4
     5from ..models.models_upload_multipart_data_visibility import \
     6    ModelsUploadMultipartDataVisibility
     7from ..types import Unset
     8
     9T = TypeVar("T", bound="ModelsUploadMultipartData")
    10
    11@attr.s(auto_attribs=True)
    12class ModelsUploadMultipartData:
    13    """ Model upload request.
    14
    15    Attributes:
    16        name (str):  Model name.
    17        visibility (ModelsUploadMultipartDataVisibility):  Desired model visibility.
    18        workspace_id (int):  Workspace identifier.
    19    """
    20
    21    name: str
    22    visibility: ModelsUploadMultipartDataVisibility
    23    workspace_id: int
    24    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
    25
    26
    27    def to_dict(self) -> Dict[str, Any]:
    28        name = self.name
    29        visibility = self.visibility.value
    30
    31        workspace_id = self.workspace_id
    32
    33        field_dict: Dict[str, Any] = {}
    34        field_dict.update(self.additional_properties)
    35        field_dict.update({
    36            "name": name,
    37            "visibility": visibility,
    38            "workspace_id": workspace_id,
    39        })
    40
    41        return field_dict
    42
    43
    44    def to_multipart(self) -> Dict[str, Any]:
    45        name = self.name if isinstance(self.name, Unset) else (None, str(self.name).encode(), "text/plain")
    46        visibility = (None, str(self.visibility.value).encode(), "text/plain")
    47
    48        workspace_id = self.workspace_id if isinstance(self.workspace_id, Unset) else (None, str(self.workspace_id).encode(), "text/plain")
    49
    50        field_dict: Dict[str, Any] = {}
    51        field_dict.update({
    52            key: (None, str(value).encode(), "text/plain")
    53            for key, value in self.additional_properties.items()
    54        })
    55        field_dict.update({
    56            "name": name,
    57            "visibility": visibility,
    58            "workspace_id": workspace_id,
    59        })
    60
    61        return field_dict
    62
    63
    64    @classmethod
    65    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
    66        d = src_dict.copy()
    67        name = d.pop("name")
    68
    69        visibility = ModelsUploadMultipartDataVisibility(d.pop("visibility"))
    70
    71
    72
    73
    74        workspace_id = d.pop("workspace_id")
    75
    76        models_upload_multipart_data = cls(
    77            name=name,
    78            visibility=visibility,
    79            workspace_id=workspace_id,
    80        )
    81
    82        models_upload_multipart_data.additional_properties = d
    83        return models_upload_multipart_data
    84
    85    @property
    86    def additional_keys(self) -> List[str]:
    87        return list(self.additional_properties.keys())
    88
    89    def __getitem__(self, key: str) -> Any:
    90        return self.additional_properties[key]
    91
    92    def __setitem__(self, key: str, value: Any) -> None:
    93        self.additional_properties[key] = value
    94
    95    def __delitem__(self, key: str) -> None:
    96        del self.additional_properties[key]
    97
    98    def __contains__(self, key: str) -> bool:
    99        return key in self.additional_properties

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

     12@attr.s(auto_attribs=True)
     13class ModelsUploadMultipartData:
     14    """ Model upload request.
     15
     16    Attributes:
     17        name (str):  Model name.
     18        visibility (ModelsUploadMultipartDataVisibility):  Desired model visibility.
     19        workspace_id (int):  Workspace identifier.
     20    """
     21
     22    name: str
     23    visibility: ModelsUploadMultipartDataVisibility
     24    workspace_id: int
     25    additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
     26
     27
     28    def to_dict(self) -> Dict[str, Any]:
     29        name = self.name
     30        visibility = self.visibility.value
     31
     32        workspace_id = self.workspace_id
     33
     34        field_dict: Dict[str, Any] = {}
     35        field_dict.update(self.additional_properties)
     36        field_dict.update({
     37            "name": name,
     38            "visibility": visibility,
     39            "workspace_id": workspace_id,
     40        })
     41
     42        return field_dict
     43
     44
     45    def to_multipart(self) -> Dict[str, Any]:
     46        name = self.name if isinstance(self.name, Unset) else (None, str(self.name).encode(), "text/plain")
     47        visibility = (None, str(self.visibility.value).encode(), "text/plain")
     48
     49        workspace_id = self.workspace_id if isinstance(self.workspace_id, Unset) else (None, str(self.workspace_id).encode(), "text/plain")
     50
     51        field_dict: Dict[str, Any] = {}
     52        field_dict.update({
     53            key: (None, str(value).encode(), "text/plain")
     54            for key, value in self.additional_properties.items()
     55        })
     56        field_dict.update({
     57            "name": name,
     58            "visibility": visibility,
     59            "workspace_id": workspace_id,
     60        })
     61
     62        return field_dict
     63
     64
     65    @classmethod
     66    def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
     67        d = src_dict.copy()
     68        name = d.pop("name")
     69
     70        visibility = ModelsUploadMultipartDataVisibility(d.pop("visibility"))
     71
     72
     73
     74
     75        workspace_id = d.pop("workspace_id")
     76
     77        models_upload_multipart_data = cls(
     78            name=name,
     79            visibility=visibility,
     80            workspace_id=workspace_id,
     81        )
     82
     83        models_upload_multipart_data.additional_properties = d
     84        return models_upload_multipart_data
     85
     86    @property
     87    def additional_keys(self) -> List[str]:
     88        return list(self.additional_properties.keys())
     89
     90    def __getitem__(self, key: str) -> Any:
     91        return self.additional_properties[key]
     92
     93    def __setitem__(self, key: str, value: Any) -> None:
     94        self.additional_properties[key] = value
     95
     96    def __delitem__(self, key: str) -> None:
     97        del self.additional_properties[key]
     98
     99    def __contains__(self, key: str) -> bool:
    100        return key in self.additional_properties

Model upload request.

Attributes: name (str): Model name. visibility (ModelsUploadMultipartDataVisibility): Desired model visibility. workspace_id (int): Workspace identifier.

ModelsUploadMultipartData( name: str, visibility: wallaroo.wallaroo_ml_ops_api_client.models.models_upload_multipart_data_visibility.ModelsUploadMultipartDataVisibility, workspace_id: int) View Source

    2def __init__(self, name, visibility, workspace_id):
    3    self.name = name
    4    self.visibility = visibility
    5    self.workspace_id = workspace_id
    6    self.additional_properties = __attr_factory_additional_properties()

Method generated by attrs for class ModelsUploadMultipartData.

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

    28    def to_dict(self) -> Dict[str, Any]:
    29        name = self.name
    30        visibility = self.visibility.value
    31
    32        workspace_id = self.workspace_id
    33
    34        field_dict: Dict[str, Any] = {}
    35        field_dict.update(self.additional_properties)
    36        field_dict.update({
    37            "name": name,
    38            "visibility": visibility,
    39            "workspace_id": workspace_id,
    40        })
    41
    42        return field_dict

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

    45    def to_multipart(self) -> Dict[str, Any]:
    46        name = self.name if isinstance(self.name, Unset) else (None, str(self.name).encode(), "text/plain")
    47        visibility = (None, str(self.visibility.value).encode(), "text/plain")
    48
    49        workspace_id = self.workspace_id if isinstance(self.workspace_id, Unset) else (None, str(self.workspace_id).encode(), "text/plain")
    50
    51        field_dict: Dict[str, Any] = {}
    52        field_dict.update({
    53            key: (None, str(value).encode(), "text/plain")
    54            for key, value in self.additional_properties.items()
    55        })
    56        field_dict.update({
    57            "name": name,
    58            "visibility": visibility,
    59            "workspace_id": workspace_id,
    60        })
    61
    62        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        name = d.pop("name")
    69
    70        visibility = ModelsUploadMultipartDataVisibility(d.pop("visibility"))
    71
    72
    73
    74
    75        workspace_id = d.pop("workspace_id")
    76
    77        models_upload_multipart_data = cls(
    78            name=name,
    79            visibility=visibility,
    80            workspace_id=workspace_id,
    81        )
    82
    83        models_upload_multipart_data.additional_properties = d
    84        return models_upload_multipart_data

additional_keys: List[str]