rollback python3 template

This commit is contained in:
wing328
2015-06-09 12:40:45 +08:00
parent 50ae9659ad
commit 263b4080ee
4 changed files with 219 additions and 219 deletions

View File

@@ -3,17 +3,17 @@
{{classname}}.py
Copyright 2015 SmartBear Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
"""
@@ -24,20 +24,20 @@ from .models import *
{{#operations}}
class {{classname}}(object):
class {{classname}}(object):
def __init__(self, apiClient):
self.apiClient = apiClient
self.apiClient = apiClient
{{newline}}
{{#operation}}
def {{nickname}}(self, {{#requiredParams}}{{paramName}}{{#defaultValue}} = None{{/defaultValue}}, {{/requiredParams}}**kwargs):
def {{nickname}}(self, {{#requiredParams}}{{paramName}}{{#defaultValue}} = None{{/defaultValue}}, {{/requiredParams}}**kwargs):
"""{{{summary}}}
{{{notes}}}
Args:
{{#allParams}}{{paramName}}, {{dataType}}: {{{description}}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}}
{{/allParams}}
{{#allParams}}{{paramName}}, {{dataType}}: {{{description}}} {{^optional}}(required){{/optional}}{{#optional}}(optional){{/optional}}
{{/allParams}}
Returns: {{returnType}}
"""
@@ -46,9 +46,9 @@ from .models import *
params = locals()
for (key, val) in params['kwargs'].items():
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method {{nickname}}" % key)
params[key] = val
if key not in allParams:
raise TypeError("Got an unexpected keyword argument '%s' to method {{nickname}}" % key)
params[key] = val
del params['kwargs']
resourcePath = '{{path}}'
@@ -59,37 +59,37 @@ from .models import *
headerParams = {}
{{#queryParams}}
if ('{{paramName}}' in params):
if ('{{paramName}}' in params):
queryParams['{{paramName}}'] = self.apiClient.toPathValue(params['{{paramName}}'])
{{/queryParams}}
{{#headerParams}}
if ('{{paramName}}' in params):
if ('{{paramName}}' in params):
headerParams['{{paramName}}'] = params['{{paramName}}']
{{/headerParams}}
{{#pathParams}}
if ('{{paramName}}' in params):
if ('{{paramName}}' in params):
replacement = str(self.apiClient.toPathValue(params['{{paramName}}']))
resourcePath = resourcePath.replace('{' + '{{baseName}}' + '}',
replacement)
replacement)
{{/pathParams}}
postData = (params['body'] if 'body' in params else None)
response = self.apiClient.callAPI(resourcePath, method, queryParams,
postData, headerParams)
postData, headerParams)
{{#returnType}}
if not response:
if not response:
return None
responseObject = self.apiClient.deserialize(response, '{{returnType}}')
return responseObject
responseObject = self.apiClient.deserialize(response, '{{returnType}}')
return responseObject
{{/returnType}}
{{newline}}
{{newline}}
{{/operation}}
{{newline}}
{{newline}}
{{/operations}}
{{newline}}