Apply readWriteVars to constructor in python/model.mustach

This commit is contained in:
Takuro Wada 2016-06-08 23:48:34 +09:00
parent 03f5619beb
commit 2c939b03b4
5 changed files with 19 additions and 14 deletions

View File

@ -44,6 +44,8 @@ nosetests.xml
coverage.xml
*,cover
.hypothesis/
venv/
.python-version
# Translations
*.mo

View File

@ -14,7 +14,7 @@ class {{classname}}(object):
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}):
def __init__(self{{#readWriteVars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/readWriteVars}}):
"""
{{classname}} - a model defined in Swagger
@ -33,9 +33,12 @@ class {{classname}}(object):
{{/hasMore}}{{/vars}}
}
{{#vars}}
{{#readOnlyVars}}
self._{{name}} = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}
{{/readOnlyVars}}
{{#readWriteVars}}
self._{{name}} = {{name}}
{{/vars}}
{{/readWriteVars}}
{{#vars}}{{#-first}}
{{/-first}}
@property

View File

@ -5,7 +5,7 @@ This Python package is automatically generated by the [Swagger Codegen](https://
- API version: 1.0.0
- Package version: 1.0.0
- Build date: 2016-06-08T10:26:51.066+08:00
- Build date: 2016-06-08T23:40:51.798+09:00
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
## Requirements.
@ -24,7 +24,7 @@ pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
Then import the package:
```python
import swagger_client
import petstore_api
```
### Setuptools
@ -38,7 +38,7 @@ python setup.py install --user
Then import the package:
```python
import swagger_client
import petstore_api
```
## Getting Started
@ -47,11 +47,11 @@ Please follow the [installation procedure](#installation--usage) and then run th
```python
import time
import swagger_client
from swagger_client.rest import ApiException
import petstore_api
from petstore_api.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = swagger_client.FakeApi
api_instance = petstore_api.FakeApi
number = 3.4 # float | None
double = 1.2 # float | None
string = 'string_example' # str | None

View File

@ -32,7 +32,7 @@ class Name(object):
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self, name=None, snake_case=None, _property=None, _123_number=None):
def __init__(self, name=None, _property=None):
"""
Name - a model defined in Swagger
@ -55,10 +55,10 @@ class Name(object):
'_123_number': '123Number'
}
self._snake_case = None
self.__123_number = None
self._name = name
self._snake_case = snake_case
self.__property = _property
self.__123_number = _123_number
@property
def name(self):

View File

@ -32,7 +32,7 @@ class ReadOnlyFirst(object):
NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
def __init__(self, bar=None, baz=None):
def __init__(self, baz=None):
"""
ReadOnlyFirst - a model defined in Swagger
@ -51,7 +51,7 @@ class ReadOnlyFirst(object):
'baz': 'baz'
}
self._bar = bar
self._bar = None
self._baz = baz
@property