github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python-legacy/lakefs_client/model/commit.py (about)

     1  """
     2      lakeFS API
     3  
     4      lakeFS HTTP API  # noqa: E501
     5  
     6      The version of the OpenAPI document: 1.0.0
     7      Contact: services@treeverse.io
     8      Generated by: https://openapi-generator.tech
     9  """
    10  
    11  
    12  import re  # noqa: F401
    13  import sys  # noqa: F401
    14  
    15  from lakefs_client.model_utils import (  # noqa: F401
    16      ApiTypeError,
    17      ModelComposed,
    18      ModelNormal,
    19      ModelSimple,
    20      cached_property,
    21      change_keys_js_to_python,
    22      convert_js_args_to_python_args,
    23      date,
    24      datetime,
    25      file_type,
    26      none_type,
    27      validate_get_composed_info,
    28  )
    29  from ..model_utils import OpenApiModel
    30  from lakefs_client.exceptions import ApiAttributeError
    31  
    32  
    33  
    34  class Commit(ModelNormal):
    35      """NOTE: This class is auto generated by OpenAPI Generator.
    36      Ref: https://openapi-generator.tech
    37  
    38      Do not edit the class manually.
    39  
    40      Attributes:
    41        allowed_values (dict): The key is the tuple path to the attribute
    42            and the for var_name this is (var_name,). The value is a dict
    43            with a capitalized key describing the allowed value and an allowed
    44            value. These dicts store the allowed enum values.
    45        attribute_map (dict): The key is attribute name
    46            and the value is json key in definition.
    47        discriminator_value_class_map (dict): A dict to go from the discriminator
    48            variable value to the discriminator class name.
    49        validations (dict): The key is the tuple path to the attribute
    50            and the for var_name this is (var_name,). The value is a dict
    51            that stores validations for max_length, min_length, max_items,
    52            min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
    53            inclusive_minimum, and regex.
    54        additional_properties_type (tuple): A tuple of classes accepted
    55            as additional properties values.
    56      """
    57  
    58      allowed_values = {
    59      }
    60  
    61      validations = {
    62          ('version',): {
    63              'inclusive_maximum': 1,
    64              'inclusive_minimum': 0,
    65          },
    66      }
    67  
    68      @cached_property
    69      def additional_properties_type():
    70          """
    71          This must be a method because a model may have properties that are
    72          of type self, this must run after the class is loaded
    73          """
    74          return (bool, date, datetime, dict, float, int, list, str, none_type,)  # noqa: E501
    75  
    76      _nullable = False
    77  
    78      @cached_property
    79      def openapi_types():
    80          """
    81          This must be a method because a model may have properties that are
    82          of type self, this must run after the class is loaded
    83  
    84          Returns
    85              openapi_types (dict): The key is attribute name
    86                  and the value is attribute type.
    87          """
    88          return {
    89              'id': (str,),  # noqa: E501
    90              'parents': ([str],),  # noqa: E501
    91              'committer': (str,),  # noqa: E501
    92              'message': (str,),  # noqa: E501
    93              'creation_date': (int,),  # noqa: E501
    94              'meta_range_id': (str,),  # noqa: E501
    95              'metadata': ({str: (str,)},),  # noqa: E501
    96              'generation': (int,),  # noqa: E501
    97              'version': (int,),  # noqa: E501
    98          }
    99  
   100      @cached_property
   101      def discriminator():
   102          return None
   103  
   104  
   105      attribute_map = {
   106          'id': 'id',  # noqa: E501
   107          'parents': 'parents',  # noqa: E501
   108          'committer': 'committer',  # noqa: E501
   109          'message': 'message',  # noqa: E501
   110          'creation_date': 'creation_date',  # noqa: E501
   111          'meta_range_id': 'meta_range_id',  # noqa: E501
   112          'metadata': 'metadata',  # noqa: E501
   113          'generation': 'generation',  # noqa: E501
   114          'version': 'version',  # noqa: E501
   115      }
   116  
   117      read_only_vars = {
   118      }
   119  
   120      _composed_schemas = {}
   121  
   122      @classmethod
   123      @convert_js_args_to_python_args
   124      def _from_openapi_data(cls, id, parents, committer, message, creation_date, meta_range_id, *args, **kwargs):  # noqa: E501
   125          """Commit - a model defined in OpenAPI
   126  
   127          Args:
   128              id (str):
   129              parents ([str]):
   130              committer (str):
   131              message (str):
   132              creation_date (int): Unix Epoch in seconds
   133              meta_range_id (str):
   134  
   135          Keyword Args:
   136              _check_type (bool): if True, values for parameters in openapi_types
   137                                  will be type checked and a TypeError will be
   138                                  raised if the wrong type is input.
   139                                  Defaults to True
   140              _path_to_item (tuple/list): This is a list of keys or values to
   141                                  drill down to the model in received_data
   142                                  when deserializing a response
   143              _spec_property_naming (bool): True if the variable names in the input data
   144                                  are serialized names, as specified in the OpenAPI document.
   145                                  False if the variable names in the input data
   146                                  are pythonic names, e.g. snake case (default)
   147              _configuration (Configuration): the instance to use when
   148                                  deserializing a file_type parameter.
   149                                  If passed, type conversion is attempted
   150                                  If omitted no type conversion is done.
   151              _visited_composed_classes (tuple): This stores a tuple of
   152                                  classes that we have traveled through so that
   153                                  if we see that class again we will not use its
   154                                  discriminator again.
   155                                  When traveling through a discriminator, the
   156                                  composed schema that is
   157                                  is traveled through is added to this set.
   158                                  For example if Animal has a discriminator
   159                                  petType and we pass in "Dog", and the class Dog
   160                                  allOf includes Animal, we move through Animal
   161                                  once using the discriminator, and pick Dog.
   162                                  Then in Dog, we will make an instance of the
   163                                  Animal class but this time we won't travel
   164                                  through its discriminator because we passed in
   165                                  _visited_composed_classes = (Animal,)
   166              metadata ({str: (str,)}): [optional]  # noqa: E501
   167              generation (int): [optional]  # noqa: E501
   168              version (int): [optional]  # noqa: E501
   169          """
   170  
   171          _check_type = kwargs.pop('_check_type', True)
   172          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   173          _path_to_item = kwargs.pop('_path_to_item', ())
   174          _configuration = kwargs.pop('_configuration', None)
   175          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   176  
   177          self = super(OpenApiModel, cls).__new__(cls)
   178  
   179          if args:
   180              raise ApiTypeError(
   181                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   182                      args,
   183                      self.__class__.__name__,
   184                  ),
   185                  path_to_item=_path_to_item,
   186                  valid_classes=(self.__class__,),
   187              )
   188  
   189          self._data_store = {}
   190          self._check_type = _check_type
   191          self._spec_property_naming = _spec_property_naming
   192          self._path_to_item = _path_to_item
   193          self._configuration = _configuration
   194          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   195  
   196          self.id = id
   197          self.parents = parents
   198          self.committer = committer
   199          self.message = message
   200          self.creation_date = creation_date
   201          self.meta_range_id = meta_range_id
   202          for var_name, var_value in kwargs.items():
   203              if var_name not in self.attribute_map and \
   204                          self._configuration is not None and \
   205                          self._configuration.discard_unknown_keys and \
   206                          self.additional_properties_type is None:
   207                  # discard variable.
   208                  continue
   209              setattr(self, var_name, var_value)
   210          return self
   211  
   212      required_properties = set([
   213          '_data_store',
   214          '_check_type',
   215          '_spec_property_naming',
   216          '_path_to_item',
   217          '_configuration',
   218          '_visited_composed_classes',
   219      ])
   220  
   221      @convert_js_args_to_python_args
   222      def __init__(self, id, parents, committer, message, creation_date, meta_range_id, *args, **kwargs):  # noqa: E501
   223          """Commit - a model defined in OpenAPI
   224  
   225          Args:
   226              id (str):
   227              parents ([str]):
   228              committer (str):
   229              message (str):
   230              creation_date (int): Unix Epoch in seconds
   231              meta_range_id (str):
   232  
   233          Keyword Args:
   234              _check_type (bool): if True, values for parameters in openapi_types
   235                                  will be type checked and a TypeError will be
   236                                  raised if the wrong type is input.
   237                                  Defaults to True
   238              _path_to_item (tuple/list): This is a list of keys or values to
   239                                  drill down to the model in received_data
   240                                  when deserializing a response
   241              _spec_property_naming (bool): True if the variable names in the input data
   242                                  are serialized names, as specified in the OpenAPI document.
   243                                  False if the variable names in the input data
   244                                  are pythonic names, e.g. snake case (default)
   245              _configuration (Configuration): the instance to use when
   246                                  deserializing a file_type parameter.
   247                                  If passed, type conversion is attempted
   248                                  If omitted no type conversion is done.
   249              _visited_composed_classes (tuple): This stores a tuple of
   250                                  classes that we have traveled through so that
   251                                  if we see that class again we will not use its
   252                                  discriminator again.
   253                                  When traveling through a discriminator, the
   254                                  composed schema that is
   255                                  is traveled through is added to this set.
   256                                  For example if Animal has a discriminator
   257                                  petType and we pass in "Dog", and the class Dog
   258                                  allOf includes Animal, we move through Animal
   259                                  once using the discriminator, and pick Dog.
   260                                  Then in Dog, we will make an instance of the
   261                                  Animal class but this time we won't travel
   262                                  through its discriminator because we passed in
   263                                  _visited_composed_classes = (Animal,)
   264              metadata ({str: (str,)}): [optional]  # noqa: E501
   265              generation (int): [optional]  # noqa: E501
   266              version (int): [optional]  # noqa: E501
   267          """
   268  
   269          _check_type = kwargs.pop('_check_type', True)
   270          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   271          _path_to_item = kwargs.pop('_path_to_item', ())
   272          _configuration = kwargs.pop('_configuration', None)
   273          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   274  
   275          if args:
   276              raise ApiTypeError(
   277                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   278                      args,
   279                      self.__class__.__name__,
   280                  ),
   281                  path_to_item=_path_to_item,
   282                  valid_classes=(self.__class__,),
   283              )
   284  
   285          self._data_store = {}
   286          self._check_type = _check_type
   287          self._spec_property_naming = _spec_property_naming
   288          self._path_to_item = _path_to_item
   289          self._configuration = _configuration
   290          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   291  
   292          self.id = id
   293          self.parents = parents
   294          self.committer = committer
   295          self.message = message
   296          self.creation_date = creation_date
   297          self.meta_range_id = meta_range_id
   298          for var_name, var_value in kwargs.items():
   299              if var_name not in self.attribute_map and \
   300                          self._configuration is not None and \
   301                          self._configuration.discard_unknown_keys and \
   302                          self.additional_properties_type is None:
   303                  # discard variable.
   304                  continue
   305              setattr(self, var_name, var_value)
   306              if var_name in self.read_only_vars:
   307                  raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
   308                                       f"class with read only attributes.")