text: # coding: utf-8
  
  """
      OpenAPI Petstore
  
      This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\  # noqa: E501
  
      The version of the OpenAPI document: 1.0.0
      Generated by: https://openapi-generator.tech
  """
  
  import re
  
  from petstore_api.exceptions import ApiValueError
  
  
  def check_allowed_values(allowed_values, input_variable_path, input_values,
                           validations):
      """Raises an exception if the input_values are not allowed
  
      Args:
          allowed_values (dict): the allowed_values dict
          input_variable_path (tuple): the path to the input variable
          input_values (list/str/int/float/date/datetime): the values that we
              are checking to see if they are in allowed_values
          validations (dict): the validations dict
      """
      min_collection_length = (
          validations.get(input_variable_path, {}).get('min_length') or
          validations.get(input_variable_path, {}).get('min_items', 0))
      these_allowed_values = list(allowed_values[input_variable_path].values())
      if (isinstance(input_values, list)
              and len(input_values) > min_collection_length
              and not set(input_values).issubset(
                  set(these_allowed_values))):
          invalid_values = ", ".join(
              map(str, set(input_values) - set(these_allowed_values))),
          raise ApiValueError(
              "Invalid values for `%s` [%s], must be a subset of [%s]" %
              (
                  input_variable_path[0],
                  invalid_values,
                  ", ".join(map(str, these_allowed_values))
              )
          )
      elif (isinstance(input_values, dict)
              and len(input_values) > min_collection_length
              and not set(
                  input_values.keys()).issubset(set(these_allowed_values))):
          invalid_values = ", ".join(
              map(str, set(input_values.keys()) - set(these_allowed_values)))
          raise ApiValueError(
              "Invalid keys in `%s` [%s], must be a subset of [%s]" %
              (
                  input_variable_path[0],
                  invalid_values,
                  ", ".join(map(str, these_allowed_values))
              )
          )
      elif (not isinstance(input_values, (list, dict))
              and input_values not in these_allowed_values):
          raise ApiValueError(
              "Invalid value for `%s` (%s), must be one of %s" %
              (
                  input_variable_path[0],
                  input_values,
                  these_allowed_values
              )
          )
  
  
  def check_validations(validations, input_variable_path, input_values):
      """Raises an exception if the input_values are invalid
  
      Args:
          validations (dict): the validation dictionary
          input_variable_path (tuple): the path to the input variable
          input_values (list/str/int/float/date/datetime): the values that we
              are checking
      """
      current_validations = validations[input_variable_path]
      if ('max_length' in current_validations and
              len(input_values) > current_validations['max_length']):
          raise ApiValueError(
              "Invalid value for `%s`, length must be less than or equal to "
              "`%s`" % (
                  input_variable_path[0],
                  current_validations['max_length']
              )
          )
  
      if ('min_length' in current_validations and
              len(input_values) < current_validations['min_length']):
          raise ApiValueError(
              "Invalid value for `%s`, length must be greater than or equal to "
              "`%s`" % (
                  input_variable_path[0],
                  current_validations['min_length']
              )
          )
  
      if ('max_items' in current_validations and
              len(input_values) > current_validations['max_items']):
          raise ApiValueError(
              "Invalid value for `%s`, number of items must be less than or "
              "equal to `%s`" % (
                  input_variable_path[0],
                  current_validations['max_items']
              )
          )
  
      if ('min_items' in current_validations and
              len(input_values) < current_validations['min_items']):
          raise ValueError(
              "Invalid value for `%s`, number of items must be greater than or "
              "equal to `%s`" % (
                  input_variable_path[0],
                  current_validations['min_items']
              )
          )
  
      if ('exclusive_maximum' in current_validations and
              input_values >= current_validations['exclusive_maximum']):
          raise ApiValueError(
              "Invalid value for `%s`, must be a value less than `%s`" % (
                  input_variable_path[0],
                  current_validations['exclusive_maximum']
              )
          )
  
      if ('inclusive_maximum' in current_validations and
              input_values > current_validations['inclusive_maximum']):
          raise ApiValueError(
              "Invalid value for `%s`, must be a value less than or equal to "
              "`%s`" % (
                  input_variable_path[0],
                  current_validations['inclusive_maximum']
              )
          )
  
      if ('exclusive_minimum' in current_validations and
              input_values <= current_validations['exclusive_minimum']):
          raise ApiValueError(
              "Invalid value for `%s`, must be a value greater than `%s`" %
              (
                  input_variable_path[0],
                  current_validations['exclusive_maximum']
              )
          )
  
      if ('inclusive_minimum' in current_validations and
              input_values < current_validations['inclusive_minimum']):
          raise ApiValueError(
              "Invalid value for `%s`, must be a value greater than or equal "
              "to `%s`" % (
                  input_variable_path[0],
                  current_validations['inclusive_minimum']
              )
          )
      flags = current_validations.get('regex', {}).get('flags', 0)
      if ('regex' in current_validations and
              not re.search(current_validations['regex']['pattern'],
                            input_values, flags=flags)):
          raise ApiValueError(
              r"Invalid value for `%s`, must be a follow pattern or equal to "
              r"`%s` with flags=`%s`" % (
                  input_variable_path[0],
                  current_validations['regex']['pattern'],
                  flags
              )
            )
  
  
  class ModelSimple(object):
      # the parent class of models whose type != object in their swagger/openapi
      # spec
      pass
  
  
  class ModelNormal(object):
      # the parent class of models whose type == object in their swagger/openapi
      # spec
      pass
  