github.com/treeverse/lakefs@v1.24.1-0.20240520134607-95648127bfb0/clients/python-legacy/lakefs_client/model/diff.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 Diff(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          ('type',): {
    60              'ADDED': "added",
    61              'REMOVED': "removed",
    62              'CHANGED': "changed",
    63              'CONFLICT': "conflict",
    64              'PREFIX_CHANGED': "prefix_changed",
    65          },
    66          ('path_type',): {
    67              'COMMON_PREFIX': "common_prefix",
    68              'OBJECT': "object",
    69          },
    70      }
    71  
    72      validations = {
    73      }
    74  
    75      @cached_property
    76      def additional_properties_type():
    77          """
    78          This must be a method because a model may have properties that are
    79          of type self, this must run after the class is loaded
    80          """
    81          return (bool, date, datetime, dict, float, int, list, str, none_type,)  # noqa: E501
    82  
    83      _nullable = False
    84  
    85      @cached_property
    86      def openapi_types():
    87          """
    88          This must be a method because a model may have properties that are
    89          of type self, this must run after the class is loaded
    90  
    91          Returns
    92              openapi_types (dict): The key is attribute name
    93                  and the value is attribute type.
    94          """
    95          return {
    96              'type': (str,),  # noqa: E501
    97              'path': (str,),  # noqa: E501
    98              'path_type': (str,),  # noqa: E501
    99              'size_bytes': (int,),  # noqa: E501
   100          }
   101  
   102      @cached_property
   103      def discriminator():
   104          return None
   105  
   106  
   107      attribute_map = {
   108          'type': 'type',  # noqa: E501
   109          'path': 'path',  # noqa: E501
   110          'path_type': 'path_type',  # noqa: E501
   111          'size_bytes': 'size_bytes',  # noqa: E501
   112      }
   113  
   114      read_only_vars = {
   115      }
   116  
   117      _composed_schemas = {}
   118  
   119      @classmethod
   120      @convert_js_args_to_python_args
   121      def _from_openapi_data(cls, type, path, path_type, *args, **kwargs):  # noqa: E501
   122          """Diff - a model defined in OpenAPI
   123  
   124          Args:
   125              type (str):
   126              path (str):
   127              path_type (str):
   128  
   129          Keyword Args:
   130              _check_type (bool): if True, values for parameters in openapi_types
   131                                  will be type checked and a TypeError will be
   132                                  raised if the wrong type is input.
   133                                  Defaults to True
   134              _path_to_item (tuple/list): This is a list of keys or values to
   135                                  drill down to the model in received_data
   136                                  when deserializing a response
   137              _spec_property_naming (bool): True if the variable names in the input data
   138                                  are serialized names, as specified in the OpenAPI document.
   139                                  False if the variable names in the input data
   140                                  are pythonic names, e.g. snake case (default)
   141              _configuration (Configuration): the instance to use when
   142                                  deserializing a file_type parameter.
   143                                  If passed, type conversion is attempted
   144                                  If omitted no type conversion is done.
   145              _visited_composed_classes (tuple): This stores a tuple of
   146                                  classes that we have traveled through so that
   147                                  if we see that class again we will not use its
   148                                  discriminator again.
   149                                  When traveling through a discriminator, the
   150                                  composed schema that is
   151                                  is traveled through is added to this set.
   152                                  For example if Animal has a discriminator
   153                                  petType and we pass in "Dog", and the class Dog
   154                                  allOf includes Animal, we move through Animal
   155                                  once using the discriminator, and pick Dog.
   156                                  Then in Dog, we will make an instance of the
   157                                  Animal class but this time we won't travel
   158                                  through its discriminator because we passed in
   159                                  _visited_composed_classes = (Animal,)
   160              size_bytes (int): represents the size of the added/changed/deleted entry. [optional]  # noqa: E501
   161          """
   162  
   163          _check_type = kwargs.pop('_check_type', True)
   164          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   165          _path_to_item = kwargs.pop('_path_to_item', ())
   166          _configuration = kwargs.pop('_configuration', None)
   167          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   168  
   169          self = super(OpenApiModel, cls).__new__(cls)
   170  
   171          if args:
   172              raise ApiTypeError(
   173                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   174                      args,
   175                      self.__class__.__name__,
   176                  ),
   177                  path_to_item=_path_to_item,
   178                  valid_classes=(self.__class__,),
   179              )
   180  
   181          self._data_store = {}
   182          self._check_type = _check_type
   183          self._spec_property_naming = _spec_property_naming
   184          self._path_to_item = _path_to_item
   185          self._configuration = _configuration
   186          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   187  
   188          self.type = type
   189          self.path = path
   190          self.path_type = path_type
   191          for var_name, var_value in kwargs.items():
   192              if var_name not in self.attribute_map and \
   193                          self._configuration is not None and \
   194                          self._configuration.discard_unknown_keys and \
   195                          self.additional_properties_type is None:
   196                  # discard variable.
   197                  continue
   198              setattr(self, var_name, var_value)
   199          return self
   200  
   201      required_properties = set([
   202          '_data_store',
   203          '_check_type',
   204          '_spec_property_naming',
   205          '_path_to_item',
   206          '_configuration',
   207          '_visited_composed_classes',
   208      ])
   209  
   210      @convert_js_args_to_python_args
   211      def __init__(self, type, path, path_type, *args, **kwargs):  # noqa: E501
   212          """Diff - a model defined in OpenAPI
   213  
   214          Args:
   215              type (str):
   216              path (str):
   217              path_type (str):
   218  
   219          Keyword Args:
   220              _check_type (bool): if True, values for parameters in openapi_types
   221                                  will be type checked and a TypeError will be
   222                                  raised if the wrong type is input.
   223                                  Defaults to True
   224              _path_to_item (tuple/list): This is a list of keys or values to
   225                                  drill down to the model in received_data
   226                                  when deserializing a response
   227              _spec_property_naming (bool): True if the variable names in the input data
   228                                  are serialized names, as specified in the OpenAPI document.
   229                                  False if the variable names in the input data
   230                                  are pythonic names, e.g. snake case (default)
   231              _configuration (Configuration): the instance to use when
   232                                  deserializing a file_type parameter.
   233                                  If passed, type conversion is attempted
   234                                  If omitted no type conversion is done.
   235              _visited_composed_classes (tuple): This stores a tuple of
   236                                  classes that we have traveled through so that
   237                                  if we see that class again we will not use its
   238                                  discriminator again.
   239                                  When traveling through a discriminator, the
   240                                  composed schema that is
   241                                  is traveled through is added to this set.
   242                                  For example if Animal has a discriminator
   243                                  petType and we pass in "Dog", and the class Dog
   244                                  allOf includes Animal, we move through Animal
   245                                  once using the discriminator, and pick Dog.
   246                                  Then in Dog, we will make an instance of the
   247                                  Animal class but this time we won't travel
   248                                  through its discriminator because we passed in
   249                                  _visited_composed_classes = (Animal,)
   250              size_bytes (int): represents the size of the added/changed/deleted entry. [optional]  # noqa: E501
   251          """
   252  
   253          _check_type = kwargs.pop('_check_type', True)
   254          _spec_property_naming = kwargs.pop('_spec_property_naming', False)
   255          _path_to_item = kwargs.pop('_path_to_item', ())
   256          _configuration = kwargs.pop('_configuration', None)
   257          _visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
   258  
   259          if args:
   260              raise ApiTypeError(
   261                  "Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
   262                      args,
   263                      self.__class__.__name__,
   264                  ),
   265                  path_to_item=_path_to_item,
   266                  valid_classes=(self.__class__,),
   267              )
   268  
   269          self._data_store = {}
   270          self._check_type = _check_type
   271          self._spec_property_naming = _spec_property_naming
   272          self._path_to_item = _path_to_item
   273          self._configuration = _configuration
   274          self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
   275  
   276          self.type = type
   277          self.path = path
   278          self.path_type = path_type
   279          for var_name, var_value in kwargs.items():
   280              if var_name not in self.attribute_map and \
   281                          self._configuration is not None and \
   282                          self._configuration.discard_unknown_keys and \
   283                          self.additional_properties_type is None:
   284                  # discard variable.
   285                  continue
   286              setattr(self, var_name, var_value)
   287              if var_name in self.read_only_vars:
   288                  raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
   289                                       f"class with read only attributes.")