wallaroo.wallaroo_ml_ops_api_client.types API documentation

# wallaroo.wallaroo_ml_ops_api_client.types

Contains some shared types for properties

View Source

     1""" Contains some shared types for properties """
     2from typing import BinaryIO, Generic, MutableMapping, Optional, Tuple, TypeVar
     3
     4import attr
     5
     6
     7class Unset:
     8    def __bool__(self) -> bool:
     9        return False
    10
    11
    12UNSET: Unset = Unset()
    13
    14FileJsonType = Tuple[Optional[str], BinaryIO, Optional[str]]
    15
    16
    17@attr.s(auto_attribs=True)
    18class File:
    19    """ Contains information for file uploads """
    20
    21    payload: BinaryIO
    22    file_name: Optional[str] = None
    23    mime_type: Optional[str] = None
    24
    25    def to_tuple(self) -> FileJsonType:
    26        """ Return a tuple representation that httpx will accept for multipart/form-data """
    27        return self.file_name, self.payload, self.mime_type
    28
    29
    30T = TypeVar("T")
    31
    32
    33@attr.s(auto_attribs=True)
    34class Response(Generic[T]):
    35    """ A response from an endpoint """
    36
    37    status_code: int
    38    content: bytes
    39    headers: MutableMapping[str, str]
    40    parsed: Optional[T]
    41
    42
    43__all__ = ["File", "Response", "FileJsonType"]

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

    18@attr.s(auto_attribs=True)
    19class File:
    20    """ Contains information for file uploads """
    21
    22    payload: BinaryIO
    23    file_name: Optional[str] = None
    24    mime_type: Optional[str] = None
    25
    26    def to_tuple(self) -> FileJsonType:
    27        """ Return a tuple representation that httpx will accept for multipart/form-data """
    28        return self.file_name, self.payload, self.mime_type

Contains information for file uploads

File( payload: <class 'BinaryIO'>, file_name: Optional[str] = None, mime_type: Optional[str] = None) View Source

    2def __init__(self, payload, file_name=attr_dict['file_name'].default, mime_type=attr_dict['mime_type'].default):
    3    self.payload = payload
    4    self.file_name = file_name
    5    self.mime_type = mime_type

Method generated by attrs for class File.

def to_tuple(self) -> Tuple[Optional[str], BinaryIO, Optional[str]]: View Source

    26    def to_tuple(self) -> FileJsonType:
    27        """ Return a tuple representation that httpx will accept for multipart/form-data """
    28        return self.file_name, self.payload, self.mime_type

Return a tuple representation that httpx will accept for multipart/form-data

@attr.s(auto_attribs=True)
class Response(typing.Generic[~T]): View Source

    34@attr.s(auto_attribs=True)
    35class Response(Generic[T]):
    36    """ A response from an endpoint """
    37
    38    status_code: int
    39    content: bytes
    40    headers: MutableMapping[str, str]
    41    parsed: Optional[T]

A response from an endpoint

Response( status_code: int, content: bytes, headers: MutableMapping[str, str], parsed: Optional[~T]) View Source

    2def __init__(self, status_code, content, headers, parsed):
    3    self.status_code = status_code
    4    self.content = content
    5    self.headers = headers
    6    self.parsed = parsed

Method generated by attrs for class Response.

FileJsonType = typing.Tuple[typing.Optional[str], typing.BinaryIO, typing.Optional[str]]