Format python client using pep8

This commit is contained in:
geekerzp
2015-07-18 14:30:19 +08:00
parent 3993ef3dc8
commit 60d6cd744a
20 changed files with 1802 additions and 1391 deletions

View File

@@ -19,18 +19,20 @@ Copyright 2015 SmartBear Software
{{#models}}
{{#model}}
class {{classname}}(object):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self):
"""
Swagger model
:param dict swaggerTypes: The key is attribute name and the value is attribute type.
:param dict attributeMap: The key is attribute name and the value is json key in definition.
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition.
"""
self.swagger_types = {
{{#vars}}'{{name}}': '{{{datatype}}}'{{#hasMore}},
@@ -41,11 +43,12 @@ class {{classname}}(object):
{{#vars}}'{{name}}': '{{baseName}}'{{#hasMore}},
{{/hasMore}}{{/vars}}
}
{{#vars}}
{{#description}}# {{description}}{{/description}}
self._{{name}} = None # {{{datatype}}}
{{/vars}}
{{#vars}}
{{#vars}}
self._{{name}} = None{{#description}} # {{description}}{{/description}}
{{/vars}}
{{#vars}}
@property
def {{name}}(self):
return self._{{name}}
@@ -54,18 +57,21 @@ class {{classname}}(object):
def {{name}}(self, {{name}}):
{{#isEnum}}allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]
if {{name}} not in allowed_values:
raise ValueError("Invalid value for `{{name}}`, must be one of {0}".format(allowed_values))
{{/isEnum}}
self._{{name}} = {{name}}
{{/vars}}
raise ValueError(
"Invalid value for `{{name}}`, must be one of {0}"
.format(allowed_values)
)
{{/isEnum}}self._{{name}} = {{name}}
{{/vars}}
def __repr__(self):
properties = []
for p in self.__dict__:
if p != 'swaggerTypes' and p != 'attributeMap':
properties.append('{prop}={val!r}'.format(prop=p, val=self.__dict__[p]))
properties.append('{prop}={val!r}'
.format(prop=p, val=self.__dict__[p]))
return '<{name} {props}>'.format(name=__name__, props=' '.join(properties))
return '<{name} {props}>'.format(name=__name__,
props=' '.join(properties))
{{/model}}
{{/models}}