fix circular import issue in python flask (#946)

* fix circular import issue in python flask

This is very similar change to 3678eaff87
All it intends to do is fix the problem of cirular imports (which was
already fixed for python) in the python flask server.

* removal of type hints in quotes
This commit is contained in:
Jakob Schmutz
2018-09-09 16:23:06 +01:00
committed by William Cheng
parent aa29219f8c
commit 7596fb7119
19 changed files with 939 additions and 949 deletions

View File

@@ -6,8 +6,6 @@ from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from {{modelPackage}}.base_model_ import Model
{{#imports}}{{import}} # noqa: F401,E501
{{/imports}}
from {{packageName}} import util
@@ -27,7 +25,7 @@ class {{classname}}(Model):
{{/-last}}
{{/enumVars}}{{/allowableValues}}
def __init__(self{{#vars}}, {{name}}{{^supportPython2}}: {{dataType}}{{/supportPython2}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501
def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501
"""{{classname}} - a model defined in OpenAPI
{{#vars}}
@@ -37,7 +35,7 @@ class {{classname}}(Model):
"""
self.openapi_types = {
{{#vars}}
'{{name}}': {{{dataType}}}{{#hasMore}},{{/hasMore}}
'{{name}}': '{{{dataType}}}'{{#hasMore}},{{/hasMore}}
{{/vars}}
}
@@ -64,7 +62,7 @@ class {{classname}}(Model):
{{/-first}}
@property
def {{name}}(self){{^supportPython2}} -> {{dataType}}{{/supportPython2}}:
def {{name}}(self):
"""Gets the {{name}} of this {{classname}}.
{{#description}}
@@ -77,7 +75,7 @@ class {{classname}}(Model):
return self._{{name}}
@{{name}}.setter
def {{name}}(self, {{name}}{{^supportPython2}}: {{dataType}}{{/supportPython2}}):
def {{name}}(self, {{name}}):
"""Sets the {{name}} of this {{classname}}.
{{#description}}
@@ -158,4 +156,4 @@ class {{classname}}(Model):
{{/vars}}
{{/model}}
{{/models}}
{{/models}}

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.0-SNAPSHOT

View File

@@ -26,9 +26,9 @@ class ApiResponse(Model):
:type message: str
"""
self.openapi_types = {
'code': int,
'type': str,
'message': str
'code': 'int',
'type': 'str',
'message': 'str'
}
self.attribute_map = {

View File

@@ -24,8 +24,8 @@ class Category(Model):
:type name: str
"""
self.openapi_types = {
'id': long,
'name': str
'id': 'long',
'name': 'str'
}
self.attribute_map = {

View File

@@ -32,12 +32,12 @@ class Order(Model):
:type complete: bool
"""
self.openapi_types = {
'id': long,
'pet_id': long,
'quantity': int,
'ship_date': datetime,
'status': str,
'complete': bool
'id': 'long',
'pet_id': 'long',
'quantity': 'int',
'ship_date': 'datetime',
'status': 'str',
'complete': 'bool'
}
self.attribute_map = {

View File

@@ -6,8 +6,6 @@ from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model_ import Model
from openapi_server.models.category import Category # noqa: F401,E501
from openapi_server.models.tag import Tag # noqa: F401,E501
from openapi_server import util
@@ -34,12 +32,12 @@ class Pet(Model):
:type status: str
"""
self.openapi_types = {
'id': long,
'category': Category,
'name': str,
'photo_urls': List[str],
'tags': List[Tag],
'status': str
'id': 'long',
'category': 'Category',
'name': 'str',
'photo_urls': 'List[str]',
'tags': 'List[Tag]',
'status': 'str'
}
self.attribute_map = {

View File

@@ -24,8 +24,8 @@ class Tag(Model):
:type name: str
"""
self.openapi_types = {
'id': long,
'name': str
'id': 'long',
'name': 'str'
}
self.attribute_map = {

View File

@@ -36,14 +36,14 @@ class User(Model):
:type user_status: int
"""
self.openapi_types = {
'id': long,
'username': str,
'first_name': str,
'last_name': str,
'email': str,
'password': str,
'phone': str,
'user_status': int
'id': 'long',
'username': 'str',
'first_name': 'str',
'last_name': 'str',
'email': 'str',
'password': 'str',
'phone': 'str',
'user_status': 'int'
}
self.attribute_map = {

View File

@@ -51,7 +51,7 @@ def _deserialize_primitive(data, klass):
def _deserialize_object(value):
"""Return a original value.
"""Return an original value.
:return: object.
"""

View File

@@ -1 +1 @@
3.0.0-SNAPSHOT
3.3.0-SNAPSHOT

View File

@@ -15,7 +15,7 @@ class ApiResponse(Model):
Do not edit the class manually.
"""
def __init__(self, code: int=None, type: str=None, message: str=None): # noqa: E501
def __init__(self, code=None, type=None, message=None): # noqa: E501
"""ApiResponse - a model defined in OpenAPI
:param code: The code of this ApiResponse. # noqa: E501
@@ -26,9 +26,9 @@ class ApiResponse(Model):
:type message: str
"""
self.openapi_types = {
'code': int,
'type': str,
'message': str
'code': 'int',
'type': 'str',
'message': 'str'
}
self.attribute_map = {
@@ -53,7 +53,7 @@ class ApiResponse(Model):
return util.deserialize_model(dikt, cls)
@property
def code(self) -> int:
def code(self):
"""Gets the code of this ApiResponse.
@@ -63,7 +63,7 @@ class ApiResponse(Model):
return self._code
@code.setter
def code(self, code: int):
def code(self, code):
"""Sets the code of this ApiResponse.
@@ -74,7 +74,7 @@ class ApiResponse(Model):
self._code = code
@property
def type(self) -> str:
def type(self):
"""Gets the type of this ApiResponse.
@@ -84,7 +84,7 @@ class ApiResponse(Model):
return self._type
@type.setter
def type(self, type: str):
def type(self, type):
"""Sets the type of this ApiResponse.
@@ -95,7 +95,7 @@ class ApiResponse(Model):
self._type = type
@property
def message(self) -> str:
def message(self):
"""Gets the message of this ApiResponse.
@@ -105,7 +105,7 @@ class ApiResponse(Model):
return self._message
@message.setter
def message(self, message: str):
def message(self, message):
"""Sets the message of this ApiResponse.

View File

@@ -15,7 +15,7 @@ class Category(Model):
Do not edit the class manually.
"""
def __init__(self, id: int=None, name: str=None): # noqa: E501
def __init__(self, id=None, name=None): # noqa: E501
"""Category - a model defined in OpenAPI
:param id: The id of this Category. # noqa: E501
@@ -24,8 +24,8 @@ class Category(Model):
:type name: str
"""
self.openapi_types = {
'id': int,
'name': str
'id': 'int',
'name': 'str'
}
self.attribute_map = {
@@ -48,7 +48,7 @@ class Category(Model):
return util.deserialize_model(dikt, cls)
@property
def id(self) -> int:
def id(self):
"""Gets the id of this Category.
@@ -58,7 +58,7 @@ class Category(Model):
return self._id
@id.setter
def id(self, id: int):
def id(self, id):
"""Sets the id of this Category.
@@ -69,7 +69,7 @@ class Category(Model):
self._id = id
@property
def name(self) -> str:
def name(self):
"""Gets the name of this Category.
@@ -79,7 +79,7 @@ class Category(Model):
return self._name
@name.setter
def name(self, name: str):
def name(self, name):
"""Sets the name of this Category.

View File

@@ -15,7 +15,7 @@ class Order(Model):
Do not edit the class manually.
"""
def __init__(self, id: int=None, pet_id: int=None, quantity: int=None, ship_date: datetime=None, status: str=None, complete: bool=False): # noqa: E501
def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501
"""Order - a model defined in OpenAPI
:param id: The id of this Order. # noqa: E501
@@ -32,12 +32,12 @@ class Order(Model):
:type complete: bool
"""
self.openapi_types = {
'id': int,
'pet_id': int,
'quantity': int,
'ship_date': datetime,
'status': str,
'complete': bool
'id': 'int',
'pet_id': 'int',
'quantity': 'int',
'ship_date': 'datetime',
'status': 'str',
'complete': 'bool'
}
self.attribute_map = {
@@ -68,7 +68,7 @@ class Order(Model):
return util.deserialize_model(dikt, cls)
@property
def id(self) -> int:
def id(self):
"""Gets the id of this Order.
@@ -78,7 +78,7 @@ class Order(Model):
return self._id
@id.setter
def id(self, id: int):
def id(self, id):
"""Sets the id of this Order.
@@ -89,7 +89,7 @@ class Order(Model):
self._id = id
@property
def pet_id(self) -> int:
def pet_id(self):
"""Gets the pet_id of this Order.
@@ -99,7 +99,7 @@ class Order(Model):
return self._pet_id
@pet_id.setter
def pet_id(self, pet_id: int):
def pet_id(self, pet_id):
"""Sets the pet_id of this Order.
@@ -110,7 +110,7 @@ class Order(Model):
self._pet_id = pet_id
@property
def quantity(self) -> int:
def quantity(self):
"""Gets the quantity of this Order.
@@ -120,7 +120,7 @@ class Order(Model):
return self._quantity
@quantity.setter
def quantity(self, quantity: int):
def quantity(self, quantity):
"""Sets the quantity of this Order.
@@ -131,7 +131,7 @@ class Order(Model):
self._quantity = quantity
@property
def ship_date(self) -> datetime:
def ship_date(self):
"""Gets the ship_date of this Order.
@@ -141,7 +141,7 @@ class Order(Model):
return self._ship_date
@ship_date.setter
def ship_date(self, ship_date: datetime):
def ship_date(self, ship_date):
"""Sets the ship_date of this Order.
@@ -152,7 +152,7 @@ class Order(Model):
self._ship_date = ship_date
@property
def status(self) -> str:
def status(self):
"""Gets the status of this Order.
Order Status # noqa: E501
@@ -163,7 +163,7 @@ class Order(Model):
return self._status
@status.setter
def status(self, status: str):
def status(self, status):
"""Sets the status of this Order.
Order Status # noqa: E501
@@ -181,7 +181,7 @@ class Order(Model):
self._status = status
@property
def complete(self) -> bool:
def complete(self):
"""Gets the complete of this Order.
@@ -191,7 +191,7 @@ class Order(Model):
return self._complete
@complete.setter
def complete(self, complete: bool):
def complete(self, complete):
"""Sets the complete of this Order.

View File

@@ -6,8 +6,6 @@ from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from openapi_server.models.base_model_ import Model
from openapi_server.models.category import Category # noqa: F401,E501
from openapi_server.models.tag import Tag # noqa: F401,E501
from openapi_server import util
@@ -17,7 +15,7 @@ class Pet(Model):
Do not edit the class manually.
"""
def __init__(self, id: int=None, category: Category=None, name: str=None, photo_urls: List[str]=None, tags: List[Tag]=None, status: str=None): # noqa: E501
def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501
"""Pet - a model defined in OpenAPI
:param id: The id of this Pet. # noqa: E501
@@ -34,12 +32,12 @@ class Pet(Model):
:type status: str
"""
self.openapi_types = {
'id': int,
'category': Category,
'name': str,
'photo_urls': List[str],
'tags': List[Tag],
'status': str
'id': 'int',
'category': 'Category',
'name': 'str',
'photo_urls': 'List[str]',
'tags': 'List[Tag]',
'status': 'str'
}
self.attribute_map = {
@@ -70,7 +68,7 @@ class Pet(Model):
return util.deserialize_model(dikt, cls)
@property
def id(self) -> int:
def id(self):
"""Gets the id of this Pet.
@@ -80,7 +78,7 @@ class Pet(Model):
return self._id
@id.setter
def id(self, id: int):
def id(self, id):
"""Sets the id of this Pet.
@@ -91,7 +89,7 @@ class Pet(Model):
self._id = id
@property
def category(self) -> Category:
def category(self):
"""Gets the category of this Pet.
@@ -101,7 +99,7 @@ class Pet(Model):
return self._category
@category.setter
def category(self, category: Category):
def category(self, category):
"""Sets the category of this Pet.
@@ -112,7 +110,7 @@ class Pet(Model):
self._category = category
@property
def name(self) -> str:
def name(self):
"""Gets the name of this Pet.
@@ -122,7 +120,7 @@ class Pet(Model):
return self._name
@name.setter
def name(self, name: str):
def name(self, name):
"""Sets the name of this Pet.
@@ -135,7 +133,7 @@ class Pet(Model):
self._name = name
@property
def photo_urls(self) -> List[str]:
def photo_urls(self):
"""Gets the photo_urls of this Pet.
@@ -145,7 +143,7 @@ class Pet(Model):
return self._photo_urls
@photo_urls.setter
def photo_urls(self, photo_urls: List[str]):
def photo_urls(self, photo_urls):
"""Sets the photo_urls of this Pet.
@@ -158,7 +156,7 @@ class Pet(Model):
self._photo_urls = photo_urls
@property
def tags(self) -> List[Tag]:
def tags(self):
"""Gets the tags of this Pet.
@@ -168,7 +166,7 @@ class Pet(Model):
return self._tags
@tags.setter
def tags(self, tags: List[Tag]):
def tags(self, tags):
"""Sets the tags of this Pet.
@@ -179,7 +177,7 @@ class Pet(Model):
self._tags = tags
@property
def status(self) -> str:
def status(self):
"""Gets the status of this Pet.
pet status in the store # noqa: E501
@@ -190,7 +188,7 @@ class Pet(Model):
return self._status
@status.setter
def status(self, status: str):
def status(self, status):
"""Sets the status of this Pet.
pet status in the store # noqa: E501

View File

@@ -15,7 +15,7 @@ class Tag(Model):
Do not edit the class manually.
"""
def __init__(self, id: int=None, name: str=None): # noqa: E501
def __init__(self, id=None, name=None): # noqa: E501
"""Tag - a model defined in OpenAPI
:param id: The id of this Tag. # noqa: E501
@@ -24,8 +24,8 @@ class Tag(Model):
:type name: str
"""
self.openapi_types = {
'id': int,
'name': str
'id': 'int',
'name': 'str'
}
self.attribute_map = {
@@ -48,7 +48,7 @@ class Tag(Model):
return util.deserialize_model(dikt, cls)
@property
def id(self) -> int:
def id(self):
"""Gets the id of this Tag.
@@ -58,7 +58,7 @@ class Tag(Model):
return self._id
@id.setter
def id(self, id: int):
def id(self, id):
"""Sets the id of this Tag.
@@ -69,7 +69,7 @@ class Tag(Model):
self._id = id
@property
def name(self) -> str:
def name(self):
"""Gets the name of this Tag.
@@ -79,7 +79,7 @@ class Tag(Model):
return self._name
@name.setter
def name(self, name: str):
def name(self, name):
"""Sets the name of this Tag.

View File

@@ -15,7 +15,7 @@ class User(Model):
Do not edit the class manually.
"""
def __init__(self, id: int=None, username: str=None, first_name: str=None, last_name: str=None, email: str=None, password: str=None, phone: str=None, user_status: int=None): # noqa: E501
def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501
"""User - a model defined in OpenAPI
:param id: The id of this User. # noqa: E501
@@ -36,14 +36,14 @@ class User(Model):
:type user_status: int
"""
self.openapi_types = {
'id': int,
'username': str,
'first_name': str,
'last_name': str,
'email': str,
'password': str,
'phone': str,
'user_status': int
'id': 'int',
'username': 'str',
'first_name': 'str',
'last_name': 'str',
'email': 'str',
'password': 'str',
'phone': 'str',
'user_status': 'int'
}
self.attribute_map = {
@@ -78,7 +78,7 @@ class User(Model):
return util.deserialize_model(dikt, cls)
@property
def id(self) -> int:
def id(self):
"""Gets the id of this User.
@@ -88,7 +88,7 @@ class User(Model):
return self._id
@id.setter
def id(self, id: int):
def id(self, id):
"""Sets the id of this User.
@@ -99,7 +99,7 @@ class User(Model):
self._id = id
@property
def username(self) -> str:
def username(self):
"""Gets the username of this User.
@@ -109,7 +109,7 @@ class User(Model):
return self._username
@username.setter
def username(self, username: str):
def username(self, username):
"""Sets the username of this User.
@@ -120,7 +120,7 @@ class User(Model):
self._username = username
@property
def first_name(self) -> str:
def first_name(self):
"""Gets the first_name of this User.
@@ -130,7 +130,7 @@ class User(Model):
return self._first_name
@first_name.setter
def first_name(self, first_name: str):
def first_name(self, first_name):
"""Sets the first_name of this User.
@@ -141,7 +141,7 @@ class User(Model):
self._first_name = first_name
@property
def last_name(self) -> str:
def last_name(self):
"""Gets the last_name of this User.
@@ -151,7 +151,7 @@ class User(Model):
return self._last_name
@last_name.setter
def last_name(self, last_name: str):
def last_name(self, last_name):
"""Sets the last_name of this User.
@@ -162,7 +162,7 @@ class User(Model):
self._last_name = last_name
@property
def email(self) -> str:
def email(self):
"""Gets the email of this User.
@@ -172,7 +172,7 @@ class User(Model):
return self._email
@email.setter
def email(self, email: str):
def email(self, email):
"""Sets the email of this User.
@@ -183,7 +183,7 @@ class User(Model):
self._email = email
@property
def password(self) -> str:
def password(self):
"""Gets the password of this User.
@@ -193,7 +193,7 @@ class User(Model):
return self._password
@password.setter
def password(self, password: str):
def password(self, password):
"""Sets the password of this User.
@@ -204,7 +204,7 @@ class User(Model):
self._password = password
@property
def phone(self) -> str:
def phone(self):
"""Gets the phone of this User.
@@ -214,7 +214,7 @@ class User(Model):
return self._phone
@phone.setter
def phone(self, phone: str):
def phone(self, phone):
"""Sets the phone of this User.
@@ -225,7 +225,7 @@ class User(Model):
self._phone = phone
@property
def user_status(self) -> int:
def user_status(self):
"""Gets the user_status of this User.
User Status # noqa: E501
@@ -236,7 +236,7 @@ class User(Model):
return self._user_status
@user_status.setter
def user_status(self, user_status: int):
def user_status(self, user_status):
"""Sets the user_status of this User.
User Status # noqa: E501

View File

@@ -51,7 +51,7 @@ def _deserialize_primitive(data, klass):
def _deserialize_object(value):
"""Return a original value.
"""Return an original value.
:return: object.
"""