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