Skip to content

Commit 3dc8403

Browse files
authored
[Python] pass api_client configuration to model deserialize (#13922)
The if not passed the models create a new configuration object which configures logging and determines cpu count every time. This causes extreme performance issues when deserializing larger sets of items. See also kubernetes-client/python#1921
1 parent 363906f commit 3dc8403

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

Diff for: modules/openapi-generator/src/main/resources/python-legacy/api_client.mustache

+1
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ class ApiClient(object):
715715
value = data[klass.attribute_map[attr]]
716716
kwargs[attr] = self.__deserialize(value, attr_type)
717717

718+
kwargs["local_vars_configuration"] = self.configuration
718719
instance = klass(**kwargs)
719720

720721
if has_discriminator:

Diff for: samples/client/petstore/python-asyncio/petstore_api/api_client.py

+1
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ def __deserialize_model(self, data, klass):
692692
value = data[klass.attribute_map[attr]]
693693
kwargs[attr] = self.__deserialize(value, attr_type)
694694

695+
kwargs["local_vars_configuration"] = self.configuration
695696
instance = klass(**kwargs)
696697

697698
if has_discriminator:

Diff for: samples/client/petstore/python-legacy/petstore_api/api_client.py

+1
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ def __deserialize_model(self, data, klass):
691691
value = data[klass.attribute_map[attr]]
692692
kwargs[attr] = self.__deserialize(value, attr_type)
693693

694+
kwargs["local_vars_configuration"] = self.configuration
694695
instance = klass(**kwargs)
695696

696697
if has_discriminator:

Diff for: samples/client/petstore/python-tornado/petstore_api/api_client.py

+1
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ def __deserialize_model(self, data, klass):
693693
value = data[klass.attribute_map[attr]]
694694
kwargs[attr] = self.__deserialize(value, attr_type)
695695

696+
kwargs["local_vars_configuration"] = self.configuration
696697
instance = klass(**kwargs)
697698

698699
if has_discriminator:

Diff for: samples/openapi3/client/petstore/python-legacy/petstore_api/api_client.py

+1
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ def __deserialize_model(self, data, klass):
691691
value = data[klass.attribute_map[attr]]
692692
kwargs[attr] = self.__deserialize(value, attr_type)
693693

694+
kwargs["local_vars_configuration"] = self.configuration
694695
instance = klass(**kwargs)
695696

696697
if has_discriminator:

0 commit comments

Comments
 (0)