add self as a reserved keyword to python

This commit is contained in:
wing328
2016-01-05 10:17:07 +08:00
parent 90d1e280ed
commit 4597d27fe9
4 changed files with 21 additions and 5 deletions

View File

@@ -58,7 +58,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
"and", "del", "from", "not", "while", "as", "elif", "global", "or", "with",
"assert", "else", "if", "pass", "yield", "break", "except", "import",
"print", "class", "exec", "in", "raise", "continue", "finally", "is",
"return", "def", "for", "lambda", "try"));
"return", "def", "for", "lambda", "try", "self"));
cliOptions.clear();
cliOptions.add(new CliOption(CodegenConstants.PACKAGE_NAME, "python package name (convention: snake_case).")

File diff suppressed because one or more lines are too long

View File

@@ -125,3 +125,17 @@ Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/li
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in /private/var/tmp/pr/Tengah/swagger-codegen/samples/client/petstore/python/venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))

View File

@@ -66,8 +66,7 @@ class ApiClient(object):
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to the API.
"""
def __init__(self, host=Configuration().host,
header_name=None, header_value=None, cookie=None):
def __init__(self, host=None, header_name=None, header_value=None, cookie=None):
"""
Constructor of the class.
@@ -76,7 +75,10 @@ class ApiClient(object):
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.host = host
if host is None:
self.host = Configuration().host
else:
self.host = host
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Python-Swagger/1.0.0'