Skip to content

Commit dbb5603

Browse files
authored
Merge pull request #9755 from slash-arun/add-missing-reserved-words
[Python] Add missing reserved words
2 parents b827bb9 + 2f6ad43 commit dbb5603

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/PythonClientCodegen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public PythonClientCodegen() {
111111
"assert", "else", "if", "pass", "yield", "break", "except", "import",
112112
"print", "class", "exec", "in", "raise", "continue", "finally", "is",
113113
"return", "def", "for", "lambda", "try", "self", "nonlocal", "None", "True", "nonlocal",
114-
"float", "int", "str", "date", "datetime"));
114+
"float", "int", "str", "date", "datetime", "False", "await", "async"));
115115

116116
regexModifiers = new HashMap<Character, String>();
117117
regexModifiers.put('i', "IGNORECASE");
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.0-SNAPSHOT
1+
2.4.9-SNAPSHOT

samples/client/petstore-security-test/python/petstore_api/api_client.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
6666
configuration = Configuration()
6767
self.configuration = configuration
6868

69-
self.pool = ThreadPool()
69+
# Use the pool property to lazily initialize the ThreadPool.
70+
self._pool = None
7071
self.rest_client = rest.RESTClientObject(configuration)
7172
self.default_headers = {}
7273
if header_name is not None:
@@ -76,8 +77,15 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7677
self.user_agent = 'Swagger-Codegen/1.0.0/python'
7778

7879
def __del__(self):
79-
self.pool.close()
80-
self.pool.join()
80+
if self._pool is not None:
81+
self._pool.close()
82+
self._pool.join()
83+
84+
@property
85+
def pool(self):
86+
if self._pool is None:
87+
self._pool = ThreadPool()
88+
return self._pool
8189

8290
@property
8391
def user_agent(self):
@@ -592,7 +600,7 @@ def __deserialize_datatime(self, string):
592600
)
593601

594602
def __hasattr(self, object, name):
595-
return name in object.__class__.__dict__
603+
return name in object.__class__.__dict__
596604

597605
def __deserialize_model(self, data, klass):
598606
"""Deserializes list or dict to model.
@@ -602,8 +610,8 @@ def __deserialize_model(self, data, klass):
602610
:return: model object.
603611
"""
604612

605-
if not klass.swagger_types and not \
606-
self.__hasattr(klass, 'get_real_child_model'):
613+
if (not klass.swagger_types and
614+
not self.__hasattr(klass, 'get_real_child_model')):
607615
return data
608616

609617
kwargs = {}

samples/client/petstore-security-test/python/setup.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
# prerequisite: setuptools
2323
# http://pypi.python.org/pypi/setuptools
2424

25-
REQUIRES = ["urllib3 >= 1.15", "six >= 1.10", "certifi", "python-dateutil"]
25+
REQUIRES = [
26+
"certifi>=2017.4.17",
27+
"python-dateutil>=2.1",
28+
"six>=1.10",
29+
"urllib3>=1.23"
30+
]
31+
2632

2733
setup(
2834
name=NAME,

0 commit comments

Comments
 (0)