github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python-legacy/lakefs_client/model/commit_record_creation.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 CommitRecordCreation(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              'commit_id': (str,),  # noqa: E501
    90              'version': (int,),  # noqa: E501
    91              'committer': (str,),  # noqa: E501
    92              'message': (str,),  # noqa: E501
    93              'metarange_id': (str,),  # noqa: E501
    94              'creation_date': (int,),  # noqa: E501
    95              'parents': ([str],),  # noqa: E501
    96              'generation': (int,),  # noqa: E501
    97              'metadata': ({str: (str,)},),  # noqa: E501
    98              'force': (bool,),  # noqa: E501
    99          }
   100  
   101      @cached_property
   102      def discriminator():
   103          return None
   104  
   105  
   106      attribute_map = {
   107          'commit_id': 'commit_id',  # noqa: E501
   108          'version': 'version',  # noqa: E501
   109          'committer': 'committer',  # noqa: E501
   110          'message': 'message',  # noqa: E501
   111          'metarange_id': 'metarange_id',  # noqa: E501
   112          'creation_date': 'creation_date',  # noqa: E501
   113          'parents': 'parents',  # noqa: E501
   114          'generation': 'generation',  # noqa: E501
   115          'metadata': 'metadata',  # noqa: E501
   116          'force': 'force',  # noqa: E501
   117      }
   118  
   119      read_only_vars = {
   120      }
   121  
   122      _composed_schemas = {}
   123  
   124      @classmethod
   125      @convert_js_args_to_python_args
   126      def _from_openapi_data(cls, commit_id, version, committer, message, metarange_id, creation_date, parents, generation, *args, **kwargs):  # noqa: E501
   127          """CommitRecordCreation - a model defined in OpenAPI
   128  
   129          Args:
   130              commit_id (str): id of the commit record
   131              version (int): version of the commit record
   132              committer (str): committer of the commit record
   133              message (str): message of the commit record
   134              metarange_id (str): metarange_id of the commit record
   135              creation_date (int): Unix Epoch in seconds
   136              parents ([str]): parents of the commit record
   137              generation (int): generation of the commit record
   138  
   139          Keyword Args:
   140              _check_type (bool): if True, values for parameters in openapi_types
   141                                  will be type checked and a TypeError will be
   142                                  raised if the wrong type is input.
   143                                  Defaults to True
   144              _path_to_item (tuple/list): This is a list of keys or values to
   145                                  drill down to the model in received_data
   146                                  when deserializing a response
   147              _spec_property_naming (bool): True if the variable names in the input data
   148                                  are serialized names, as specified in the OpenAPI document.
   149                                  False if the variable names in the input data
   150                                  are pythonic names, e.g. snake case (default)
   151              _configuration (Configuration): the instance to use when
   152                                  deserializing a file_type parameter.
   153                                  If passed, type conversion is attempted
   154                                  If omitted no type conversion is done.
   155              _visited_composed_classes (tuple): This stores a tuple of
   156                                  classes that we have traveled through so that
   157                                  if we see that class again we will not use its
   158                                  discriminator again.
   159                                  When traveling through a discriminator, the
   160                                  composed schema that is
   161                                  is traveled through is added to this set.
   162                                  For example if Animal has a discriminator
   163                                  petType and we pass in "Dog", and the class Dog
   164                                  allOf includes Animal, we move through Animal
   165                                  once using the discriminator, and pick Dog.
   166                                  Then in Dog, we will make an instance of the
   167                                  Animal class but this time we won't travel
   168                                  through its discriminator because we passed in
   169                                  _visited_composed_classes = (Animal,)
   170              metadata ({str: (str,)}): metadata of the commit record. [optional]  # noqa: E501
   171              force (bool): [optional] if omitted the server will use the default value of False  # noqa: E501
   172          """
   173  
   174          _check_type = kwargs.pop('_check_type', True)
   175          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   176          _path_to_item = kwargs.pop('_path_to_item', ())
   177          _configuration = kwargs.pop('_configuration', None)
   178          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   179  
   180          self = super(OpenApiModel, cls).__new__(cls)
   181  
   182          if args:
   183              raise ApiTypeError(
   184                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   185                      args,
   186                      self.__class__.__name__,
   187                  ),
   188                  path_to_item=_path_to_item,
   189                  valid_classes=(self.__class__,),
   190              )
   191  
   192          self._data_store = {}
   193          self._check_type = _check_type
   194          self._spec_property_naming = _spec_property_naming
   195          self._path_to_item = _path_to_item
   196          self._configuration = _configuration
   197          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   198  
   199          self.commit_id = commit_id
   200          self.version = version
   201          self.committer = committer
   202          self.message = message
   203          self.metarange_id = metarange_id
   204          self.creation_date = creation_date
   205          self.parents = parents
   206          self.generation = generation
   207          for var_name, var_value in kwargs.items():
   208              if var_name not in self.attribute_map and \
   209                          self._configuration is not None and \
   210                          self._configuration.discard_unknown_keys and \
   211                          self.additional_properties_type is None:
   212                  # discard variable.
   213                  continue
   214              setattr(self, var_name, var_value)
   215          return self
   216  
   217      required_properties = set([
   218          '_data_store',
   219          '_check_type',
   220          '_spec_property_naming',
   221          '_path_to_item',
   222          '_configuration',
   223          '_visited_composed_classes',
   224      ])
   225  
   226      @convert_js_args_to_python_args
   227      def __init__(self, commit_id, version, committer, message, metarange_id, creation_date, parents, generation, *args, **kwargs):  # noqa: E501
   228          """CommitRecordCreation - a model defined in OpenAPI
   229  
   230          Args:
   231              commit_id (str): id of the commit record
   232              version (int): version of the commit record
   233              committer (str): committer of the commit record
   234              message (str): message of the commit record
   235              metarange_id (str): metarange_id of the commit record
   236              creation_date (int): Unix Epoch in seconds
   237              parents ([str]): parents of the commit record
   238              generation (int): generation of the commit record
   239  
   240          Keyword Args:
   241              _check_type (bool): if True, values for parameters in openapi_types
   242                                  will be type checked and a TypeError will be
   243                                  raised if the wrong type is input.
   244                                  Defaults to True
   245              _path_to_item (tuple/list): This is a list of keys or values to
   246                                  drill down to the model in received_data
   247                                  when deserializing a response
   248              _spec_property_naming (bool): True if the variable names in the input data
   249                                  are serialized names, as specified in the OpenAPI document.
   250                                  False if the variable names in the input data
   251                                  are pythonic names, e.g. snake case (default)
   252              _configuration (Configuration): the instance to use when
   253                                  deserializing a file_type parameter.
   254                                  If passed, type conversion is attempted
   255                                  If omitted no type conversion is done.
   256              _visited_composed_classes (tuple): This stores a tuple of
   257                                  classes that we have traveled through so that
   258                                  if we see that class again we will not use its
   259                                  discriminator again.
   260                                  When traveling through a discriminator, the
   261                                  composed schema that is
   262                                  is traveled through is added to this set.
   263                                  For example if Animal has a discriminator
   264                                  petType and we pass in "Dog", and the class Dog
   265                                  allOf includes Animal, we move through Animal
   266                                  once using the discriminator, and pick Dog.
   267                                  Then in Dog, we will make an instance of the
   268                                  Animal class but this time we won't travel
   269                                  through its discriminator because we passed in
   270                                  _visited_composed_classes = (Animal,)
   271              metadata ({str: (str,)}): metadata of the commit record. [optional]  # noqa: E501
   272              force (bool): [optional] if omitted the server will use the default value of False  # noqa: E501
   273          """
   274  
   275          _check_type = kwargs.pop('_check_type', True)
   276          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   277          _path_to_item = kwargs.pop('_path_to_item', ())
   278          _configuration = kwargs.pop('_configuration', None)
   279          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   280  
   281          if args:
   282              raise ApiTypeError(
   283                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   284                      args,
   285                      self.__class__.__name__,
   286                  ),
   287                  path_to_item=_path_to_item,
   288                  valid_classes=(self.__class__,),
   289              )
   290  
   291          self._data_store = {}
   292          self._check_type = _check_type
   293          self._spec_property_naming = _spec_property_naming
   294          self._path_to_item = _path_to_item
   295          self._configuration = _configuration
   296          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   297  
   298          self.commit_id = commit_id
   299          self.version = version
   300          self.committer = committer
   301          self.message = message
   302          self.metarange_id = metarange_id
   303          self.creation_date = creation_date
   304          self.parents = parents
   305          self.generation = generation
   306          for var_name, var_value in kwargs.items():
   307              if var_name not in self.attribute_map and \
   308                          self._configuration is not None and \
   309                          self._configuration.discard_unknown_keys and \
   310                          self.additional_properties_type is None:
   311                  # discard variable.
   312                  continue
   313              setattr(self, var_name, var_value)
   314              if var_name in self.read_only_vars:
   315                  raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
   316                                       f"class with read only attributes.")