github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/clients/python/bacalhau_apiclient/models/resource_usage_data.py (about)

     1  # coding: utf-8
     2  
     3  """
     4      Bacalhau API
     5  
     6      This page is the reference of the Bacalhau REST API. Project docs are available at https://docs.bacalhau.org/. Find more information about Bacalhau at https://github.com/filecoin-project/bacalhau.  # noqa: E501
     7  
     8      OpenAPI spec version: 0.3.22.post4
     9      Contact: team@bacalhau.org
    10      Generated by: https://github.com/swagger-api/swagger-codegen.git
    11  """
    12  
    13  
    14  import pprint
    15  import re  # noqa: F401
    16  
    17  import six
    18  
    19  from bacalhau_apiclient.configuration import Configuration
    20  
    21  
    22  class ResourceUsageData(object):
    23      """NOTE: This class is auto generated by the swagger code generator program.
    24  
    25      Do not edit the class manually.
    26      """
    27  
    28      """
    29      Attributes:
    30        swagger_types (dict): The key is attribute name
    31                              and the value is attribute type.
    32        attribute_map (dict): The key is attribute name
    33                              and the value is json key in definition.
    34      """
    35      swagger_types = {
    36          'cpu': 'float',
    37          'disk': 'int',
    38          'gpu': 'int',
    39          'memory': 'int'
    40      }
    41  
    42      attribute_map = {
    43          'cpu': 'CPU',
    44          'disk': 'Disk',
    45          'gpu': 'GPU',
    46          'memory': 'Memory'
    47      }
    48  
    49      def __init__(self, cpu=None, disk=None, gpu=None, memory=None, _configuration=None):  # noqa: E501
    50          """ResourceUsageData - a model defined in Swagger"""  # noqa: E501
    51          if _configuration is None:
    52              _configuration = Configuration()
    53          self._configuration = _configuration
    54  
    55          self._cpu = None
    56          self._disk = None
    57          self._gpu = None
    58          self._memory = None
    59          self.discriminator = None
    60  
    61          if cpu is not None:
    62              self.cpu = cpu
    63          if disk is not None:
    64              self.disk = disk
    65          if gpu is not None:
    66              self.gpu = gpu
    67          if memory is not None:
    68              self.memory = memory
    69  
    70      @property
    71      def cpu(self):
    72          """Gets the cpu of this ResourceUsageData.  # noqa: E501
    73  
    74          cpu units  # noqa: E501
    75  
    76          :return: The cpu of this ResourceUsageData.  # noqa: E501
    77          :rtype: float
    78          """
    79          return self._cpu
    80  
    81      @cpu.setter
    82      def cpu(self, cpu):
    83          """Sets the cpu of this ResourceUsageData.
    84  
    85          cpu units  # noqa: E501
    86  
    87          :param cpu: The cpu of this ResourceUsageData.  # noqa: E501
    88          :type: float
    89          """
    90  
    91          self._cpu = cpu
    92  
    93      @property
    94      def disk(self):
    95          """Gets the disk of this ResourceUsageData.  # noqa: E501
    96  
    97          bytes  # noqa: E501
    98  
    99          :return: The disk of this ResourceUsageData.  # noqa: E501
   100          :rtype: int
   101          """
   102          return self._disk
   103  
   104      @disk.setter
   105      def disk(self, disk):
   106          """Sets the disk of this ResourceUsageData.
   107  
   108          bytes  # noqa: E501
   109  
   110          :param disk: The disk of this ResourceUsageData.  # noqa: E501
   111          :type: int
   112          """
   113  
   114          self._disk = disk
   115  
   116      @property
   117      def gpu(self):
   118          """Gets the gpu of this ResourceUsageData.  # noqa: E501
   119  
   120  
   121          :return: The gpu of this ResourceUsageData.  # noqa: E501
   122          :rtype: int
   123          """
   124          return self._gpu
   125  
   126      @gpu.setter
   127      def gpu(self, gpu):
   128          """Sets the gpu of this ResourceUsageData.
   129  
   130  
   131          :param gpu: The gpu of this ResourceUsageData.  # noqa: E501
   132          :type: int
   133          """
   134  
   135          self._gpu = gpu
   136  
   137      @property
   138      def memory(self):
   139          """Gets the memory of this ResourceUsageData.  # noqa: E501
   140  
   141          bytes  # noqa: E501
   142  
   143          :return: The memory of this ResourceUsageData.  # noqa: E501
   144          :rtype: int
   145          """
   146          return self._memory
   147  
   148      @memory.setter
   149      def memory(self, memory):
   150          """Sets the memory of this ResourceUsageData.
   151  
   152          bytes  # noqa: E501
   153  
   154          :param memory: The memory of this ResourceUsageData.  # noqa: E501
   155          :type: int
   156          """
   157  
   158          self._memory = memory
   159  
   160      def to_dict(self):
   161          """Returns the model properties as a dict"""
   162          result = {}
   163  
   164          for attr, _ in six.iteritems(self.swagger_types):
   165              value = getattr(self, attr)
   166              if isinstance(value, list):
   167                  result[attr] = list(map(
   168                      lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
   169                      value
   170                  ))
   171              elif hasattr(value, "to_dict"):
   172                  result[attr] = value.to_dict()
   173              elif isinstance(value, dict):
   174                  result[attr] = dict(map(
   175                      lambda item: (item[0], item[1].to_dict())
   176                      if hasattr(item[1], "to_dict") else item,
   177                      value.items()
   178                  ))
   179              else:
   180                  result[attr] = value
   181          if issubclass(ResourceUsageData, dict):
   182              for key, value in self.items():
   183                  result[key] = value
   184  
   185          return result
   186  
   187      def to_str(self):
   188          """Returns the string representation of the model"""
   189          return pprint.pformat(self.to_dict())
   190  
   191      def __repr__(self):
   192          """For `print` and `pprint`"""
   193          return self.to_str()
   194  
   195      def __eq__(self, other):
   196          """Returns true if both objects are equal"""
   197          if not isinstance(other, ResourceUsageData):
   198              return False
   199  
   200          return self.to_dict() == other.to_dict()
   201  
   202      def __ne__(self, other):
   203          """Returns true if both objects are not equal"""
   204          if not isinstance(other, ResourceUsageData):
   205              return True
   206  
   207          return self.to_dict() != other.to_dict()