/samples/client/petstore/python-asyncio/petstore_api/models/format_test.py

https://github.com/OpenAPITools/openapi-generator · Python · 504 lines · 247 code · 63 blank · 194 comment · 58 complexity · 7a3f66b52f631cb5f058282723f7baa3 MD5 · raw file

  1. # coding: utf-8
  2. """
  3. OpenAPI Petstore
  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. The version of the OpenAPI document: 1.0.0
  6. Generated by: https://openapi-generator.tech
  7. """
  8. import pprint
  9. import re # noqa: F401
  10. import six
  11. from petstore_api.configuration import Configuration
  12. class FormatTest(object):
  13. """NOTE: This class is auto generated by OpenAPI Generator.
  14. Ref: https://openapi-generator.tech
  15. Do not edit the class manually.
  16. """
  17. """
  18. Attributes:
  19. openapi_types (dict): The key is attribute name
  20. and the value is attribute type.
  21. attribute_map (dict): The key is attribute name
  22. and the value is json key in definition.
  23. """
  24. openapi_types = {
  25. 'integer': 'int',
  26. 'int32': 'int',
  27. 'int64': 'int',
  28. 'number': 'float',
  29. 'float': 'float',
  30. 'double': 'float',
  31. 'string': 'str',
  32. 'byte': 'str',
  33. 'binary': 'file',
  34. 'date': 'date',
  35. 'date_time': 'datetime',
  36. 'uuid': 'str',
  37. 'password': 'str',
  38. 'big_decimal': 'BigDecimal'
  39. }
  40. attribute_map = {
  41. 'integer': 'integer',
  42. 'int32': 'int32',
  43. 'int64': 'int64',
  44. 'number': 'number',
  45. 'float': 'float',
  46. 'double': 'double',
  47. 'string': 'string',
  48. 'byte': 'byte',
  49. 'binary': 'binary',
  50. 'date': 'date',
  51. 'date_time': 'dateTime',
  52. 'uuid': 'uuid',
  53. 'password': 'password',
  54. 'big_decimal': 'BigDecimal'
  55. }
  56. def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None, big_decimal=None, local_vars_configuration=None): # noqa: E501
  57. """FormatTest - a model defined in OpenAPI""" # noqa: E501
  58. if local_vars_configuration is None:
  59. local_vars_configuration = Configuration()
  60. self.local_vars_configuration = local_vars_configuration
  61. self._integer = None
  62. self._int32 = None
  63. self._int64 = None
  64. self._number = None
  65. self._float = None
  66. self._double = None
  67. self._string = None
  68. self._byte = None
  69. self._binary = None
  70. self._date = None
  71. self._date_time = None
  72. self._uuid = None
  73. self._password = None
  74. self._big_decimal = None
  75. self.discriminator = None
  76. if integer is not None:
  77. self.integer = integer
  78. if int32 is not None:
  79. self.int32 = int32
  80. if int64 is not None:
  81. self.int64 = int64
  82. self.number = number
  83. if float is not None:
  84. self.float = float
  85. if double is not None:
  86. self.double = double
  87. if string is not None:
  88. self.string = string
  89. self.byte = byte
  90. if binary is not None:
  91. self.binary = binary
  92. self.date = date
  93. if date_time is not None:
  94. self.date_time = date_time
  95. if uuid is not None:
  96. self.uuid = uuid
  97. self.password = password
  98. if big_decimal is not None:
  99. self.big_decimal = big_decimal
  100. @property
  101. def integer(self):
  102. """Gets the integer of this FormatTest. # noqa: E501
  103. :return: The integer of this FormatTest. # noqa: E501
  104. :rtype: int
  105. """
  106. return self._integer
  107. @integer.setter
  108. def integer(self, integer):
  109. """Sets the integer of this FormatTest.
  110. :param integer: The integer of this FormatTest. # noqa: E501
  111. :type integer: int
  112. """
  113. if (self.local_vars_configuration.client_side_validation and
  114. integer is not None and integer > 100): # noqa: E501
  115. raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100`") # noqa: E501
  116. if (self.local_vars_configuration.client_side_validation and
  117. integer is not None and integer < 10): # noqa: E501
  118. raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10`") # noqa: E501
  119. self._integer = integer
  120. @property
  121. def int32(self):
  122. """Gets the int32 of this FormatTest. # noqa: E501
  123. :return: The int32 of this FormatTest. # noqa: E501
  124. :rtype: int
  125. """
  126. return self._int32
  127. @int32.setter
  128. def int32(self, int32):
  129. """Sets the int32 of this FormatTest.
  130. :param int32: The int32 of this FormatTest. # noqa: E501
  131. :type int32: int
  132. """
  133. if (self.local_vars_configuration.client_side_validation and
  134. int32 is not None and int32 > 200): # noqa: E501
  135. raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200`") # noqa: E501
  136. if (self.local_vars_configuration.client_side_validation and
  137. int32 is not None and int32 < 20): # noqa: E501
  138. raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20`") # noqa: E501
  139. self._int32 = int32
  140. @property
  141. def int64(self):
  142. """Gets the int64 of this FormatTest. # noqa: E501
  143. :return: The int64 of this FormatTest. # noqa: E501
  144. :rtype: int
  145. """
  146. return self._int64
  147. @int64.setter
  148. def int64(self, int64):
  149. """Sets the int64 of this FormatTest.
  150. :param int64: The int64 of this FormatTest. # noqa: E501
  151. :type int64: int
  152. """
  153. self._int64 = int64
  154. @property
  155. def number(self):
  156. """Gets the number of this FormatTest. # noqa: E501
  157. :return: The number of this FormatTest. # noqa: E501
  158. :rtype: float
  159. """
  160. return self._number
  161. @number.setter
  162. def number(self, number):
  163. """Sets the number of this FormatTest.
  164. :param number: The number of this FormatTest. # noqa: E501
  165. :type number: float
  166. """
  167. if self.local_vars_configuration.client_side_validation and number is None: # noqa: E501
  168. raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501
  169. if (self.local_vars_configuration.client_side_validation and
  170. number is not None and number > 543.2): # noqa: E501
  171. raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") # noqa: E501
  172. if (self.local_vars_configuration.client_side_validation and
  173. number is not None and number < 32.1): # noqa: E501
  174. raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") # noqa: E501
  175. self._number = number
  176. @property
  177. def float(self):
  178. """Gets the float of this FormatTest. # noqa: E501
  179. :return: The float of this FormatTest. # noqa: E501
  180. :rtype: float
  181. """
  182. return self._float
  183. @float.setter
  184. def float(self, float):
  185. """Sets the float of this FormatTest.
  186. :param float: The float of this FormatTest. # noqa: E501
  187. :type float: float
  188. """
  189. if (self.local_vars_configuration.client_side_validation and
  190. float is not None and float > 987.6): # noqa: E501
  191. raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") # noqa: E501
  192. if (self.local_vars_configuration.client_side_validation and
  193. float is not None and float < 54.3): # noqa: E501
  194. raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") # noqa: E501
  195. self._float = float
  196. @property
  197. def double(self):
  198. """Gets the double of this FormatTest. # noqa: E501
  199. :return: The double of this FormatTest. # noqa: E501
  200. :rtype: float
  201. """
  202. return self._double
  203. @double.setter
  204. def double(self, double):
  205. """Sets the double of this FormatTest.
  206. :param double: The double of this FormatTest. # noqa: E501
  207. :type double: float
  208. """
  209. if (self.local_vars_configuration.client_side_validation and
  210. double is not None and double > 123.4): # noqa: E501
  211. raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") # noqa: E501
  212. if (self.local_vars_configuration.client_side_validation and
  213. double is not None and double < 67.8): # noqa: E501
  214. raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") # noqa: E501
  215. self._double = double
  216. @property
  217. def string(self):
  218. """Gets the string of this FormatTest. # noqa: E501
  219. :return: The string of this FormatTest. # noqa: E501
  220. :rtype: str
  221. """
  222. return self._string
  223. @string.setter
  224. def string(self, string):
  225. """Sets the string of this FormatTest.
  226. :param string: The string of this FormatTest. # noqa: E501
  227. :type string: str
  228. """
  229. if (self.local_vars_configuration.client_side_validation and
  230. string is not None and not re.search(r'[a-z]', string, flags=re.IGNORECASE)): # noqa: E501
  231. raise ValueError(r"Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") # noqa: E501
  232. self._string = string
  233. @property
  234. def byte(self):
  235. """Gets the byte of this FormatTest. # noqa: E501
  236. :return: The byte of this FormatTest. # noqa: E501
  237. :rtype: str
  238. """
  239. return self._byte
  240. @byte.setter
  241. def byte(self, byte):
  242. """Sets the byte of this FormatTest.
  243. :param byte: The byte of this FormatTest. # noqa: E501
  244. :type byte: str
  245. """
  246. if self.local_vars_configuration.client_side_validation and byte is None: # noqa: E501
  247. raise ValueError("Invalid value for `byte`, must not be `None`") # noqa: E501
  248. if (self.local_vars_configuration.client_side_validation and
  249. byte is not None and not re.search(r'^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte)): # noqa: E501
  250. raise ValueError(r"Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501
  251. self._byte = byte
  252. @property
  253. def binary(self):
  254. """Gets the binary of this FormatTest. # noqa: E501
  255. :return: The binary of this FormatTest. # noqa: E501
  256. :rtype: file
  257. """
  258. return self._binary
  259. @binary.setter
  260. def binary(self, binary):
  261. """Sets the binary of this FormatTest.
  262. :param binary: The binary of this FormatTest. # noqa: E501
  263. :type binary: file
  264. """
  265. self._binary = binary
  266. @property
  267. def date(self):
  268. """Gets the date of this FormatTest. # noqa: E501
  269. :return: The date of this FormatTest. # noqa: E501
  270. :rtype: date
  271. """
  272. return self._date
  273. @date.setter
  274. def date(self, date):
  275. """Sets the date of this FormatTest.
  276. :param date: The date of this FormatTest. # noqa: E501
  277. :type date: date
  278. """
  279. if self.local_vars_configuration.client_side_validation and date is None: # noqa: E501
  280. raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501
  281. self._date = date
  282. @property
  283. def date_time(self):
  284. """Gets the date_time of this FormatTest. # noqa: E501
  285. :return: The date_time of this FormatTest. # noqa: E501
  286. :rtype: datetime
  287. """
  288. return self._date_time
  289. @date_time.setter
  290. def date_time(self, date_time):
  291. """Sets the date_time of this FormatTest.
  292. :param date_time: The date_time of this FormatTest. # noqa: E501
  293. :type date_time: datetime
  294. """
  295. self._date_time = date_time
  296. @property
  297. def uuid(self):
  298. """Gets the uuid of this FormatTest. # noqa: E501
  299. :return: The uuid of this FormatTest. # noqa: E501
  300. :rtype: str
  301. """
  302. return self._uuid
  303. @uuid.setter
  304. def uuid(self, uuid):
  305. """Sets the uuid of this FormatTest.
  306. :param uuid: The uuid of this FormatTest. # noqa: E501
  307. :type uuid: str
  308. """
  309. self._uuid = uuid
  310. @property
  311. def password(self):
  312. """Gets the password of this FormatTest. # noqa: E501
  313. :return: The password of this FormatTest. # noqa: E501
  314. :rtype: str
  315. """
  316. return self._password
  317. @password.setter
  318. def password(self, password):
  319. """Sets the password of this FormatTest.
  320. :param password: The password of this FormatTest. # noqa: E501
  321. :type password: str
  322. """
  323. if self.local_vars_configuration.client_side_validation and password is None: # noqa: E501
  324. raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501
  325. if (self.local_vars_configuration.client_side_validation and
  326. password is not None and len(password) > 64):
  327. raise ValueError("Invalid value for `password`, length must be less than or equal to `64`") # noqa: E501
  328. if (self.local_vars_configuration.client_side_validation and
  329. password is not None and len(password) < 10):
  330. raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") # noqa: E501
  331. self._password = password
  332. @property
  333. def big_decimal(self):
  334. """Gets the big_decimal of this FormatTest. # noqa: E501
  335. :return: The big_decimal of this FormatTest. # noqa: E501
  336. :rtype: BigDecimal
  337. """
  338. return self._big_decimal
  339. @big_decimal.setter
  340. def big_decimal(self, big_decimal):
  341. """Sets the big_decimal of this FormatTest.
  342. :param big_decimal: The big_decimal of this FormatTest. # noqa: E501
  343. :type big_decimal: BigDecimal
  344. """
  345. self._big_decimal = big_decimal
  346. def to_dict(self):
  347. """Returns the model properties as a dict"""
  348. result = {}
  349. for attr, _ in six.iteritems(self.openapi_types):
  350. value = getattr(self, attr)
  351. if isinstance(value, list):
  352. result[attr] = list(map(
  353. lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
  354. value
  355. ))
  356. elif hasattr(value, "to_dict"):
  357. result[attr] = value.to_dict()
  358. elif isinstance(value, dict):
  359. result[attr] = dict(map(
  360. lambda item: (item[0], item[1].to_dict())
  361. if hasattr(item[1], "to_dict") else item,
  362. value.items()
  363. ))
  364. else:
  365. result[attr] = value
  366. return result
  367. def to_str(self):
  368. """Returns the string representation of the model"""
  369. return pprint.pformat(self.to_dict())
  370. def __repr__(self):
  371. """For `print` and `pprint`"""
  372. return self.to_str()
  373. def __eq__(self, other):
  374. """Returns true if both objects are equal"""
  375. if not isinstance(other, FormatTest):
  376. return False
  377. return self.to_dict() == other.to_dict()
  378. def __ne__(self, other):
  379. """Returns true if both objects are not equal"""
  380. if not isinstance(other, FormatTest):
  381. return True
  382. return self.to_dict() != other.to_dict()