[Python] [Performance] Avoid unnessacary checks inside the loop (#4305)

This commit is contained in:
Arun
2019-11-07 08:19:54 +05:30
committed by William Cheng
parent 9bfea4b7e5
commit 649eab2868
5 changed files with 20 additions and 20 deletions

View File

@@ -622,11 +622,11 @@ class ApiClient(object):
return data
kwargs = {}
if klass.openapi_types is not None:
if (data is not None and
klass.openapi_types is not None and
isinstance(data, (list, dict))):
for attr, attr_type in six.iteritems(klass.openapi_types):
if (data is not None and
klass.attribute_map[attr] in data and
isinstance(data, (list, dict))):
if klass.attribute_map[attr] in data:
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)