From 706b391e32cebed98b660a80d86048616fec141b Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 21 Sep 2018 12:54:36 +0800 Subject: [PATCH 1/3] add post process file to python generators --- .../languages/PythonClientCodegen.java | 33 +++++++++++++++++++ .../PythonFlaskConnexionServerCodegen.java | 33 +++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 94db6594f16..f5aac3520d6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -19,6 +19,7 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; @@ -170,6 +171,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig @Override public void processOpts() { super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)"); + } + Boolean excludeTests = false; if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) { @@ -709,4 +715,31 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig return input.replace("'''", "'_'_'"); } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String pythonPostProcessFile = System.getenv("PYTHON_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(pythonPostProcessFile)) { + return; // skip if PYTHON_POST_PROCESS_FILE env variable is not defined + } + + // only process files with py extension + if ("py".equals(FilenameUtils.getExtension(file.toString()))) { + String command = pythonPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java index ab28e6154da..8271613666c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java @@ -27,6 +27,7 @@ import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; @@ -153,6 +154,11 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements @Override public void processOpts() { super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)"); + } + //apiTemplateFiles.clear(); if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { @@ -692,4 +698,31 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements } } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String pythonPostProcessFile = System.getenv("PYTHON_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(pythonPostProcessFile)) { + return; // skip if PYTHON_POST_PROCESS_FILE env variable is not defined + } + + // only process files with py extension + if ("py".equals(FilenameUtils.getExtension(file.toString()))) { + String command = pythonPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } + } -- GitLab From 66deaf1426107e3d64f54c64ec879c9a4629a61f Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 21 Sep 2018 12:55:17 +0800 Subject: [PATCH 2/3] update python samples with yapf --- .../python/.openapi-generator/VERSION | 2 +- .../client/petstore/python/docs/MapTest.md | 2 +- .../petstore/python/petstore_api/__init__.py | 2 - .../petstore_api/api/another_fake_api.py | 36 +- .../python/petstore_api/api/fake_api.py | 549 +++++++++++------- .../api/fake_classname_tags_123_api.py | 33 +- .../python/petstore_api/api/pet_api.py | 296 ++++++---- .../python/petstore_api/api/store_api.py | 114 ++-- .../python/petstore_api/api/user_api.py | 236 ++++---- .../python/petstore_api/api_client.py | 261 +++++---- .../python/petstore_api/configuration.py | 68 +-- .../python/petstore_api/models/__init__.py | 1 - .../models/additional_properties_class.py | 13 +- .../python/petstore_api/models/animal.py | 29 +- .../python/petstore_api/models/animal_farm.py | 16 +- .../petstore_api/models/api_response.py | 24 +- .../models/array_of_array_of_number_only.py | 18 +- .../models/array_of_number_only.py | 18 +- .../python/petstore_api/models/array_test.py | 15 +- .../petstore_api/models/capitalization.py | 18 +- .../python/petstore_api/models/cat.py | 18 +- .../python/petstore_api/models/category.py | 20 +- .../python/petstore_api/models/class_model.py | 18 +- .../python/petstore_api/models/client.py | 18 +- .../python/petstore_api/models/dog.py | 18 +- .../python/petstore_api/models/enum_arrays.py | 31 +- .../python/petstore_api/models/enum_class.py | 17 +- .../python/petstore_api/models/enum_test.py | 33 +- .../python/petstore_api/models/file.py | 18 +- .../models/file_schema_test_class.py | 20 +- .../python/petstore_api/models/format_test.py | 100 +++- .../petstore_api/models/has_only_read_only.py | 20 +- .../python/petstore_api/models/list.py | 18 +- .../python/petstore_api/models/map_test.py | 32 +- ...perties_and_additional_properties_class.py | 16 +- .../petstore_api/models/model200_response.py | 20 +- .../petstore_api/models/model_return.py | 18 +- .../python/petstore_api/models/name.py | 19 +- .../python/petstore_api/models/number_only.py | 18 +- .../python/petstore_api/models/order.py | 21 +- .../petstore_api/models/outer_composite.py | 13 +- .../python/petstore_api/models/outer_enum.py | 17 +- .../python/petstore_api/models/pet.py | 28 +- .../petstore_api/models/read_only_first.py | 20 +- .../petstore_api/models/special_model_name.py | 18 +- .../petstore_api/models/string_boolean_map.py | 16 +- .../python/petstore_api/models/tag.py | 20 +- .../python/petstore_api/models/user.py | 20 +- .../petstore/python/petstore_api/rest.py | 244 +++++--- samples/client/petstore/python/setup.py | 5 +- 50 files changed, 1416 insertions(+), 1229 deletions(-) diff --git a/samples/client/petstore/python/.openapi-generator/VERSION b/samples/client/petstore/python/.openapi-generator/VERSION index 105bb87d77b..6d94c9c2e12 100644 --- a/samples/client/petstore/python/.openapi-generator/VERSION +++ b/samples/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.2-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python/docs/MapTest.md b/samples/client/petstore/python/docs/MapTest.md index ee6036eb2f4..a5601691f88 100644 --- a/samples/client/petstore/python/docs/MapTest.md +++ b/samples/client/petstore/python/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **map_map_of_string** | **dict(str, dict(str, str))** | | [optional] **map_of_enum_string** | **dict(str, str)** | | [optional] **direct_map** | **dict(str, bool)** | | [optional] -**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirect_map** | **dict(str, bool)** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index f54256a687c..adc34f1e0f8 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -1,7 +1,6 @@ # coding: utf-8 # flake8: noqa - """ OpenAPI Petstore @@ -11,7 +10,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import __version__ = "1.0.0" diff --git a/samples/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/client/petstore/python/petstore_api/api/another_fake_api.py index 782f7fd07b3..889902ffd75 100644 --- a/samples/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/another_fake_api.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import re # noqa: F401 @@ -49,12 +47,15 @@ class AnotherFakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + return self.call_123_test_special_tags_with_http_info( + client, **kwargs) # noqa: E501 else: - (data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + (data) = self.call_123_test_special_tags_with_http_info( + client, **kwargs) # noqa: E501 return data - def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 + def call_123_test_special_tags_with_http_info(self, client, + **kwargs): # noqa: E501 """To test special tags # noqa: E501 To test special tags and operation ID starting with number # noqa: E501 @@ -80,16 +81,16 @@ class AnotherFakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method call_123_test_special_tags" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method call_123_test_special_tags" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set - if ('client' not in local_var_params or - local_var_params['client'] is None): - raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501 + if ('client' not in local_var_params + or local_var_params['client'] is None): + raise ValueError( + "Missing the required parameter `client` when calling `call_123_test_special_tags`" + ) # noqa: E501 collection_formats = {} @@ -110,14 +111,16 @@ class AnotherFakeApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/another-fake/dummy', 'PATCH', + '/another-fake/dummy', + 'PATCH', path_params, query_params, header_params, @@ -127,7 +130,8 @@ class AnotherFakeApi(object): response_type='Client', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/fake_api.py b/samples/client/petstore/python/petstore_api/api/fake_api.py index 00089d9a1e7..2ac02904c3c 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_api.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import re # noqa: F401 @@ -49,12 +47,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_boolean_serialize_with_http_info(**kwargs) # noqa: E501 + return self.fake_outer_boolean_serialize_with_http_info( + **kwargs) # noqa: E501 else: - (data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs) # noqa: E501 + (data) = self.fake_outer_boolean_serialize_with_http_info( + **kwargs) # noqa: E501 return data - def fake_outer_boolean_serialize_with_http_info(self, **kwargs): # noqa: E501 + def fake_outer_boolean_serialize_with_http_info(self, + **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 Test serialization of outer boolean types # noqa: E501 @@ -82,8 +83,7 @@ class FakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method fake_outer_boolean_serialize" % key - ) + " to method fake_outer_boolean_serialize" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -109,7 +109,8 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/boolean', 'POST', + '/fake/outer/boolean', + 'POST', path_params, query_params, header_params, @@ -119,7 +120,8 @@ class FakeApi(object): response_type='bool', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -141,12 +143,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_composite_serialize_with_http_info(**kwargs) # noqa: E501 + return self.fake_outer_composite_serialize_with_http_info( + **kwargs) # noqa: E501 else: - (data) = self.fake_outer_composite_serialize_with_http_info(**kwargs) # noqa: E501 + (data) = self.fake_outer_composite_serialize_with_http_info( + **kwargs) # noqa: E501 return data - def fake_outer_composite_serialize_with_http_info(self, **kwargs): # noqa: E501 + def fake_outer_composite_serialize_with_http_info(self, + **kwargs): # noqa: E501 """fake_outer_composite_serialize # noqa: E501 Test serialization of object with outer number type # noqa: E501 @@ -174,8 +179,7 @@ class FakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method fake_outer_composite_serialize" % key - ) + " to method fake_outer_composite_serialize" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -201,7 +205,8 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/composite', 'POST', + '/fake/outer/composite', + 'POST', path_params, query_params, header_params, @@ -211,7 +216,8 @@ class FakeApi(object): response_type='OuterComposite', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -233,12 +239,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_number_serialize_with_http_info(**kwargs) # noqa: E501 + return self.fake_outer_number_serialize_with_http_info( + **kwargs) # noqa: E501 else: - (data) = self.fake_outer_number_serialize_with_http_info(**kwargs) # noqa: E501 + (data) = self.fake_outer_number_serialize_with_http_info( + **kwargs) # noqa: E501 return data - def fake_outer_number_serialize_with_http_info(self, **kwargs): # noqa: E501 + def fake_outer_number_serialize_with_http_info(self, + **kwargs): # noqa: E501 """fake_outer_number_serialize # noqa: E501 Test serialization of outer number types # noqa: E501 @@ -264,10 +273,8 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_outer_number_serialize" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method fake_outer_number_serialize" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -293,7 +300,8 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/number', 'POST', + '/fake/outer/number', + 'POST', path_params, query_params, header_params, @@ -303,7 +311,8 @@ class FakeApi(object): response_type='float', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -325,12 +334,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_string_serialize_with_http_info(**kwargs) # noqa: E501 + return self.fake_outer_string_serialize_with_http_info( + **kwargs) # noqa: E501 else: - (data) = self.fake_outer_string_serialize_with_http_info(**kwargs) # noqa: E501 + (data) = self.fake_outer_string_serialize_with_http_info( + **kwargs) # noqa: E501 return data - def fake_outer_string_serialize_with_http_info(self, **kwargs): # noqa: E501 + def fake_outer_string_serialize_with_http_info(self, + **kwargs): # noqa: E501 """fake_outer_string_serialize # noqa: E501 Test serialization of outer string types # noqa: E501 @@ -356,10 +368,8 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method fake_outer_string_serialize" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method fake_outer_string_serialize" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -385,7 +395,8 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/string', 'POST', + '/fake/outer/string', + 'POST', path_params, query_params, header_params, @@ -395,12 +406,14 @@ class FakeApi(object): response_type='str', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501 + def test_body_with_file_schema(self, file_schema_test_class, + **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 For this test, the body for this request much reference a schema named `File`. # noqa: E501 @@ -417,12 +430,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + return self.test_body_with_file_schema_with_http_info( + file_schema_test_class, **kwargs) # noqa: E501 else: - (data) = self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 + (data) = self.test_body_with_file_schema_with_http_info( + file_schema_test_class, **kwargs) # noqa: E501 return data - def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501 + def test_body_with_file_schema_with_http_info(self, file_schema_test_class, + **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 For this test, the body for this request much reference a schema named `File`. # noqa: E501 @@ -448,16 +464,16 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test_body_with_file_schema" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method test_body_with_file_schema" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'file_schema_test_class' is set - if ('file_schema_test_class' not in local_var_params or - local_var_params['file_schema_test_class'] is None): - raise ValueError("Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`") # noqa: E501 + if ('file_schema_test_class' not in local_var_params + or local_var_params['file_schema_test_class'] is None): + raise ValueError( + "Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`" + ) # noqa: E501 collection_formats = {} @@ -474,14 +490,16 @@ class FakeApi(object): if 'file_schema_test_class' in local_var_params: body_params = local_var_params['file_schema_test_class'] # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/body-with-file-schema', 'PUT', + '/fake/body-with-file-schema', + 'PUT', path_params, query_params, header_params, @@ -491,7 +509,8 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -513,12 +532,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 + return self.test_body_with_query_params_with_http_info( + query, user, **kwargs) # noqa: E501 else: - (data) = self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 + (data) = self.test_body_with_query_params_with_http_info( + query, user, **kwargs) # noqa: E501 return data - def test_body_with_query_params_with_http_info(self, query, user, **kwargs): # noqa: E501 + def test_body_with_query_params_with_http_info(self, query, user, + **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -544,20 +566,22 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test_body_with_query_params" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method test_body_with_query_params" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'query' is set - if ('query' not in local_var_params or - local_var_params['query'] is None): - raise ValueError("Missing the required parameter `query` when calling `test_body_with_query_params`") # noqa: E501 + if ('query' not in local_var_params + or local_var_params['query'] is None): + raise ValueError( + "Missing the required parameter `query` when calling `test_body_with_query_params`" + ) # noqa: E501 # verify the required parameter 'user' is set - if ('user' not in local_var_params or - local_var_params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `test_body_with_query_params`") # noqa: E501 + if ('user' not in local_var_params + or local_var_params['user'] is None): + raise ValueError( + "Missing the required parameter `user` when calling `test_body_with_query_params`" + ) # noqa: E501 collection_formats = {} @@ -565,7 +589,8 @@ class FakeApi(object): query_params = [] if 'query' in local_var_params: - query_params.append(('query', local_var_params['query'])) # noqa: E501 + query_params.append(('query', + local_var_params['query'])) # noqa: E501 header_params = {} @@ -576,14 +601,16 @@ class FakeApi(object): if 'user' in local_var_params: body_params = local_var_params['user'] # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/body-with-query-params', 'PUT', + '/fake/body-with-query-params', + 'PUT', path_params, query_params, header_params, @@ -593,7 +620,8 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -615,9 +643,11 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 + return self.test_client_model_with_http_info( + client, **kwargs) # noqa: E501 else: - (data) = self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 + (data) = self.test_client_model_with_http_info( + client, **kwargs) # noqa: E501 return data def test_client_model_with_http_info(self, client, **kwargs): # noqa: E501 @@ -646,16 +676,16 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test_client_model" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method test_client_model" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set - if ('client' not in local_var_params or - local_var_params['client'] is None): - raise ValueError("Missing the required parameter `client` when calling `test_client_model`") # noqa: E501 + if ('client' not in local_var_params + or local_var_params['client'] is None): + raise ValueError( + "Missing the required parameter `client` when calling `test_client_model`" + ) # noqa: E501 collection_formats = {} @@ -676,14 +706,16 @@ class FakeApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake', 'PATCH', + '/fake', + 'PATCH', path_params, query_params, header_params, @@ -693,12 +725,15 @@ class FakeApi(object): response_type='Client', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 + def test_endpoint_parameters(self, number, double, + pattern_without_delimiter, byte, + **kwargs): # noqa: E501 """Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 @@ -728,12 +763,18 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) # noqa: E501 + return self.test_endpoint_parameters_with_http_info( + number, double, pattern_without_delimiter, byte, + **kwargs) # noqa: E501 else: - (data) = self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) # noqa: E501 + (data) = self.test_endpoint_parameters_with_http_info( + number, double, pattern_without_delimiter, byte, + **kwargs) # noqa: E501 return data - def test_endpoint_parameters_with_http_info(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 + def test_endpoint_parameters_with_http_info(self, number, double, + pattern_without_delimiter, + byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 @@ -764,7 +805,11 @@ class FakeApi(object): local_var_params = locals() - all_params = ['number', 'double', 'pattern_without_delimiter', 'byte', 'integer', 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', 'password', 'param_callback'] # noqa: E501 + all_params = [ + 'number', 'double', 'pattern_without_delimiter', 'byte', 'integer', + 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', + 'password', 'param_callback' + ] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -772,57 +817,102 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test_endpoint_parameters" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method test_endpoint_parameters" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'number' is set - if ('number' not in local_var_params or - local_var_params['number'] is None): - raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501 + if ('number' not in local_var_params + or local_var_params['number'] is None): + raise ValueError( + "Missing the required parameter `number` when calling `test_endpoint_parameters`" + ) # noqa: E501 # verify the required parameter 'double' is set - if ('double' not in local_var_params or - local_var_params['double'] is None): - raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501 + if ('double' not in local_var_params + or local_var_params['double'] is None): + raise ValueError( + "Missing the required parameter `double` when calling `test_endpoint_parameters`" + ) # noqa: E501 # verify the required parameter 'pattern_without_delimiter' is set - if ('pattern_without_delimiter' not in local_var_params or - local_var_params['pattern_without_delimiter'] is None): - raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501 + if ('pattern_without_delimiter' not in local_var_params + or local_var_params['pattern_without_delimiter'] is None): + raise ValueError( + "Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`" + ) # noqa: E501 # verify the required parameter 'byte' is set - if ('byte' not in local_var_params or - local_var_params['byte'] is None): - raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501 - - if 'number' in local_var_params and local_var_params['number'] > 543.2: # noqa: E501 - raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501 - if 'number' in local_var_params and local_var_params['number'] < 32.1: # noqa: E501 - raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501 - if 'double' in local_var_params and local_var_params['double'] > 123.4: # noqa: E501 - raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501 - if 'double' in local_var_params and local_var_params['double'] < 67.8: # noqa: E501 - raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501 - if 'pattern_without_delimiter' in local_var_params and not re.search('^[A-Z].*', local_var_params['pattern_without_delimiter']): # noqa: E501 - raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501 - if 'integer' in local_var_params and local_var_params['integer'] > 100: # noqa: E501 - raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501 - if 'integer' in local_var_params and local_var_params['integer'] < 10: # noqa: E501 - raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501 - if 'int32' in local_var_params and local_var_params['int32'] > 200: # noqa: E501 - raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501 - if 'int32' in local_var_params and local_var_params['int32'] < 20: # noqa: E501 - raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501 - if 'float' in local_var_params and local_var_params['float'] > 987.6: # noqa: E501 - raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501 - if 'string' in local_var_params and not re.search('[a-z]', local_var_params['string'], flags=re.IGNORECASE): # noqa: E501 - raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501 - if ('password' in local_var_params and - len(local_var_params['password']) > 64): - raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501 - if ('password' in local_var_params and - len(local_var_params['password']) < 10): - raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501 + if ('byte' not in local_var_params + or local_var_params['byte'] is None): + raise ValueError( + "Missing the required parameter `byte` when calling `test_endpoint_parameters`" + ) # noqa: E501 + + if 'number' in local_var_params and local_var_params[ + 'number'] > 543.2: # noqa: E501 + raise ValueError( + "Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`" + ) # noqa: E501 + if 'number' in local_var_params and local_var_params[ + 'number'] < 32.1: # noqa: E501 + raise ValueError( + "Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`" + ) # noqa: E501 + if 'double' in local_var_params and local_var_params[ + 'double'] > 123.4: # noqa: E501 + raise ValueError( + "Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`" + ) # noqa: E501 + if 'double' in local_var_params and local_var_params[ + 'double'] < 67.8: # noqa: E501 + raise ValueError( + "Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`" + ) # noqa: E501 + if 'pattern_without_delimiter' in local_var_params and not re.search( + '^[A-Z].*', + local_var_params['pattern_without_delimiter']): # noqa: E501 + raise ValueError( + "Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`" + ) # noqa: E501 + if 'integer' in local_var_params and local_var_params[ + 'integer'] > 100: # noqa: E501 + raise ValueError( + "Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`" + ) # noqa: E501 + if 'integer' in local_var_params and local_var_params[ + 'integer'] < 10: # noqa: E501 + raise ValueError( + "Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`" + ) # noqa: E501 + if 'int32' in local_var_params and local_var_params[ + 'int32'] > 200: # noqa: E501 + raise ValueError( + "Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`" + ) # noqa: E501 + if 'int32' in local_var_params and local_var_params[ + 'int32'] < 20: # noqa: E501 + raise ValueError( + "Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`" + ) # noqa: E501 + if 'float' in local_var_params and local_var_params[ + 'float'] > 987.6: # noqa: E501 + raise ValueError( + "Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`" + ) # noqa: E501 + if 'string' in local_var_params and not re.search( + '[a-z]', local_var_params['string'], + flags=re.IGNORECASE): # noqa: E501 + raise ValueError( + "Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`" + ) # noqa: E501 + if ('password' in local_var_params + and len(local_var_params['password']) > 64): + raise ValueError( + "Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`" + ) # noqa: E501 + if ('password' in local_var_params + and len(local_var_params['password']) < 10): + raise ValueError( + "Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`" + ) # noqa: E501 collection_formats = {} path_params = {} @@ -834,44 +924,61 @@ class FakeApi(object): form_params = [] local_var_files = {} if 'integer' in local_var_params: - form_params.append(('integer', local_var_params['integer'])) # noqa: E501 + form_params.append(('integer', + local_var_params['integer'])) # noqa: E501 if 'int32' in local_var_params: - form_params.append(('int32', local_var_params['int32'])) # noqa: E501 + form_params.append(('int32', + local_var_params['int32'])) # noqa: E501 if 'int64' in local_var_params: - form_params.append(('int64', local_var_params['int64'])) # noqa: E501 + form_params.append(('int64', + local_var_params['int64'])) # noqa: E501 if 'number' in local_var_params: - form_params.append(('number', local_var_params['number'])) # noqa: E501 + form_params.append(('number', + local_var_params['number'])) # noqa: E501 if 'float' in local_var_params: - form_params.append(('float', local_var_params['float'])) # noqa: E501 + form_params.append(('float', + local_var_params['float'])) # noqa: E501 if 'double' in local_var_params: - form_params.append(('double', local_var_params['double'])) # noqa: E501 + form_params.append(('double', + local_var_params['double'])) # noqa: E501 if 'string' in local_var_params: - form_params.append(('string', local_var_params['string'])) # noqa: E501 + form_params.append(('string', + local_var_params['string'])) # noqa: E501 if 'pattern_without_delimiter' in local_var_params: - form_params.append(('pattern_without_delimiter', local_var_params['pattern_without_delimiter'])) # noqa: E501 + form_params.append( + ('pattern_without_delimiter', + local_var_params['pattern_without_delimiter'])) # noqa: E501 if 'byte' in local_var_params: - form_params.append(('byte', local_var_params['byte'])) # noqa: E501 + form_params.append(('byte', + local_var_params['byte'])) # noqa: E501 if 'binary' in local_var_params: - local_var_files['binary'] = local_var_params['binary'] # noqa: E501 + local_var_files['binary'] = local_var_params[ + 'binary'] # noqa: E501 if 'date' in local_var_params: - form_params.append(('date', local_var_params['date'])) # noqa: E501 + form_params.append(('date', + local_var_params['date'])) # noqa: E501 if 'date_time' in local_var_params: - form_params.append(('dateTime', local_var_params['date_time'])) # noqa: E501 + form_params.append(('dateTime', + local_var_params['date_time'])) # noqa: E501 if 'password' in local_var_params: - form_params.append(('password', local_var_params['password'])) # noqa: E501 + form_params.append(('password', + local_var_params['password'])) # noqa: E501 if 'param_callback' in local_var_params: - form_params.append(('callback', local_var_params['param_callback'])) # noqa: E501 + form_params.append( + ('callback', local_var_params['param_callback'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = ['http_basic_test'] # noqa: E501 return self.api_client.call_api( - '/fake', 'POST', + '/fake', + 'POST', path_params, query_params, header_params, @@ -881,7 +988,8 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -910,9 +1018,11 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_enum_parameters_with_http_info(**kwargs) # noqa: E501 + return self.test_enum_parameters_with_http_info( + **kwargs) # noqa: E501 else: - (data) = self.test_enum_parameters_with_http_info(**kwargs) # noqa: E501 + (data) = self.test_enum_parameters_with_http_info( + **kwargs) # noqa: E501 return data def test_enum_parameters_with_http_info(self, **kwargs): # noqa: E501 @@ -940,7 +1050,12 @@ class FakeApi(object): local_var_params = locals() - all_params = ['enum_header_string_array', 'enum_header_string', 'enum_query_string_array', 'enum_query_string', 'enum_query_integer', 'enum_query_double', 'enum_form_string_array', 'enum_form_string'] # noqa: E501 + all_params = [ + 'enum_header_string_array', 'enum_header_string', + 'enum_query_string_array', 'enum_query_string', + 'enum_query_integer', 'enum_query_double', + 'enum_form_string_array', 'enum_form_string' + ] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -948,10 +1063,8 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test_enum_parameters" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method test_enum_parameters" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -961,40 +1074,57 @@ class FakeApi(object): query_params = [] if 'enum_query_string_array' in local_var_params: - query_params.append(('enum_query_string_array', local_var_params['enum_query_string_array'])) # noqa: E501 + query_params.append( + ('enum_query_string_array', + local_var_params['enum_query_string_array'])) # noqa: E501 collection_formats['enum_query_string_array'] = 'csv' # noqa: E501 if 'enum_query_string' in local_var_params: - query_params.append(('enum_query_string', local_var_params['enum_query_string'])) # noqa: E501 + query_params.append( + ('enum_query_string', + local_var_params['enum_query_string'])) # noqa: E501 if 'enum_query_integer' in local_var_params: - query_params.append(('enum_query_integer', local_var_params['enum_query_integer'])) # noqa: E501 + query_params.append( + ('enum_query_integer', + local_var_params['enum_query_integer'])) # noqa: E501 if 'enum_query_double' in local_var_params: - query_params.append(('enum_query_double', local_var_params['enum_query_double'])) # noqa: E501 + query_params.append( + ('enum_query_double', + local_var_params['enum_query_double'])) # noqa: E501 header_params = {} if 'enum_header_string_array' in local_var_params: - header_params['enum_header_string_array'] = local_var_params['enum_header_string_array'] # noqa: E501 - collection_formats['enum_header_string_array'] = 'csv' # noqa: E501 + header_params['enum_header_string_array'] = local_var_params[ + 'enum_header_string_array'] # noqa: E501 + collection_formats[ + 'enum_header_string_array'] = 'csv' # noqa: E501 if 'enum_header_string' in local_var_params: - header_params['enum_header_string'] = local_var_params['enum_header_string'] # noqa: E501 + header_params['enum_header_string'] = local_var_params[ + 'enum_header_string'] # noqa: E501 form_params = [] local_var_files = {} if 'enum_form_string_array' in local_var_params: - form_params.append(('enum_form_string_array', local_var_params['enum_form_string_array'])) # noqa: E501 + form_params.append( + ('enum_form_string_array', + local_var_params['enum_form_string_array'])) # noqa: E501 collection_formats['enum_form_string_array'] = 'csv' # noqa: E501 if 'enum_form_string' in local_var_params: - form_params.append(('enum_form_string', local_var_params['enum_form_string'])) # noqa: E501 + form_params.append( + ('enum_form_string', + local_var_params['enum_form_string'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake', 'GET', + '/fake', + 'GET', path_params, query_params, header_params, @@ -1004,12 +1134,14 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def test_inline_additional_properties(self, request_body, **kwargs): # noqa: E501 + def test_inline_additional_properties(self, request_body, + **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1025,12 +1157,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 + return self.test_inline_additional_properties_with_http_info( + request_body, **kwargs) # noqa: E501 else: - (data) = self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 + (data) = self.test_inline_additional_properties_with_http_info( + request_body, **kwargs) # noqa: E501 return data - def test_inline_additional_properties_with_http_info(self, request_body, **kwargs): # noqa: E501 + def test_inline_additional_properties_with_http_info( + self, request_body, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1057,14 +1192,15 @@ class FakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method test_inline_additional_properties" % key - ) + " to method test_inline_additional_properties" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'request_body' is set - if ('request_body' not in local_var_params or - local_var_params['request_body'] is None): - raise ValueError("Missing the required parameter `request_body` when calling `test_inline_additional_properties`") # noqa: E501 + if ('request_body' not in local_var_params + or local_var_params['request_body'] is None): + raise ValueError( + "Missing the required parameter `request_body` when calling `test_inline_additional_properties`" + ) # noqa: E501 collection_formats = {} @@ -1081,14 +1217,16 @@ class FakeApi(object): if 'request_body' in local_var_params: body_params = local_var_params['request_body'] # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/inline-additionalProperties', 'POST', + '/fake/inline-additionalProperties', + 'POST', path_params, query_params, header_params, @@ -1098,7 +1236,8 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -1120,12 +1259,15 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 + return self.test_json_form_data_with_http_info( + param, param2, **kwargs) # noqa: E501 else: - (data) = self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 + (data) = self.test_json_form_data_with_http_info( + param, param2, **kwargs) # noqa: E501 return data - def test_json_form_data_with_http_info(self, param, param2, **kwargs): # noqa: E501 + def test_json_form_data_with_http_info(self, param, param2, + **kwargs): # noqa: E501 """test json serialization of form data # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1151,20 +1293,22 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test_json_form_data" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method test_json_form_data" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'param' is set - if ('param' not in local_var_params or - local_var_params['param'] is None): - raise ValueError("Missing the required parameter `param` when calling `test_json_form_data`") # noqa: E501 + if ('param' not in local_var_params + or local_var_params['param'] is None): + raise ValueError( + "Missing the required parameter `param` when calling `test_json_form_data`" + ) # noqa: E501 # verify the required parameter 'param2' is set - if ('param2' not in local_var_params or - local_var_params['param2'] is None): - raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501 + if ('param2' not in local_var_params + or local_var_params['param2'] is None): + raise ValueError( + "Missing the required parameter `param2` when calling `test_json_form_data`" + ) # noqa: E501 collection_formats = {} @@ -1177,20 +1321,24 @@ class FakeApi(object): form_params = [] local_var_files = {} if 'param' in local_var_params: - form_params.append(('param', local_var_params['param'])) # noqa: E501 + form_params.append(('param', + local_var_params['param'])) # noqa: E501 if 'param2' in local_var_params: - form_params.append(('param2', local_var_params['param2'])) # noqa: E501 + form_params.append(('param2', + local_var_params['param2'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/jsonFormData', 'GET', + '/fake/jsonFormData', + 'GET', path_params, query_params, header_params, @@ -1200,7 +1348,8 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index 80e03e6626e..9330ac8bed1 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import re # noqa: F401 @@ -49,9 +47,11 @@ class FakeClassnameTags123Api(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_classname_with_http_info(client, **kwargs) # noqa: E501 + return self.test_classname_with_http_info(client, + **kwargs) # noqa: E501 else: - (data) = self.test_classname_with_http_info(client, **kwargs) # noqa: E501 + (data) = self.test_classname_with_http_info(client, + **kwargs) # noqa: E501 return data def test_classname_with_http_info(self, client, **kwargs): # noqa: E501 @@ -80,16 +80,16 @@ class FakeClassnameTags123Api(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method test_classname" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method test_classname" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set - if ('client' not in local_var_params or - local_var_params['client'] is None): - raise ValueError("Missing the required parameter `client` when calling `test_classname`") # noqa: E501 + if ('client' not in local_var_params + or local_var_params['client'] is None): + raise ValueError( + "Missing the required parameter `client` when calling `test_classname`" + ) # noqa: E501 collection_formats = {} @@ -110,14 +110,16 @@ class FakeClassnameTags123Api(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['api_key_query'] # noqa: E501 return self.api_client.call_api( - '/fake_classname_test', 'PATCH', + '/fake_classname_test', + 'PATCH', path_params, query_params, header_params, @@ -127,7 +129,8 @@ class FakeClassnameTags123Api(object): response_type='Client', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/pet_api.py b/samples/client/petstore/python/petstore_api/api/pet_api.py index cee0e90ab5c..8612eeed9f1 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import re # noqa: F401 @@ -78,16 +76,15 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_pet" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method add_pet" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet' is set - if ('pet' not in local_var_params or - local_var_params['pet'] is None): - raise ValueError("Missing the required parameter `pet` when calling `add_pet`") # noqa: E501 + if ('pet' not in local_var_params or local_var_params['pet'] is None): + raise ValueError( + "Missing the required parameter `pet` when calling `add_pet`" + ) # noqa: E501 collection_formats = {} @@ -104,14 +101,16 @@ class PetApi(object): if 'pet' in local_var_params: body_params = local_var_params['pet'] # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json', 'application/xml']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json', 'application/xml']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet', 'POST', + '/pet', + 'POST', path_params, query_params, header_params, @@ -121,7 +120,8 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -143,9 +143,11 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.delete_pet_with_http_info(pet_id, **kwargs) # noqa: E501 + return self.delete_pet_with_http_info(pet_id, + **kwargs) # noqa: E501 else: - (data) = self.delete_pet_with_http_info(pet_id, **kwargs) # noqa: E501 + (data) = self.delete_pet_with_http_info(pet_id, + **kwargs) # noqa: E501 return data def delete_pet_with_http_info(self, pet_id, **kwargs): # noqa: E501 @@ -174,16 +176,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_pet" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method delete_pet" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params or - local_var_params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501 + if ('pet_id' not in local_var_params + or local_var_params['pet_id'] is None): + raise ValueError( + "Missing the required parameter `pet_id` when calling `delete_pet`" + ) # noqa: E501 collection_formats = {} @@ -195,7 +197,8 @@ class PetApi(object): header_params = {} if 'api_key' in local_var_params: - header_params['api_key'] = local_var_params['api_key'] # noqa: E501 + header_params['api_key'] = local_var_params[ + 'api_key'] # noqa: E501 form_params = [] local_var_files = {} @@ -205,7 +208,8 @@ class PetApi(object): auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}', 'DELETE', + '/pet/{petId}', + 'DELETE', path_params, query_params, header_params, @@ -215,7 +219,8 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -237,12 +242,15 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 + return self.find_pets_by_status_with_http_info( + status, **kwargs) # noqa: E501 else: - (data) = self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 + (data) = self.find_pets_by_status_with_http_info( + status, **kwargs) # noqa: E501 return data - def find_pets_by_status_with_http_info(self, status, **kwargs): # noqa: E501 + def find_pets_by_status_with_http_info(self, status, + **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 Multiple status values can be provided with comma separated strings # noqa: E501 @@ -268,16 +276,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method find_pets_by_status" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method find_pets_by_status" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'status' is set - if ('status' not in local_var_params or - local_var_params['status'] is None): - raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501 + if ('status' not in local_var_params + or local_var_params['status'] is None): + raise ValueError( + "Missing the required parameter `status` when calling `find_pets_by_status`" + ) # noqa: E501 collection_formats = {} @@ -285,7 +293,8 @@ class PetApi(object): query_params = [] if 'status' in local_var_params: - query_params.append(('status', local_var_params['status'])) # noqa: E501 + query_params.append(('status', + local_var_params['status'])) # noqa: E501 collection_formats['status'] = 'csv' # noqa: E501 header_params = {} @@ -302,7 +311,8 @@ class PetApi(object): auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/findByStatus', 'GET', + '/pet/findByStatus', + 'GET', path_params, query_params, header_params, @@ -312,7 +322,8 @@ class PetApi(object): response_type='list[Pet]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -334,9 +345,11 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 + return self.find_pets_by_tags_with_http_info( + tags, **kwargs) # noqa: E501 else: - (data) = self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 + (data) = self.find_pets_by_tags_with_http_info( + tags, **kwargs) # noqa: E501 return data def find_pets_by_tags_with_http_info(self, tags, **kwargs): # noqa: E501 @@ -365,16 +378,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method find_pets_by_tags" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method find_pets_by_tags" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'tags' is set - if ('tags' not in local_var_params or - local_var_params['tags'] is None): - raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501 + if ('tags' not in local_var_params + or local_var_params['tags'] is None): + raise ValueError( + "Missing the required parameter `tags` when calling `find_pets_by_tags`" + ) # noqa: E501 collection_formats = {} @@ -382,7 +395,8 @@ class PetApi(object): query_params = [] if 'tags' in local_var_params: - query_params.append(('tags', local_var_params['tags'])) # noqa: E501 + query_params.append(('tags', + local_var_params['tags'])) # noqa: E501 collection_formats['tags'] = 'csv' # noqa: E501 header_params = {} @@ -399,7 +413,8 @@ class PetApi(object): auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/findByTags', 'GET', + '/pet/findByTags', + 'GET', path_params, query_params, header_params, @@ -409,7 +424,8 @@ class PetApi(object): response_type='list[Pet]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -431,9 +447,11 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 + return self.get_pet_by_id_with_http_info(pet_id, + **kwargs) # noqa: E501 else: - (data) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 + (data) = self.get_pet_by_id_with_http_info(pet_id, + **kwargs) # noqa: E501 return data def get_pet_by_id_with_http_info(self, pet_id, **kwargs): # noqa: E501 @@ -462,16 +480,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_pet_by_id" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method get_pet_by_id" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params or - local_var_params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501 + if ('pet_id' not in local_var_params + or local_var_params['pet_id'] is None): + raise ValueError( + "Missing the required parameter `pet_id` when calling `get_pet_by_id`" + ) # noqa: E501 collection_formats = {} @@ -495,7 +513,8 @@ class PetApi(object): auth_settings = ['api_key'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}', 'GET', + '/pet/{petId}', + 'GET', path_params, query_params, header_params, @@ -505,7 +524,8 @@ class PetApi(object): response_type='Pet', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -528,7 +548,8 @@ class PetApi(object): if kwargs.get('async_req'): return self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 else: - (data) = self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 + (data) = self.update_pet_with_http_info(pet, + **kwargs) # noqa: E501 return data def update_pet_with_http_info(self, pet, **kwargs): # noqa: E501 @@ -556,16 +577,15 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_pet" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method update_pet" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet' is set - if ('pet' not in local_var_params or - local_var_params['pet'] is None): - raise ValueError("Missing the required parameter `pet` when calling `update_pet`") # noqa: E501 + if ('pet' not in local_var_params or local_var_params['pet'] is None): + raise ValueError( + "Missing the required parameter `pet` when calling `update_pet`" + ) # noqa: E501 collection_formats = {} @@ -582,14 +602,16 @@ class PetApi(object): if 'pet' in local_var_params: body_params = local_var_params['pet'] # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json', 'application/xml']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json', 'application/xml']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet', 'PUT', + '/pet', + 'PUT', path_params, query_params, header_params, @@ -599,7 +621,8 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -622,12 +645,15 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.update_pet_with_form_with_http_info(pet_id, **kwargs) # noqa: E501 + return self.update_pet_with_form_with_http_info( + pet_id, **kwargs) # noqa: E501 else: - (data) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) # noqa: E501 + (data) = self.update_pet_with_form_with_http_info( + pet_id, **kwargs) # noqa: E501 return data - def update_pet_with_form_with_http_info(self, pet_id, **kwargs): # noqa: E501 + def update_pet_with_form_with_http_info(self, pet_id, + **kwargs): # noqa: E501 """Updates a pet in the store with form data # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -654,16 +680,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_pet_with_form" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method update_pet_with_form" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params or - local_var_params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501 + if ('pet_id' not in local_var_params + or local_var_params['pet_id'] is None): + raise ValueError( + "Missing the required parameter `pet_id` when calling `update_pet_with_form`" + ) # noqa: E501 collection_formats = {} @@ -678,20 +704,24 @@ class PetApi(object): form_params = [] local_var_files = {} if 'name' in local_var_params: - form_params.append(('name', local_var_params['name'])) # noqa: E501 + form_params.append(('name', + local_var_params['name'])) # noqa: E501 if 'status' in local_var_params: - form_params.append(('status', local_var_params['status'])) # noqa: E501 + form_params.append(('status', + local_var_params['status'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}', 'POST', + '/pet/{petId}', + 'POST', path_params, query_params, header_params, @@ -701,7 +731,8 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -724,9 +755,11 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.upload_file_with_http_info(pet_id, **kwargs) # noqa: E501 + return self.upload_file_with_http_info(pet_id, + **kwargs) # noqa: E501 else: - (data) = self.upload_file_with_http_info(pet_id, **kwargs) # noqa: E501 + (data) = self.upload_file_with_http_info(pet_id, + **kwargs) # noqa: E501 return data def upload_file_with_http_info(self, pet_id, **kwargs): # noqa: E501 @@ -756,16 +789,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method upload_file" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method upload_file" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params or - local_var_params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501 + if ('pet_id' not in local_var_params + or local_var_params['pet_id'] is None): + raise ValueError( + "Missing the required parameter `pet_id` when calling `upload_file`" + ) # noqa: E501 collection_formats = {} @@ -780,7 +813,9 @@ class PetApi(object): form_params = [] local_var_files = {} if 'additional_metadata' in local_var_params: - form_params.append(('additionalMetadata', local_var_params['additional_metadata'])) # noqa: E501 + form_params.append( + ('additionalMetadata', + local_var_params['additional_metadata'])) # noqa: E501 if 'file' in local_var_params: local_var_files['file'] = local_var_params['file'] # noqa: E501 @@ -790,14 +825,16 @@ class PetApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['multipart/form-data']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}/uploadImage', 'POST', + '/pet/{petId}/uploadImage', + 'POST', path_params, query_params, header_params, @@ -807,12 +844,14 @@ class PetApi(object): response_type='ApiResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def upload_file_with_required_file(self, pet_id, required_file, **kwargs): # noqa: E501 + def upload_file_with_required_file(self, pet_id, required_file, + **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -830,12 +869,15 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 + return self.upload_file_with_required_file_with_http_info( + pet_id, required_file, **kwargs) # noqa: E501 else: - (data) = self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 + (data) = self.upload_file_with_required_file_with_http_info( + pet_id, required_file, **kwargs) # noqa: E501 return data - def upload_file_with_required_file_with_http_info(self, pet_id, required_file, **kwargs): # noqa: E501 + def upload_file_with_required_file_with_http_info( + self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -854,7 +896,8 @@ class PetApi(object): local_var_params = locals() - all_params = ['pet_id', 'required_file', 'additional_metadata'] # noqa: E501 + all_params = ['pet_id', 'required_file', + 'additional_metadata'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -864,18 +907,21 @@ class PetApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method upload_file_with_required_file" % key - ) + " to method upload_file_with_required_file" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params or - local_var_params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501 + if ('pet_id' not in local_var_params + or local_var_params['pet_id'] is None): + raise ValueError( + "Missing the required parameter `pet_id` when calling `upload_file_with_required_file`" + ) # noqa: E501 # verify the required parameter 'required_file' is set - if ('required_file' not in local_var_params or - local_var_params['required_file'] is None): - raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501 + if ('required_file' not in local_var_params + or local_var_params['required_file'] is None): + raise ValueError( + "Missing the required parameter `required_file` when calling `upload_file_with_required_file`" + ) # noqa: E501 collection_formats = {} @@ -890,9 +936,12 @@ class PetApi(object): form_params = [] local_var_files = {} if 'additional_metadata' in local_var_params: - form_params.append(('additionalMetadata', local_var_params['additional_metadata'])) # noqa: E501 + form_params.append( + ('additionalMetadata', + local_var_params['additional_metadata'])) # noqa: E501 if 'required_file' in local_var_params: - local_var_files['requiredFile'] = local_var_params['required_file'] # noqa: E501 + local_var_files['requiredFile'] = local_var_params[ + 'required_file'] # noqa: E501 body_params = None # HTTP header `Accept` @@ -900,14 +949,16 @@ class PetApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['multipart/form-data']) # noqa: E501 + header_params[ + 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/fake/{petId}/uploadImageWithRequiredFile', 'POST', + '/fake/{petId}/uploadImageWithRequiredFile', + 'POST', path_params, query_params, header_params, @@ -917,7 +968,8 @@ class PetApi(object): response_type='ApiResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/store_api.py b/samples/client/petstore/python/petstore_api/api/store_api.py index 8d471fddabf..da2bcd3f7bd 100644 --- a/samples/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/client/petstore/python/petstore_api/api/store_api.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import re # noqa: F401 @@ -49,9 +47,11 @@ class StoreApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 + return self.delete_order_with_http_info(order_id, + **kwargs) # noqa: E501 else: - (data) = self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 + (data) = self.delete_order_with_http_info(order_id, + **kwargs) # noqa: E501 return data def delete_order_with_http_info(self, order_id, **kwargs): # noqa: E501 @@ -80,22 +80,23 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_order" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method delete_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501 + if ('order_id' not in local_var_params + or local_var_params['order_id'] is None): + raise ValueError( + "Missing the required parameter `order_id` when calling `delete_order`" + ) # noqa: E501 collection_formats = {} path_params = {} if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 + path_params['order_id'] = local_var_params[ + 'order_id'] # noqa: E501 query_params = [] @@ -109,7 +110,8 @@ class StoreApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/store/order/{order_id}', 'DELETE', + '/store/order/{order_id}', + 'DELETE', path_params, query_params, header_params, @@ -119,7 +121,8 @@ class StoreApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -170,10 +173,8 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_inventory" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method get_inventory" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -197,7 +198,8 @@ class StoreApi(object): auth_settings = ['api_key'] # noqa: E501 return self.api_client.call_api( - '/store/inventory', 'GET', + '/store/inventory', + 'GET', path_params, query_params, header_params, @@ -207,7 +209,8 @@ class StoreApi(object): response_type='dict(str, int)', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -229,9 +232,11 @@ class StoreApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + return self.get_order_by_id_with_http_info(order_id, + **kwargs) # noqa: E501 else: - (data) = self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 + (data) = self.get_order_by_id_with_http_info( + order_id, **kwargs) # noqa: E501 return data def get_order_by_id_with_http_info(self, order_id, **kwargs): # noqa: E501 @@ -260,26 +265,33 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_order_by_id" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method get_order_by_id" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params or - local_var_params['order_id'] is None): - raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501 - - if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501 - raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501 - if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501 - raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501 + if ('order_id' not in local_var_params + or local_var_params['order_id'] is None): + raise ValueError( + "Missing the required parameter `order_id` when calling `get_order_by_id`" + ) # noqa: E501 + + if 'order_id' in local_var_params and local_var_params[ + 'order_id'] > 5: # noqa: E501 + raise ValueError( + "Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`" + ) # noqa: E501 + if 'order_id' in local_var_params and local_var_params[ + 'order_id'] < 1: # noqa: E501 + raise ValueError( + "Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`" + ) # noqa: E501 collection_formats = {} path_params = {} if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params['order_id'] # noqa: E501 + path_params['order_id'] = local_var_params[ + 'order_id'] # noqa: E501 query_params = [] @@ -297,7 +309,8 @@ class StoreApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/store/order/{order_id}', 'GET', + '/store/order/{order_id}', + 'GET', path_params, query_params, header_params, @@ -307,7 +320,8 @@ class StoreApi(object): response_type='Order', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -328,9 +342,11 @@ class StoreApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.place_order_with_http_info(order, **kwargs) # noqa: E501 + return self.place_order_with_http_info(order, + **kwargs) # noqa: E501 else: - (data) = self.place_order_with_http_info(order, **kwargs) # noqa: E501 + (data) = self.place_order_with_http_info(order, + **kwargs) # noqa: E501 return data def place_order_with_http_info(self, order, **kwargs): # noqa: E501 @@ -358,16 +374,16 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method place_order" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method place_order" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order' is set - if ('order' not in local_var_params or - local_var_params['order'] is None): - raise ValueError("Missing the required parameter `order` when calling `place_order`") # noqa: E501 + if ('order' not in local_var_params + or local_var_params['order'] is None): + raise ValueError( + "Missing the required parameter `order` when calling `place_order`" + ) # noqa: E501 collection_formats = {} @@ -391,7 +407,8 @@ class StoreApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/store/order', 'POST', + '/store/order', + 'POST', path_params, query_params, header_params, @@ -401,7 +418,8 @@ class StoreApi(object): response_type='Order', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/user_api.py b/samples/client/petstore/python/petstore_api/api/user_api.py index e86ac277e97..e163bad77d9 100644 --- a/samples/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/client/petstore/python/petstore_api/api/user_api.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import re # noqa: F401 @@ -49,9 +47,11 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.create_user_with_http_info(user, **kwargs) # noqa: E501 + return self.create_user_with_http_info(user, + **kwargs) # noqa: E501 else: - (data) = self.create_user_with_http_info(user, **kwargs) # noqa: E501 + (data) = self.create_user_with_http_info(user, + **kwargs) # noqa: E501 return data def create_user_with_http_info(self, user, **kwargs): # noqa: E501 @@ -80,16 +80,16 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_user" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method create_user" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'user' is set - if ('user' not in local_var_params or - local_var_params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `create_user`") # noqa: E501 + if ('user' not in local_var_params + or local_var_params['user'] is None): + raise ValueError( + "Missing the required parameter `user` when calling `create_user`" + ) # noqa: E501 collection_formats = {} @@ -109,7 +109,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user', 'POST', + '/user', + 'POST', path_params, query_params, header_params, @@ -119,7 +120,8 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -140,12 +142,15 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 + return self.create_users_with_array_input_with_http_info( + user, **kwargs) # noqa: E501 else: - (data) = self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 + (data) = self.create_users_with_array_input_with_http_info( + user, **kwargs) # noqa: E501 return data - def create_users_with_array_input_with_http_info(self, user, **kwargs): # noqa: E501 + def create_users_with_array_input_with_http_info(self, user, + **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -172,14 +177,15 @@ class UserApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method create_users_with_array_input" % key - ) + " to method create_users_with_array_input" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'user' is set - if ('user' not in local_var_params or - local_var_params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `create_users_with_array_input`") # noqa: E501 + if ('user' not in local_var_params + or local_var_params['user'] is None): + raise ValueError( + "Missing the required parameter `user` when calling `create_users_with_array_input`" + ) # noqa: E501 collection_formats = {} @@ -199,7 +205,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/createWithArray', 'POST', + '/user/createWithArray', + 'POST', path_params, query_params, header_params, @@ -209,7 +216,8 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -230,12 +238,15 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 + return self.create_users_with_list_input_with_http_info( + user, **kwargs) # noqa: E501 else: - (data) = self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 + (data) = self.create_users_with_list_input_with_http_info( + user, **kwargs) # noqa: E501 return data - def create_users_with_list_input_with_http_info(self, user, **kwargs): # noqa: E501 + def create_users_with_list_input_with_http_info(self, user, + **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -262,14 +273,15 @@ class UserApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method create_users_with_list_input" % key - ) + " to method create_users_with_list_input" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'user' is set - if ('user' not in local_var_params or - local_var_params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `create_users_with_list_input`") # noqa: E501 + if ('user' not in local_var_params + or local_var_params['user'] is None): + raise ValueError( + "Missing the required parameter `user` when calling `create_users_with_list_input`" + ) # noqa: E501 collection_formats = {} @@ -289,7 +301,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/createWithList', 'POST', + '/user/createWithList', + 'POST', path_params, query_params, header_params, @@ -299,7 +312,8 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -321,9 +335,11 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + return self.delete_user_with_http_info(username, + **kwargs) # noqa: E501 else: - (data) = self.delete_user_with_http_info(username, **kwargs) # noqa: E501 + (data) = self.delete_user_with_http_info(username, + **kwargs) # noqa: E501 return data def delete_user_with_http_info(self, username, **kwargs): # noqa: E501 @@ -352,22 +368,23 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_user" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method delete_user" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params or - local_var_params['username'] is None): - raise ValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501 + if ('username' not in local_var_params + or local_var_params['username'] is None): + raise ValueError( + "Missing the required parameter `username` when calling `delete_user`" + ) # noqa: E501 collection_formats = {} path_params = {} if 'username' in local_var_params: - path_params['username'] = local_var_params['username'] # noqa: E501 + path_params['username'] = local_var_params[ + 'username'] # noqa: E501 query_params = [] @@ -381,7 +398,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/{username}', 'DELETE', + '/user/{username}', + 'DELETE', path_params, query_params, header_params, @@ -391,7 +409,8 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -412,12 +431,15 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 + return self.get_user_by_name_with_http_info(username, + **kwargs) # noqa: E501 else: - (data) = self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 + (data) = self.get_user_by_name_with_http_info( + username, **kwargs) # noqa: E501 return data - def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 + def get_user_by_name_with_http_info(self, username, + **kwargs): # noqa: E501 """Get user by user name # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -442,22 +464,23 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_user_by_name" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method get_user_by_name" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params or - local_var_params['username'] is None): - raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501 + if ('username' not in local_var_params + or local_var_params['username'] is None): + raise ValueError( + "Missing the required parameter `username` when calling `get_user_by_name`" + ) # noqa: E501 collection_formats = {} path_params = {} if 'username' in local_var_params: - path_params['username'] = local_var_params['username'] # noqa: E501 + path_params['username'] = local_var_params[ + 'username'] # noqa: E501 query_params = [] @@ -475,7 +498,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/{username}', 'GET', + '/user/{username}', + 'GET', path_params, query_params, header_params, @@ -485,7 +509,8 @@ class UserApi(object): response_type='User', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -507,12 +532,15 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 + return self.login_user_with_http_info(username, password, + **kwargs) # noqa: E501 else: - (data) = self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 + (data) = self.login_user_with_http_info(username, password, + **kwargs) # noqa: E501 return data - def login_user_with_http_info(self, username, password, **kwargs): # noqa: E501 + def login_user_with_http_info(self, username, password, + **kwargs): # noqa: E501 """Logs user into the system # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -538,20 +566,22 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method login_user" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method login_user" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params or - local_var_params['username'] is None): - raise ValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501 + if ('username' not in local_var_params + or local_var_params['username'] is None): + raise ValueError( + "Missing the required parameter `username` when calling `login_user`" + ) # noqa: E501 # verify the required parameter 'password' is set - if ('password' not in local_var_params or - local_var_params['password'] is None): - raise ValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501 + if ('password' not in local_var_params + or local_var_params['password'] is None): + raise ValueError( + "Missing the required parameter `password` when calling `login_user`" + ) # noqa: E501 collection_formats = {} @@ -559,9 +589,11 @@ class UserApi(object): query_params = [] if 'username' in local_var_params: - query_params.append(('username', local_var_params['username'])) # noqa: E501 + query_params.append(('username', + local_var_params['username'])) # noqa: E501 if 'password' in local_var_params: - query_params.append(('password', local_var_params['password'])) # noqa: E501 + query_params.append(('password', + local_var_params['password'])) # noqa: E501 header_params = {} @@ -577,7 +609,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/login', 'GET', + '/user/login', + 'GET', path_params, query_params, header_params, @@ -587,7 +620,8 @@ class UserApi(object): response_type='str', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -636,10 +670,8 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method logout_user" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method logout_user" % key) local_var_params[key] = val del local_var_params['kwargs'] @@ -659,7 +691,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/logout', 'GET', + '/user/logout', + 'GET', path_params, query_params, header_params, @@ -669,7 +702,8 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -692,12 +726,15 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 + return self.update_user_with_http_info(username, user, + **kwargs) # noqa: E501 else: - (data) = self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 + (data) = self.update_user_with_http_info(username, user, + **kwargs) # noqa: E501 return data - def update_user_with_http_info(self, username, user, **kwargs): # noqa: E501 + def update_user_with_http_info(self, username, user, + **kwargs): # noqa: E501 """Updated user # noqa: E501 This can only be done by the logged in user. # noqa: E501 @@ -724,26 +761,29 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_user" % key - ) + raise TypeError("Got an unexpected keyword argument '%s'" + " to method update_user" % key) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params or - local_var_params['username'] is None): - raise ValueError("Missing the required parameter `username` when calling `update_user`") # noqa: E501 + if ('username' not in local_var_params + or local_var_params['username'] is None): + raise ValueError( + "Missing the required parameter `username` when calling `update_user`" + ) # noqa: E501 # verify the required parameter 'user' is set - if ('user' not in local_var_params or - local_var_params['user'] is None): - raise ValueError("Missing the required parameter `user` when calling `update_user`") # noqa: E501 + if ('user' not in local_var_params + or local_var_params['user'] is None): + raise ValueError( + "Missing the required parameter `user` when calling `update_user`" + ) # noqa: E501 collection_formats = {} path_params = {} if 'username' in local_var_params: - path_params['username'] = local_var_params['username'] # noqa: E501 + path_params['username'] = local_var_params[ + 'username'] # noqa: E501 query_params = [] @@ -759,7 +799,8 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/{username}', 'PUT', + '/user/{username}', + 'PUT', path_params, query_params, header_params, @@ -769,7 +810,8 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get( + '_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index e90d9f7e205..eba6151d293 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -59,7 +59,10 @@ class ApiClient(object): 'object': object, } - def __init__(self, configuration=None, header_name=None, header_value=None, + def __init__(self, + configuration=None, + header_name=None, + header_value=None, cookie=None): if configuration is None: configuration = Configuration() @@ -90,12 +93,21 @@ class ApiClient(object): def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value - def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): + def __call_api(self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None): config = self.configuration @@ -106,8 +118,8 @@ class ApiClient(object): header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) + header_params = dict( + self.parameters_to_tuples(header_params, collection_formats)) # path parameters if path_params: @@ -118,8 +130,7 @@ class ApiClient(object): # specified safe chars, encode everything resource_path = resource_path.replace( '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) - ) + quote(str(v), safe=config.safe_chars_for_path_param)) # query parameters if query_params: @@ -146,8 +157,12 @@ class ApiClient(object): # perform request and return response response_data = self.request( - method, url, query_params=query_params, headers=header_params, - post_params=post_params, body=body, + method, + url, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, _preload_content=_preload_content, _request_timeout=_request_timeout) @@ -186,11 +201,12 @@ class ApiClient(object): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() @@ -202,12 +218,16 @@ class ApiClient(object): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.openapi_types) - if getattr(obj, attr) is not None} + obj_dict = { + obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None + } - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} + return { + key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict) + } def deserialize(self, response, response_type): """Deserializes response into an object. @@ -245,13 +265,16 @@ class ApiClient(object): if type(klass) == str: if klass.startswith('list['): sub_kls = re.match('list\[(.*)\]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] + return [ + self.__deserialize(sub_data, sub_kls) for sub_data in data + ] if klass.startswith('dict('): sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} + return { + k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data) + } # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -270,12 +293,22 @@ class ApiClient(object): else: return self.__deserialize_model(data, klass) - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, async_req=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None): + def call_api(self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + async_req=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -313,83 +346,91 @@ class ApiClient(object): then the method will return the response directly. """ if not async_req: - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout) + return self.__call_api( + resource_path, method, path_params, query_params, + header_params, body, post_params, files, response_type, + auth_settings, _return_http_data_only, collection_formats, + _preload_content, _request_timeout) else: - thread = self.pool.apply_async(self.__call_api, (resource_path, - method, path_params, query_params, - header_params, body, - post_params, files, - response_type, auth_settings, - _return_http_data_only, - collection_formats, - _preload_content, _request_timeout)) + thread = self.pool.apply_async( + self.__call_api, + (resource_path, method, path_params, query_params, + header_params, body, post_params, files, response_type, + auth_settings, _return_http_data_only, collection_formats, + _preload_content, _request_timeout)) return thread - def request(self, method, url, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, + def request(self, + method, + url, + query_params=None, + headers=None, + post_params=None, + body=None, + _preload_content=True, _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.GET( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "HEAD": - return self.rest_client.HEAD(url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.HEAD( + url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.OPTIONS( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "POST": - return self.rest_client.POST(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.POST( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PUT": - return self.rest_client.PUT(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PUT( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PATCH": - return self.rest_client.PATCH(url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PATCH( + url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "DELETE": - return self.rest_client.DELETE(url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.DELETE( + url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) else: - raise ValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." - ) + raise ValueError("http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`.") def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -401,7 +442,8 @@ class ApiClient(object): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 + for k, v in six.iteritems(params) if isinstance( + params, dict) else params: # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': @@ -415,8 +457,9 @@ class ApiClient(object): delimiter = '|' else: # csv is the default delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) + new_params.append((k, + delimiter.join( + str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -442,8 +485,8 @@ class ApiClient(object): with open(n, 'rb') as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') + mimetype = (mimetypes.guess_type(filename)[0] + or 'application/octet-stream') params.append( tuple([k, tuple([filename, filedata, mimetype])])) @@ -502,8 +545,7 @@ class ApiClient(object): querys.append((auth_setting['key'], auth_setting['value'])) else: raise ValueError( - 'Authentication token must be in `query` or `header`' - ) + 'Authentication token must be in `query` or `header`') def __deserialize_file(self, response): """Deserializes body to file @@ -565,8 +607,7 @@ class ApiClient(object): except ValueError: raise rest.ApiException( status=0, - reason="Failed to parse `{0}` as date object".format(string) - ) + reason="Failed to parse `{0}` as date object".format(string)) def __deserialize_datatime(self, string): """Deserializes string to datetime. @@ -585,10 +626,7 @@ class ApiClient(object): raise rest.ApiException( status=0, reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) - ) + "Failed to parse `{0}` as datetime object".format(string))) def __deserialize_model(self, data, klass): """Deserializes list or dict to model. @@ -605,9 +643,8 @@ class ApiClient(object): kwargs = {} if klass.openapi_types is not None: 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 (data is not None and klass.attribute_map[attr] in data + and isinstance(data, (list, dict))): value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index c6816043455..17fb9a663a4 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import copy @@ -194,9 +192,10 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): :param identifier: The identifier of apiKey. :return: The token for api key authentication. """ - if (self.api_key.get(identifier) and - self.api_key_prefix.get(identifier)): - return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 + if (self.api_key.get(identifier) + and self.api_key_prefix.get(identifier)): + return self.api_key_prefix[identifier] + ' ' + self.api_key[ + identifier] # noqa: E501 elif self.api_key.get(identifier): return self.api_key[identifier] @@ -205,9 +204,8 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): :return: The token for basic HTTP authentication. """ - return urllib3.util.make_headers( - basic_auth=self.username + ':' + self.password - ).get('authorization') + return urllib3.util.make_headers(basic_auth=self.username + ':' + + self.password).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. @@ -215,36 +213,30 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): :return: The Auth Settings information dict. """ return { - 'api_key': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'api_key', - 'value': self.get_api_key_with_prefix('api_key') - }, - 'api_key_query': - { - 'type': 'api_key', - 'in': 'query', - 'key': 'api_key_query', - 'value': self.get_api_key_with_prefix('api_key_query') - }, - 'http_basic_test': - { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - }, - - 'petstore_auth': - { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - }, - + 'api_key': { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix('api_key') + }, + 'api_key_query': { + 'type': 'api_key', + 'in': 'query', + 'key': 'api_key_query', + 'value': self.get_api_key_with_prefix('api_key_query') + }, + 'http_basic_test': { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + }, + 'petstore_auth': { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, } def to_debug_report(self): diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index 2450cb334f7..119bf4bbc8c 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -10,7 +10,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import # import models into model package diff --git a/samples/client/petstore/python/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/additional_properties_class.py index dc4648ae1c7..6928820ef27 100644 --- a/samples/client/petstore/python/petstore_api/models/additional_properties_class.py +++ b/samples/client/petstore/python/petstore_api/models/additional_properties_class.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class AdditionalPropertiesClass(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -40,7 +37,8 @@ class AdditionalPropertiesClass(object): 'map_of_map_property': 'map_of_map_property' } - def __init__(self, map_property=None, map_of_map_property=None): # noqa: E501 + def __init__(self, map_property=None, + map_of_map_property=None): # noqa: E501 """AdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501 self._map_property = None @@ -101,10 +99,9 @@ class AdditionalPropertiesClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/animal.py b/samples/client/petstore/python/petstore_api/models/animal.py index 5acccf50f7a..78324c64916 100644 --- a/samples/client/petstore/python/petstore_api/models/animal.py +++ b/samples/client/petstore/python/petstore_api/models/animal.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Animal(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,20 +27,11 @@ class Animal(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'class_name': 'str', - 'color': 'str' - } + openapi_types = {'class_name': 'str', 'color': 'str'} - attribute_map = { - 'class_name': 'className', - 'color': 'color' - } + attribute_map = {'class_name': 'className', 'color': 'color'} - discriminator_value_class_map = { - 'Dog': 'Dog', - 'Cat': 'Cat' - } + discriminator_value_class_map = {'Dog': 'Dog', 'Cat': 'Cat'} def __init__(self, class_name=None, color='red'): # noqa: E501 """Animal - a model defined in OpenAPI""" # noqa: E501 @@ -75,7 +63,9 @@ class Animal(object): :type: str """ if class_name is None: - raise ValueError("Invalid value for `class_name`, must not be `None`") # noqa: E501 + raise ValueError( + "Invalid value for `class_name`, must not be `None`" + ) # noqa: E501 self._class_name = class_name @@ -112,10 +102,9 @@ class Animal(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/animal_farm.py b/samples/client/petstore/python/petstore_api/models/animal_farm.py index 4894e5530a3..ae9397ca2c2 100644 --- a/samples/client/petstore/python/petstore_api/models/animal_farm.py +++ b/samples/client/petstore/python/petstore_api/models/animal_farm.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class AnimalFarm(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,11 +27,9 @@ class AnimalFarm(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - } + openapi_types = {} - attribute_map = { - } + attribute_map = {} def __init__(self): # noqa: E501 """AnimalFarm - a model defined in OpenAPI""" # noqa: E501 @@ -47,10 +42,9 @@ class AnimalFarm(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/api_response.py b/samples/client/petstore/python/petstore_api/models/api_response.py index e6298303049..6208d24b15b 100644 --- a/samples/client/petstore/python/petstore_api/models/api_response.py +++ b/samples/client/petstore/python/petstore_api/models/api_response.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class ApiResponse(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,17 +27,9 @@ class ApiResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'code': 'int', - 'type': 'str', - 'message': 'str' - } - - attribute_map = { - 'code': 'code', - 'type': 'type', - 'message': 'message' - } + openapi_types = {'code': 'int', 'type': 'str', 'message': 'str'} + + attribute_map = {'code': 'code', 'type': 'type', 'message': 'message'} def __init__(self, code=None, type=None, message=None): # noqa: E501 """ApiResponse - a model defined in OpenAPI""" # noqa: E501 @@ -127,10 +116,9 @@ class ApiResponse(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py index fde218a4661..45ec0074811 100644 --- a/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class ArrayOfArrayOfNumberOnly(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class ArrayOfArrayOfNumberOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'array_array_number': 'list[list[float]]' - } + openapi_types = {'array_array_number': 'list[list[float]]'} - attribute_map = { - 'array_array_number': 'ArrayArrayNumber' - } + attribute_map = {'array_array_number': 'ArrayArrayNumber'} def __init__(self, array_array_number=None): # noqa: E501 """ArrayOfArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class ArrayOfArrayOfNumberOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python/petstore_api/models/array_of_number_only.py index 8999e563c4a..8062023a37b 100644 --- a/samples/client/petstore/python/petstore_api/models/array_of_number_only.py +++ b/samples/client/petstore/python/petstore_api/models/array_of_number_only.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class ArrayOfNumberOnly(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class ArrayOfNumberOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'array_number': 'list[float]' - } + openapi_types = {'array_number': 'list[float]'} - attribute_map = { - 'array_number': 'ArrayNumber' - } + attribute_map = {'array_number': 'ArrayNumber'} def __init__(self, array_number=None): # noqa: E501 """ArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class ArrayOfNumberOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/array_test.py b/samples/client/petstore/python/petstore_api/models/array_test.py index 05cc108139a..0fb3848087e 100644 --- a/samples/client/petstore/python/petstore_api/models/array_test.py +++ b/samples/client/petstore/python/petstore_api/models/array_test.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class ArrayTest(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -42,7 +39,10 @@ class ArrayTest(object): 'array_array_of_model': 'array_array_of_model' } - def __init__(self, array_of_string=None, array_array_of_integer=None, array_array_of_model=None): # noqa: E501 + def __init__(self, + array_of_string=None, + array_array_of_integer=None, + array_array_of_model=None): # noqa: E501 """ArrayTest - a model defined in OpenAPI""" # noqa: E501 self._array_of_string = None @@ -127,10 +127,9 @@ class ArrayTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/capitalization.py b/samples/client/petstore/python/petstore_api/models/capitalization.py index 923f5c4aae8..d6b88188619 100644 --- a/samples/client/petstore/python/petstore_api/models/capitalization.py +++ b/samples/client/petstore/python/petstore_api/models/capitalization.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Capitalization(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -48,7 +45,13 @@ class Capitalization(object): 'att_name': 'ATT_NAME' } - def __init__(self, small_camel=None, capital_camel=None, small_snake=None, capital_snake=None, sca_eth_flow_points=None, att_name=None): # noqa: E501 + def __init__(self, + small_camel=None, + capital_camel=None, + small_snake=None, + capital_snake=None, + sca_eth_flow_points=None, + att_name=None): # noqa: E501 """Capitalization - a model defined in OpenAPI""" # noqa: E501 self._small_camel = None @@ -207,10 +210,9 @@ class Capitalization(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/cat.py b/samples/client/petstore/python/petstore_api/models/cat.py index c5c87a6b111..d1e7b3095b0 100644 --- a/samples/client/petstore/python/petstore_api/models/cat.py +++ b/samples/client/petstore/python/petstore_api/models/cat.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Cat(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class Cat(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'declawed': 'bool' - } + openapi_types = {'declawed': 'bool'} - attribute_map = { - 'declawed': 'declawed' - } + attribute_map = {'declawed': 'declawed'} def __init__(self, declawed=None): # noqa: E501 """Cat - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class Cat(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/category.py b/samples/client/petstore/python/petstore_api/models/category.py index 9fbd44a7b34..ae61bbb2f43 100644 --- a/samples/client/petstore/python/petstore_api/models/category.py +++ b/samples/client/petstore/python/petstore_api/models/category.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Category(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,15 +27,9 @@ class Category(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'int', - 'name': 'str' - } + openapi_types = {'id': 'int', 'name': 'str'} - attribute_map = { - 'id': 'id', - 'name': 'name' - } + attribute_map = {'id': 'id', 'name': 'name'} def __init__(self, id=None, name=None): # noqa: E501 """Category - a model defined in OpenAPI""" # noqa: E501 @@ -101,10 +92,9 @@ class Category(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/class_model.py b/samples/client/petstore/python/petstore_api/models/class_model.py index e207ba41ec9..3fdbfba95f5 100644 --- a/samples/client/petstore/python/petstore_api/models/class_model.py +++ b/samples/client/petstore/python/petstore_api/models/class_model.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class ClassModel(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class ClassModel(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - '_class': 'str' - } + openapi_types = {'_class': 'str'} - attribute_map = { - '_class': '_class' - } + attribute_map = {'_class': '_class'} def __init__(self, _class=None): # noqa: E501 """ClassModel - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class ClassModel(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/client.py b/samples/client/petstore/python/petstore_api/models/client.py index e742468e776..756619d0976 100644 --- a/samples/client/petstore/python/petstore_api/models/client.py +++ b/samples/client/petstore/python/petstore_api/models/client.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Client(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class Client(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'client': 'str' - } + openapi_types = {'client': 'str'} - attribute_map = { - 'client': 'client' - } + attribute_map = {'client': 'client'} def __init__(self, client=None): # noqa: E501 """Client - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class Client(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/dog.py b/samples/client/petstore/python/petstore_api/models/dog.py index c2bc8f745d1..c6379d89ac8 100644 --- a/samples/client/petstore/python/petstore_api/models/dog.py +++ b/samples/client/petstore/python/petstore_api/models/dog.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Dog(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class Dog(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'breed': 'str' - } + openapi_types = {'breed': 'str'} - attribute_map = { - 'breed': 'breed' - } + attribute_map = {'breed': 'breed'} def __init__(self, breed=None): # noqa: E501 """Dog - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class Dog(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/enum_arrays.py b/samples/client/petstore/python/petstore_api/models/enum_arrays.py index df4363c356c..f8db82dd6d0 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_arrays.py +++ b/samples/client/petstore/python/petstore_api/models/enum_arrays.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class EnumArrays(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,15 +27,9 @@ class EnumArrays(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'just_symbol': 'str', - 'array_enum': 'list[str]' - } + openapi_types = {'just_symbol': 'str', 'array_enum': 'list[str]'} - attribute_map = { - 'just_symbol': 'just_symbol', - 'array_enum': 'array_enum' - } + attribute_map = {'just_symbol': 'just_symbol', 'array_enum': 'array_enum'} def __init__(self, just_symbol=None, array_enum=None): # noqa: E501 """EnumArrays - a model defined in OpenAPI""" # noqa: E501 @@ -74,8 +65,7 @@ class EnumArrays(object): if just_symbol not in allowed_values: raise ValueError( "Invalid value for `just_symbol` ({0}), must be one of {1}" # noqa: E501 - .format(just_symbol, allowed_values) - ) + .format(just_symbol, allowed_values)) self._just_symbol = just_symbol @@ -101,9 +91,11 @@ class EnumArrays(object): if not set(array_enum).issubset(set(allowed_values)): raise ValueError( "Invalid values for `array_enum` [{0}], must be a subset of [{1}]" # noqa: E501 - .format(", ".join(map(str, set(array_enum) - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values))) - ) + .format( + ", ".join(map( + str, + set(array_enum) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values)))) self._array_enum = array_enum @@ -114,10 +106,9 @@ class EnumArrays(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/enum_class.py b/samples/client/petstore/python/petstore_api/models/enum_class.py index 182197d8aa6..7e7e40302a2 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_class.py +++ b/samples/client/petstore/python/petstore_api/models/enum_class.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,14 +20,12 @@ class EnumClass(object): Do not edit the class manually. """ - """ allowed enum values """ _ABC = "_abc" _EFG = "-efg" _XYZ_ = "(xyz)" - """ Attributes: openapi_types (dict): The key is attribute name @@ -37,11 +33,9 @@ class EnumClass(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - } + openapi_types = {} - attribute_map = { - } + attribute_map = {} def __init__(self): # noqa: E501 """EnumClass - a model defined in OpenAPI""" # noqa: E501 @@ -54,10 +48,9 @@ class EnumClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/enum_test.py b/samples/client/petstore/python/petstore_api/models/enum_test.py index 0fd60c4a351..4789af781b8 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python/petstore_api/models/enum_test.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class EnumTest(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -46,7 +43,12 @@ class EnumTest(object): 'outer_enum': 'outerEnum' } - def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 + def __init__(self, + enum_string=None, + enum_string_required=None, + enum_integer=None, + enum_number=None, + outer_enum=None): # noqa: E501 """EnumTest - a model defined in OpenAPI""" # noqa: E501 self._enum_string = None @@ -88,8 +90,7 @@ class EnumTest(object): if enum_string not in allowed_values: raise ValueError( "Invalid value for `enum_string` ({0}), must be one of {1}" # noqa: E501 - .format(enum_string, allowed_values) - ) + .format(enum_string, allowed_values)) self._enum_string = enum_string @@ -112,13 +113,14 @@ class EnumTest(object): :type: str """ if enum_string_required is None: - raise ValueError("Invalid value for `enum_string_required`, must not be `None`") # noqa: E501 + raise ValueError( + "Invalid value for `enum_string_required`, must not be `None`" + ) # noqa: E501 allowed_values = ["UPPER", "lower", ""] # noqa: E501 if enum_string_required not in allowed_values: raise ValueError( "Invalid value for `enum_string_required` ({0}), must be one of {1}" # noqa: E501 - .format(enum_string_required, allowed_values) - ) + .format(enum_string_required, allowed_values)) self._enum_string_required = enum_string_required @@ -144,8 +146,7 @@ class EnumTest(object): if enum_integer not in allowed_values: raise ValueError( "Invalid value for `enum_integer` ({0}), must be one of {1}" # noqa: E501 - .format(enum_integer, allowed_values) - ) + .format(enum_integer, allowed_values)) self._enum_integer = enum_integer @@ -171,8 +172,7 @@ class EnumTest(object): if enum_number not in allowed_values: raise ValueError( "Invalid value for `enum_number` ({0}), must be one of {1}" # noqa: E501 - .format(enum_number, allowed_values) - ) + .format(enum_number, allowed_values)) self._enum_number = enum_number @@ -204,10 +204,9 @@ class EnumTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/file.py b/samples/client/petstore/python/petstore_api/models/file.py index 34d77c3b4cf..1172eea1381 100644 --- a/samples/client/petstore/python/petstore_api/models/file.py +++ b/samples/client/petstore/python/petstore_api/models/file.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class File(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class File(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'source_uri': 'str' - } + openapi_types = {'source_uri': 'str'} - attribute_map = { - 'source_uri': 'sourceURI' - } + attribute_map = {'source_uri': 'sourceURI'} def __init__(self, source_uri=None): # noqa: E501 """File - a model defined in OpenAPI""" # noqa: E501 @@ -77,10 +70,9 @@ class File(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py index 026822dee74..57079748cd6 100644 --- a/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py +++ b/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class FileSchemaTestClass(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,15 +27,9 @@ class FileSchemaTestClass(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'file': 'File', - 'files': 'list[File]' - } + openapi_types = {'file': 'File', 'files': 'list[File]'} - attribute_map = { - 'file': 'file', - 'files': 'files' - } + attribute_map = {'file': 'file', 'files': 'files'} def __init__(self, file=None, files=None): # noqa: E501 """FileSchemaTestClass - a model defined in OpenAPI""" # noqa: E501 @@ -101,10 +92,9 @@ class FileSchemaTestClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/format_test.py b/samples/client/petstore/python/petstore_api/models/format_test.py index 68c8953ee19..0b25c4b271b 100644 --- a/samples/client/petstore/python/petstore_api/models/format_test.py +++ b/samples/client/petstore/python/petstore_api/models/format_test.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class FormatTest(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -62,7 +59,20 @@ class FormatTest(object): 'password': 'password' } - def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None): # noqa: E501 + def __init__(self, + integer=None, + int32=None, + int64=None, + number=None, + float=None, + double=None, + string=None, + byte=None, + binary=None, + date=None, + date_time=None, + uuid=None, + password=None): # noqa: E501 """FormatTest - a model defined in OpenAPI""" # noqa: E501 self._integer = None @@ -122,9 +132,13 @@ class FormatTest(object): :type: int """ if integer is not None and integer > 100: # noqa: E501 - raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100`") # noqa: E501 + raise ValueError( + "Invalid value for `integer`, must be a value less than or equal to `100`" + ) # noqa: E501 if integer is not None and integer < 10: # noqa: E501 - raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10`") # noqa: E501 + raise ValueError( + "Invalid value for `integer`, must be a value greater than or equal to `10`" + ) # noqa: E501 self._integer = integer @@ -147,9 +161,13 @@ class FormatTest(object): :type: int """ if int32 is not None and int32 > 200: # noqa: E501 - raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200`") # noqa: E501 + raise ValueError( + "Invalid value for `int32`, must be a value less than or equal to `200`" + ) # noqa: E501 if int32 is not None and int32 < 20: # noqa: E501 - raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20`") # noqa: E501 + raise ValueError( + "Invalid value for `int32`, must be a value greater than or equal to `20`" + ) # noqa: E501 self._int32 = int32 @@ -193,11 +211,16 @@ class FormatTest(object): :type: float """ if number is None: - raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501 + raise ValueError( + "Invalid value for `number`, must not be `None`") # noqa: E501 if number is not None and number > 543.2: # noqa: E501 - raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") # noqa: E501 + raise ValueError( + "Invalid value for `number`, must be a value less than or equal to `543.2`" + ) # noqa: E501 if number is not None and number < 32.1: # noqa: E501 - raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") # noqa: E501 + raise ValueError( + "Invalid value for `number`, must be a value greater than or equal to `32.1`" + ) # noqa: E501 self._number = number @@ -220,9 +243,13 @@ class FormatTest(object): :type: float """ if float is not None and float > 987.6: # noqa: E501 - raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") # noqa: E501 + raise ValueError( + "Invalid value for `float`, must be a value less than or equal to `987.6`" + ) # noqa: E501 if float is not None and float < 54.3: # noqa: E501 - raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") # noqa: E501 + raise ValueError( + "Invalid value for `float`, must be a value greater than or equal to `54.3`" + ) # noqa: E501 self._float = float @@ -245,9 +272,13 @@ class FormatTest(object): :type: float """ if double is not None and double > 123.4: # noqa: E501 - raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") # noqa: E501 + raise ValueError( + "Invalid value for `double`, must be a value less than or equal to `123.4`" + ) # noqa: E501 if double is not None and double < 67.8: # noqa: E501 - raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") # noqa: E501 + raise ValueError( + "Invalid value for `double`, must be a value greater than or equal to `67.8`" + ) # noqa: E501 self._double = double @@ -269,8 +300,11 @@ class FormatTest(object): :param string: The string of this FormatTest. # noqa: E501 :type: str """ - if string is not None and not re.search('[a-z]', string, flags=re.IGNORECASE): # noqa: E501 - raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") # noqa: E501 + if string is not None and not re.search( + '[a-z]', string, flags=re.IGNORECASE): # noqa: E501 + raise ValueError( + "Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`" + ) # noqa: E501 self._string = string @@ -293,9 +327,14 @@ class FormatTest(object): :type: str """ if byte is None: - raise ValueError("Invalid value for `byte`, must not be `None`") # noqa: E501 - if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): # noqa: E501 - raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501 + raise ValueError( + "Invalid value for `byte`, must not be `None`") # noqa: E501 + if byte is not None and not re.search( + '^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', + byte): # noqa: E501 + raise ValueError( + "Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`" + ) # noqa: E501 self._byte = byte @@ -339,7 +378,8 @@ class FormatTest(object): :type: date """ if date is None: - raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501 + raise ValueError( + "Invalid value for `date`, must not be `None`") # noqa: E501 self._date = date @@ -404,11 +444,16 @@ class FormatTest(object): :type: str """ if password is None: - raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 + raise ValueError("Invalid value for `password`, must not be `None`" + ) # noqa: E501 if password is not None and len(password) > 64: - raise ValueError("Invalid value for `password`, length must be less than or equal to `64`") # noqa: E501 + raise ValueError( + "Invalid value for `password`, length must be less than or equal to `64`" + ) # noqa: E501 if password is not None and len(password) < 10: - raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") # noqa: E501 + raise ValueError( + "Invalid value for `password`, length must be greater than or equal to `10`" + ) # noqa: E501 self._password = password @@ -419,10 +464,9 @@ class FormatTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python/petstore_api/models/has_only_read_only.py index 41db3ff7195..5ce28ac0570 100644 --- a/samples/client/petstore/python/petstore_api/models/has_only_read_only.py +++ b/samples/client/petstore/python/petstore_api/models/has_only_read_only.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class HasOnlyReadOnly(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,15 +27,9 @@ class HasOnlyReadOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'bar': 'str', - 'foo': 'str' - } + openapi_types = {'bar': 'str', 'foo': 'str'} - attribute_map = { - 'bar': 'bar', - 'foo': 'foo' - } + attribute_map = {'bar': 'bar', 'foo': 'foo'} def __init__(self, bar=None, foo=None): # noqa: E501 """HasOnlyReadOnly - a model defined in OpenAPI""" # noqa: E501 @@ -101,10 +92,9 @@ class HasOnlyReadOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/list.py b/samples/client/petstore/python/petstore_api/models/list.py index 08e12ad5310..9757c960b4a 100644 --- a/samples/client/petstore/python/petstore_api/models/list.py +++ b/samples/client/petstore/python/petstore_api/models/list.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class List(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class List(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - '_123_list': 'str' - } + openapi_types = {'_123_list': 'str'} - attribute_map = { - '_123_list': '123-list' - } + attribute_map = {'_123_list': '123-list'} def __init__(self, _123_list=None): # noqa: E501 """List - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class List(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/map_test.py b/samples/client/petstore/python/petstore_api/models/map_test.py index f2d1042556b..10295f5790e 100644 --- a/samples/client/petstore/python/petstore_api/models/map_test.py +++ b/samples/client/petstore/python/petstore_api/models/map_test.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class MapTest(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -34,7 +31,7 @@ class MapTest(object): 'map_map_of_string': 'dict(str, dict(str, str))', 'map_of_enum_string': 'dict(str, str)', 'direct_map': 'dict(str, bool)', - 'indirect_map': 'StringBooleanMap' + 'indirect_map': 'dict(str, bool)' } attribute_map = { @@ -44,7 +41,11 @@ class MapTest(object): 'indirect_map': 'indirect_map' } - def __init__(self, map_map_of_string=None, map_of_enum_string=None, direct_map=None, indirect_map=None): # noqa: E501 + def __init__(self, + map_map_of_string=None, + map_of_enum_string=None, + direct_map=None, + indirect_map=None): # noqa: E501 """MapTest - a model defined in OpenAPI""" # noqa: E501 self._map_map_of_string = None @@ -105,9 +106,13 @@ class MapTest(object): if not set(map_of_enum_string.keys()).issubset(set(allowed_values)): raise ValueError( "Invalid keys in `map_of_enum_string` [{0}], must be a subset of [{1}]" # noqa: E501 - .format(", ".join(map(str, set(map_of_enum_string.keys()) - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values))) - ) + .format( + ", ".join( + map( + str, + set(map_of_enum_string.keys()) - + set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values)))) self._map_of_enum_string = map_of_enum_string @@ -138,7 +143,7 @@ class MapTest(object): :return: The indirect_map of this MapTest. # noqa: E501 - :rtype: StringBooleanMap + :rtype: dict(str, bool) """ return self._indirect_map @@ -148,7 +153,7 @@ class MapTest(object): :param indirect_map: The indirect_map of this MapTest. # noqa: E501 - :type: StringBooleanMap + :type: dict(str, bool) """ self._indirect_map = indirect_map @@ -160,10 +165,9 @@ class MapTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py index ecf67acc5e9..ecc53b139d0 100644 --- a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -36,11 +33,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): 'map': 'dict(str, Animal)' } - attribute_map = { - 'uuid': 'uuid', - 'date_time': 'dateTime', - 'map': 'map' - } + attribute_map = {'uuid': 'uuid', 'date_time': 'dateTime', 'map': 'map'} def __init__(self, uuid=None, date_time=None, map=None): # noqa: E501 """MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501 @@ -127,10 +120,9 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/model200_response.py b/samples/client/petstore/python/petstore_api/models/model200_response.py index ec778cdcb74..bc4920e3cad 100644 --- a/samples/client/petstore/python/petstore_api/models/model200_response.py +++ b/samples/client/petstore/python/petstore_api/models/model200_response.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Model200Response(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,15 +27,9 @@ class Model200Response(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'name': 'int', - '_class': 'str' - } + openapi_types = {'name': 'int', '_class': 'str'} - attribute_map = { - 'name': 'name', - '_class': 'class' - } + attribute_map = {'name': 'name', '_class': 'class'} def __init__(self, name=None, _class=None): # noqa: E501 """Model200Response - a model defined in OpenAPI""" # noqa: E501 @@ -101,10 +92,9 @@ class Model200Response(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/model_return.py b/samples/client/petstore/python/petstore_api/models/model_return.py index 3862245ef71..d54b3f5775f 100644 --- a/samples/client/petstore/python/petstore_api/models/model_return.py +++ b/samples/client/petstore/python/petstore_api/models/model_return.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class ModelReturn(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class ModelReturn(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - '_return': 'int' - } + openapi_types = {'_return': 'int'} - attribute_map = { - '_return': 'return' - } + attribute_map = {'_return': 'return'} def __init__(self, _return=None): # noqa: E501 """ModelReturn - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class ModelReturn(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/name.py b/samples/client/petstore/python/petstore_api/models/name.py index b2e97e596a4..e99ccefa613 100644 --- a/samples/client/petstore/python/petstore_api/models/name.py +++ b/samples/client/petstore/python/petstore_api/models/name.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Name(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -44,7 +41,11 @@ class Name(object): '_123_number': '123Number' } - def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): # noqa: E501 + def __init__(self, + name=None, + snake_case=None, + _property=None, + _123_number=None): # noqa: E501 """Name - a model defined in OpenAPI""" # noqa: E501 self._name = None @@ -80,7 +81,8 @@ class Name(object): :type: int """ if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + raise ValueError( + "Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -154,10 +156,9 @@ class Name(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/number_only.py b/samples/client/petstore/python/petstore_api/models/number_only.py index ab39ee8195d..8144dceca0e 100644 --- a/samples/client/petstore/python/petstore_api/models/number_only.py +++ b/samples/client/petstore/python/petstore_api/models/number_only.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class NumberOnly(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class NumberOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'just_number': 'float' - } + openapi_types = {'just_number': 'float'} - attribute_map = { - 'just_number': 'JustNumber' - } + attribute_map = {'just_number': 'JustNumber'} def __init__(self, just_number=None): # noqa: E501 """NumberOnly - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class NumberOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/order.py b/samples/client/petstore/python/petstore_api/models/order.py index 697d84447cd..6aaed05966f 100644 --- a/samples/client/petstore/python/petstore_api/models/order.py +++ b/samples/client/petstore/python/petstore_api/models/order.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Order(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -48,7 +45,13 @@ class Order(object): 'complete': 'complete' } - def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501 + def __init__(self, + id=None, + pet_id=None, + quantity=None, + ship_date=None, + status=None, + complete=False): # noqa: E501 """Order - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -180,8 +183,7 @@ class Order(object): if status not in allowed_values: raise ValueError( "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 - .format(status, allowed_values) - ) + .format(status, allowed_values)) self._status = status @@ -213,10 +215,9 @@ class Order(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/outer_composite.py b/samples/client/petstore/python/petstore_api/models/outer_composite.py index b22b16c6fdc..03246b6af73 100644 --- a/samples/client/petstore/python/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python/petstore_api/models/outer_composite.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class OuterComposite(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -42,7 +39,8 @@ class OuterComposite(object): 'my_boolean': 'my_boolean' } - def __init__(self, my_number=None, my_string=None, my_boolean=None): # noqa: E501 + def __init__(self, my_number=None, my_string=None, + my_boolean=None): # noqa: E501 """OuterComposite - a model defined in OpenAPI""" # noqa: E501 self._my_number = None @@ -127,10 +125,9 @@ class OuterComposite(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/outer_enum.py b/samples/client/petstore/python/petstore_api/models/outer_enum.py index 10d6be19a4c..3d64982b023 100644 --- a/samples/client/petstore/python/petstore_api/models/outer_enum.py +++ b/samples/client/petstore/python/petstore_api/models/outer_enum.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,14 +20,12 @@ class OuterEnum(object): Do not edit the class manually. """ - """ allowed enum values """ PLACED = "placed" APPROVED = "approved" DELIVERED = "delivered" - """ Attributes: openapi_types (dict): The key is attribute name @@ -37,11 +33,9 @@ class OuterEnum(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - } + openapi_types = {} - attribute_map = { - } + attribute_map = {} def __init__(self): # noqa: E501 """OuterEnum - a model defined in OpenAPI""" # noqa: E501 @@ -54,10 +48,9 @@ class OuterEnum(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/pet.py b/samples/client/petstore/python/petstore_api/models/pet.py index d3c412f4a82..fc530e7d78c 100644 --- a/samples/client/petstore/python/petstore_api/models/pet.py +++ b/samples/client/petstore/python/petstore_api/models/pet.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Pet(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -48,7 +45,13 @@ class Pet(object): 'status': 'status' } - def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501 + def __init__(self, + id=None, + category=None, + name=None, + photo_urls=None, + tags=None, + status=None): # noqa: E501 """Pet - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -131,7 +134,8 @@ class Pet(object): :type: str """ if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 + raise ValueError( + "Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -154,7 +158,9 @@ class Pet(object): :type: list[str] """ if photo_urls is None: - raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501 + raise ValueError( + "Invalid value for `photo_urls`, must not be `None`" + ) # noqa: E501 self._photo_urls = photo_urls @@ -203,8 +209,7 @@ class Pet(object): if status not in allowed_values: raise ValueError( "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 - .format(status, allowed_values) - ) + .format(status, allowed_values)) self._status = status @@ -215,10 +220,9 @@ class Pet(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/read_only_first.py b/samples/client/petstore/python/petstore_api/models/read_only_first.py index 2b257be18de..513fdbb20eb 100644 --- a/samples/client/petstore/python/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python/petstore_api/models/read_only_first.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class ReadOnlyFirst(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,15 +27,9 @@ class ReadOnlyFirst(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'bar': 'str', - 'baz': 'str' - } + openapi_types = {'bar': 'str', 'baz': 'str'} - attribute_map = { - 'bar': 'bar', - 'baz': 'baz' - } + attribute_map = {'bar': 'bar', 'baz': 'baz'} def __init__(self, bar=None, baz=None): # noqa: E501 """ReadOnlyFirst - a model defined in OpenAPI""" # noqa: E501 @@ -101,10 +92,9 @@ class ReadOnlyFirst(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/special_model_name.py b/samples/client/petstore/python/petstore_api/models/special_model_name.py index fa59b887471..6f0cbb35edd 100644 --- a/samples/client/petstore/python/petstore_api/models/special_model_name.py +++ b/samples/client/petstore/python/petstore_api/models/special_model_name.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class SpecialModelName(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,13 +27,9 @@ class SpecialModelName(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'special_property_name': 'int' - } + openapi_types = {'special_property_name': 'int'} - attribute_map = { - 'special_property_name': '$special[property.name]' - } + attribute_map = {'special_property_name': '$special[property.name]'} def __init__(self, special_property_name=None): # noqa: E501 """SpecialModelName - a model defined in OpenAPI""" # noqa: E501 @@ -75,10 +68,9 @@ class SpecialModelName(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python/petstore_api/models/string_boolean_map.py index e837adf6195..83f46b35820 100644 --- a/samples/client/petstore/python/petstore_api/models/string_boolean_map.py +++ b/samples/client/petstore/python/petstore_api/models/string_boolean_map.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class StringBooleanMap(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,11 +27,9 @@ class StringBooleanMap(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - } + openapi_types = {} - attribute_map = { - } + attribute_map = {} def __init__(self): # noqa: E501 """StringBooleanMap - a model defined in OpenAPI""" # noqa: E501 @@ -47,10 +42,9 @@ class StringBooleanMap(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/tag.py b/samples/client/petstore/python/petstore_api/models/tag.py index 8fcc8a84866..fb343184f27 100644 --- a/samples/client/petstore/python/petstore_api/models/tag.py +++ b/samples/client/petstore/python/petstore_api/models/tag.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class Tag(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -30,15 +27,9 @@ class Tag(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = { - 'id': 'int', - 'name': 'str' - } + openapi_types = {'id': 'int', 'name': 'str'} - attribute_map = { - 'id': 'id', - 'name': 'name' - } + attribute_map = {'id': 'id', 'name': 'name'} def __init__(self, id=None, name=None): # noqa: E501 """Tag - a model defined in OpenAPI""" # noqa: E501 @@ -101,10 +92,9 @@ class Tag(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/user.py b/samples/client/petstore/python/petstore_api/models/user.py index 9736c47c1f8..95e8dff756a 100644 --- a/samples/client/petstore/python/petstore_api/models/user.py +++ b/samples/client/petstore/python/petstore_api/models/user.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - import pprint import re # noqa: F401 @@ -22,7 +20,6 @@ class User(object): Do not edit the class manually. """ - """ Attributes: openapi_types (dict): The key is attribute name @@ -52,7 +49,15 @@ class User(object): 'user_status': 'userStatus' } - def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501 + def __init__(self, + id=None, + username=None, + first_name=None, + last_name=None, + email=None, + password=None, + phone=None, + user_status=None): # noqa: E501 """User - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -259,10 +264,9 @@ class User(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) + result[attr] = list( + map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value)) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index 30ba5fb8d3f..6922a7a3cc3 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from __future__ import absolute_import import io @@ -28,12 +26,10 @@ try: except ImportError: raise ImportError('OpenAPI Python client requires urllib3.') - logger = logging.getLogger(__name__) class RESTResponse(io.IOBase): - def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -50,7 +46,6 @@ class RESTResponse(io.IOBase): class RESTClientObject(object): - def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -73,7 +68,8 @@ class RESTClientObject(object): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 + addition_pool_args[ + 'assert_hostname'] = configuration.assert_hostname # noqa: E501 if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -91,8 +87,7 @@ class RESTClientObject(object): cert_file=configuration.cert_file, key_file=configuration.key_file, proxy_url=configuration.proxy, - **addition_pool_args - ) + **addition_pool_args) else: self.pool_manager = urllib3.PoolManager( num_pools=pools_size, @@ -101,11 +96,16 @@ class RESTClientObject(object): ca_certs=ca_certs, cert_file=configuration.cert_file, key_file=configuration.key_file, - **addition_pool_args - ) - - def request(self, method, url, query_params=None, headers=None, - body=None, post_params=None, _preload_content=True, + **addition_pool_args) + + def request(self, + method, + url, + query_params=None, + headers=None, + body=None, + post_params=None, + _preload_content=True, _request_timeout=None): """Perform requests. @@ -126,23 +126,24 @@ class RESTClientObject(object): (connection, read) timeouts. """ method = method.upper() - assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', - 'PATCH', 'OPTIONS'] + assert method in [ + 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' + ] if post_params and body: raise ValueError( - "body parameter cannot be used with post_params parameter." - ) + "body parameter cannot be used with post_params parameter.") post_params = post_params or {} headers = headers or {} timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 + if isinstance(_request_timeout, (int, ) if six.PY3 else + (int, long)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) and - len(_request_timeout) == 2): + elif (isinstance(_request_timeout, tuple) + and len(_request_timeout) == 2): timeout = urllib3.Timeout( connect=_request_timeout[0], read=_request_timeout[1]) @@ -159,14 +160,17 @@ class RESTClientObject(object): if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, headers=headers) - elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + elif headers[ + 'Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=False, preload_content=_preload_content, @@ -178,7 +182,8 @@ class RESTClientObject(object): # overwritten. del headers['Content-Type'] r = self.pool_manager.request( - method, url, + method, + url, fields=post_params, encode_multipart=True, preload_content=_preload_content, @@ -190,7 +195,8 @@ class RESTClientObject(object): elif isinstance(body, str): request_body = body r = self.pool_manager.request( - method, url, + method, + url, body=request_body, preload_content=_preload_content, timeout=timeout, @@ -203,11 +209,13 @@ class RESTClientObject(object): raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request(method, url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers) + r = self.pool_manager.request( + method, + url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -228,74 +236,124 @@ class RESTClientObject(object): return r - def GET(self, url, headers=None, query_params=None, _preload_content=True, + def GET(self, + url, + headers=None, + query_params=None, + _preload_content=True, _request_timeout=None): - return self.request("GET", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def HEAD(self, url, headers=None, query_params=None, _preload_content=True, + return self.request( + "GET", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, + url, + headers=None, + query_params=None, + _preload_content=True, + _request_timeout=None): + return self.request( + "HEAD", + url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None): + return self.request( + "OPTIONS", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, + url, + headers=None, + query_params=None, + body=None, + _preload_content=True, + _request_timeout=None): + return self.request( + "DELETE", + url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, _request_timeout=None): - return self.request("HEAD", url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def OPTIONS(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("OPTIONS", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def DELETE(self, url, headers=None, query_params=None, body=None, - _preload_content=True, _request_timeout=None): - return self.request("DELETE", url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def POST(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("POST", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PUT(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PUT", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PATCH(self, url, headers=None, query_params=None, post_params=None, - body=None, _preload_content=True, _request_timeout=None): - return self.request("PATCH", url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.request( + "POST", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None): + return self.request( + "PUT", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, + url, + headers=None, + query_params=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None): + return self.request( + "PATCH", + url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) class ApiException(Exception): - def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status diff --git a/samples/client/petstore/python/setup.py b/samples/client/petstore/python/setup.py index 3cfa069e204..0d534f6768d 100644 --- a/samples/client/petstore/python/setup.py +++ b/samples/client/petstore/python/setup.py @@ -1,5 +1,4 @@ # coding: utf-8 - """ OpenAPI Petstore @@ -9,7 +8,6 @@ Generated by: https://openapi-generator.tech """ - from setuptools import setup, find_packages # noqa: H301 NAME = "petstore-api" @@ -35,5 +33,4 @@ setup( include_package_data=True, long_description="""\ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - """ -) + """) -- GitLab From b4f0f48f5e5c34402d0132a439439704c11b8bb6 Mon Sep 17 00:00:00 2001 From: William Cheng <wing328hk@gmail.com> Date: Fri, 21 Sep 2018 12:55:47 +0800 Subject: [PATCH 3/3] revert sample change --- .../petstore/python/petstore_api/__init__.py | 2 + .../petstore_api/api/another_fake_api.py | 36 +- .../python/petstore_api/api/fake_api.py | 549 +++++++----------- .../api/fake_classname_tags_123_api.py | 33 +- .../python/petstore_api/api/pet_api.py | 296 ++++------ .../python/petstore_api/api/store_api.py | 114 ++-- .../python/petstore_api/api/user_api.py | 236 ++++---- .../python/petstore_api/api_client.py | 261 ++++----- .../python/petstore_api/configuration.py | 68 ++- .../python/petstore_api/models/__init__.py | 1 + .../models/additional_properties_class.py | 13 +- .../python/petstore_api/models/animal.py | 29 +- .../python/petstore_api/models/animal_farm.py | 16 +- .../petstore_api/models/api_response.py | 24 +- .../models/array_of_array_of_number_only.py | 18 +- .../models/array_of_number_only.py | 18 +- .../python/petstore_api/models/array_test.py | 15 +- .../petstore_api/models/capitalization.py | 18 +- .../python/petstore_api/models/cat.py | 18 +- .../python/petstore_api/models/category.py | 20 +- .../python/petstore_api/models/class_model.py | 18 +- .../python/petstore_api/models/client.py | 18 +- .../python/petstore_api/models/dog.py | 18 +- .../python/petstore_api/models/enum_arrays.py | 31 +- .../python/petstore_api/models/enum_class.py | 17 +- .../python/petstore_api/models/enum_test.py | 33 +- .../python/petstore_api/models/file.py | 18 +- .../models/file_schema_test_class.py | 20 +- .../python/petstore_api/models/format_test.py | 100 +--- .../petstore_api/models/has_only_read_only.py | 20 +- .../python/petstore_api/models/list.py | 18 +- .../python/petstore_api/models/map_test.py | 26 +- ...perties_and_additional_properties_class.py | 16 +- .../petstore_api/models/model200_response.py | 20 +- .../petstore_api/models/model_return.py | 18 +- .../python/petstore_api/models/name.py | 19 +- .../python/petstore_api/models/number_only.py | 18 +- .../python/petstore_api/models/order.py | 21 +- .../petstore_api/models/outer_composite.py | 13 +- .../python/petstore_api/models/outer_enum.py | 17 +- .../python/petstore_api/models/pet.py | 28 +- .../petstore_api/models/read_only_first.py | 20 +- .../petstore_api/models/special_model_name.py | 18 +- .../petstore_api/models/string_boolean_map.py | 16 +- .../python/petstore_api/models/tag.py | 20 +- .../python/petstore_api/models/user.py | 20 +- .../petstore/python/petstore_api/rest.py | 244 +++----- samples/client/petstore/python/setup.py | 5 +- 48 files changed, 1224 insertions(+), 1411 deletions(-) diff --git a/samples/client/petstore/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index adc34f1e0f8..f54256a687c 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -1,6 +1,7 @@ # coding: utf-8 # flake8: noqa + """ OpenAPI Petstore @@ -10,6 +11,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import __version__ = "1.0.0" diff --git a/samples/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/client/petstore/python/petstore_api/api/another_fake_api.py index 889902ffd75..782f7fd07b3 100644 --- a/samples/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/another_fake_api.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import re # noqa: F401 @@ -47,15 +49,12 @@ class AnotherFakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.call_123_test_special_tags_with_http_info( - client, **kwargs) # noqa: E501 + return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 else: - (data) = self.call_123_test_special_tags_with_http_info( - client, **kwargs) # noqa: E501 + (data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 return data - def call_123_test_special_tags_with_http_info(self, client, - **kwargs): # noqa: E501 + def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 """To test special tags # noqa: E501 To test special tags and operation ID starting with number # noqa: E501 @@ -81,16 +80,16 @@ class AnotherFakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method call_123_test_special_tags" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method call_123_test_special_tags" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set - if ('client' not in local_var_params - or local_var_params['client'] is None): - raise ValueError( - "Missing the required parameter `client` when calling `call_123_test_special_tags`" - ) # noqa: E501 + if ('client' not in local_var_params or + local_var_params['client'] is None): + raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501 collection_formats = {} @@ -111,16 +110,14 @@ class AnotherFakeApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/another-fake/dummy', - 'PATCH', + '/another-fake/dummy', 'PATCH', path_params, query_params, header_params, @@ -130,8 +127,7 @@ class AnotherFakeApi(object): response_type='Client', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/fake_api.py b/samples/client/petstore/python/petstore_api/api/fake_api.py index 2ac02904c3c..00089d9a1e7 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_api.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import re # noqa: F401 @@ -47,15 +49,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_boolean_serialize_with_http_info( - **kwargs) # noqa: E501 + return self.fake_outer_boolean_serialize_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.fake_outer_boolean_serialize_with_http_info( - **kwargs) # noqa: E501 + (data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs) # noqa: E501 return data - def fake_outer_boolean_serialize_with_http_info(self, - **kwargs): # noqa: E501 + def fake_outer_boolean_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 Test serialization of outer boolean types # noqa: E501 @@ -83,7 +82,8 @@ class FakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method fake_outer_boolean_serialize" % key) + " to method fake_outer_boolean_serialize" % key + ) local_var_params[key] = val del local_var_params['kwargs'] @@ -109,8 +109,7 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/boolean', - 'POST', + '/fake/outer/boolean', 'POST', path_params, query_params, header_params, @@ -120,8 +119,7 @@ class FakeApi(object): response_type='bool', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -143,15 +141,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_composite_serialize_with_http_info( - **kwargs) # noqa: E501 + return self.fake_outer_composite_serialize_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.fake_outer_composite_serialize_with_http_info( - **kwargs) # noqa: E501 + (data) = self.fake_outer_composite_serialize_with_http_info(**kwargs) # noqa: E501 return data - def fake_outer_composite_serialize_with_http_info(self, - **kwargs): # noqa: E501 + def fake_outer_composite_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_composite_serialize # noqa: E501 Test serialization of object with outer number type # noqa: E501 @@ -179,7 +174,8 @@ class FakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method fake_outer_composite_serialize" % key) + " to method fake_outer_composite_serialize" % key + ) local_var_params[key] = val del local_var_params['kwargs'] @@ -205,8 +201,7 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/composite', - 'POST', + '/fake/outer/composite', 'POST', path_params, query_params, header_params, @@ -216,8 +211,7 @@ class FakeApi(object): response_type='OuterComposite', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -239,15 +233,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_number_serialize_with_http_info( - **kwargs) # noqa: E501 + return self.fake_outer_number_serialize_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.fake_outer_number_serialize_with_http_info( - **kwargs) # noqa: E501 + (data) = self.fake_outer_number_serialize_with_http_info(**kwargs) # noqa: E501 return data - def fake_outer_number_serialize_with_http_info(self, - **kwargs): # noqa: E501 + def fake_outer_number_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_number_serialize # noqa: E501 Test serialization of outer number types # noqa: E501 @@ -273,8 +264,10 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method fake_outer_number_serialize" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_number_serialize" % key + ) local_var_params[key] = val del local_var_params['kwargs'] @@ -300,8 +293,7 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/number', - 'POST', + '/fake/outer/number', 'POST', path_params, query_params, header_params, @@ -311,8 +303,7 @@ class FakeApi(object): response_type='float', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -334,15 +325,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.fake_outer_string_serialize_with_http_info( - **kwargs) # noqa: E501 + return self.fake_outer_string_serialize_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.fake_outer_string_serialize_with_http_info( - **kwargs) # noqa: E501 + (data) = self.fake_outer_string_serialize_with_http_info(**kwargs) # noqa: E501 return data - def fake_outer_string_serialize_with_http_info(self, - **kwargs): # noqa: E501 + def fake_outer_string_serialize_with_http_info(self, **kwargs): # noqa: E501 """fake_outer_string_serialize # noqa: E501 Test serialization of outer string types # noqa: E501 @@ -368,8 +356,10 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method fake_outer_string_serialize" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_string_serialize" % key + ) local_var_params[key] = val del local_var_params['kwargs'] @@ -395,8 +385,7 @@ class FakeApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/outer/string', - 'POST', + '/fake/outer/string', 'POST', path_params, query_params, header_params, @@ -406,14 +395,12 @@ class FakeApi(object): response_type='str', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def test_body_with_file_schema(self, file_schema_test_class, - **kwargs): # noqa: E501 + def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 For this test, the body for this request much reference a schema named `File`. # noqa: E501 @@ -430,15 +417,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_body_with_file_schema_with_http_info( - file_schema_test_class, **kwargs) # noqa: E501 + return self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 else: - (data) = self.test_body_with_file_schema_with_http_info( - file_schema_test_class, **kwargs) # noqa: E501 + (data) = self.test_body_with_file_schema_with_http_info(file_schema_test_class, **kwargs) # noqa: E501 return data - def test_body_with_file_schema_with_http_info(self, file_schema_test_class, - **kwargs): # noqa: E501 + def test_body_with_file_schema_with_http_info(self, file_schema_test_class, **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 For this test, the body for this request much reference a schema named `File`. # noqa: E501 @@ -464,16 +448,16 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method test_body_with_file_schema" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_file_schema" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'file_schema_test_class' is set - if ('file_schema_test_class' not in local_var_params - or local_var_params['file_schema_test_class'] is None): - raise ValueError( - "Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`" - ) # noqa: E501 + if ('file_schema_test_class' not in local_var_params or + local_var_params['file_schema_test_class'] is None): + raise ValueError("Missing the required parameter `file_schema_test_class` when calling `test_body_with_file_schema`") # noqa: E501 collection_formats = {} @@ -490,16 +474,14 @@ class FakeApi(object): if 'file_schema_test_class' in local_var_params: body_params = local_var_params['file_schema_test_class'] # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/body-with-file-schema', - 'PUT', + '/fake/body-with-file-schema', 'PUT', path_params, query_params, header_params, @@ -509,8 +491,7 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -532,15 +513,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_body_with_query_params_with_http_info( - query, user, **kwargs) # noqa: E501 + return self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 else: - (data) = self.test_body_with_query_params_with_http_info( - query, user, **kwargs) # noqa: E501 + (data) = self.test_body_with_query_params_with_http_info(query, user, **kwargs) # noqa: E501 return data - def test_body_with_query_params_with_http_info(self, query, user, - **kwargs): # noqa: E501 + def test_body_with_query_params_with_http_info(self, query, user, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -566,22 +544,20 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method test_body_with_query_params" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_body_with_query_params" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'query' is set - if ('query' not in local_var_params - or local_var_params['query'] is None): - raise ValueError( - "Missing the required parameter `query` when calling `test_body_with_query_params`" - ) # noqa: E501 + if ('query' not in local_var_params or + local_var_params['query'] is None): + raise ValueError("Missing the required parameter `query` when calling `test_body_with_query_params`") # noqa: E501 # verify the required parameter 'user' is set - if ('user' not in local_var_params - or local_var_params['user'] is None): - raise ValueError( - "Missing the required parameter `user` when calling `test_body_with_query_params`" - ) # noqa: E501 + if ('user' not in local_var_params or + local_var_params['user'] is None): + raise ValueError("Missing the required parameter `user` when calling `test_body_with_query_params`") # noqa: E501 collection_formats = {} @@ -589,8 +565,7 @@ class FakeApi(object): query_params = [] if 'query' in local_var_params: - query_params.append(('query', - local_var_params['query'])) # noqa: E501 + query_params.append(('query', local_var_params['query'])) # noqa: E501 header_params = {} @@ -601,16 +576,14 @@ class FakeApi(object): if 'user' in local_var_params: body_params = local_var_params['user'] # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/body-with-query-params', - 'PUT', + '/fake/body-with-query-params', 'PUT', path_params, query_params, header_params, @@ -620,8 +593,7 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -643,11 +615,9 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_client_model_with_http_info( - client, **kwargs) # noqa: E501 + return self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 else: - (data) = self.test_client_model_with_http_info( - client, **kwargs) # noqa: E501 + (data) = self.test_client_model_with_http_info(client, **kwargs) # noqa: E501 return data def test_client_model_with_http_info(self, client, **kwargs): # noqa: E501 @@ -676,16 +646,16 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method test_client_model" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_client_model" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set - if ('client' not in local_var_params - or local_var_params['client'] is None): - raise ValueError( - "Missing the required parameter `client` when calling `test_client_model`" - ) # noqa: E501 + if ('client' not in local_var_params or + local_var_params['client'] is None): + raise ValueError("Missing the required parameter `client` when calling `test_client_model`") # noqa: E501 collection_formats = {} @@ -706,16 +676,14 @@ class FakeApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake', - 'PATCH', + '/fake', 'PATCH', path_params, query_params, header_params, @@ -725,15 +693,12 @@ class FakeApi(object): response_type='Client', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def test_endpoint_parameters(self, number, double, - pattern_without_delimiter, byte, - **kwargs): # noqa: E501 + def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 @@ -763,18 +728,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_endpoint_parameters_with_http_info( - number, double, pattern_without_delimiter, byte, - **kwargs) # noqa: E501 + return self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) # noqa: E501 else: - (data) = self.test_endpoint_parameters_with_http_info( - number, double, pattern_without_delimiter, byte, - **kwargs) # noqa: E501 + (data) = self.test_endpoint_parameters_with_http_info(number, double, pattern_without_delimiter, byte, **kwargs) # noqa: E501 return data - def test_endpoint_parameters_with_http_info(self, number, double, - pattern_without_delimiter, - byte, **kwargs): # noqa: E501 + def test_endpoint_parameters_with_http_info(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 Fake endpoint for testing various parameters å‡ç«¯é»ž å½ã®ã‚¨ãƒ³ãƒ‰ãƒã‚¤ãƒ³ãƒˆ 가짜 엔드 í¬ì¸íЏ # noqa: E501 @@ -805,11 +764,7 @@ class FakeApi(object): local_var_params = locals() - all_params = [ - 'number', 'double', 'pattern_without_delimiter', 'byte', 'integer', - 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', - 'password', 'param_callback' - ] # noqa: E501 + all_params = ['number', 'double', 'pattern_without_delimiter', 'byte', 'integer', 'int32', 'int64', 'float', 'string', 'binary', 'date', 'date_time', 'password', 'param_callback'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -817,102 +772,57 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method test_endpoint_parameters" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_endpoint_parameters" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'number' is set - if ('number' not in local_var_params - or local_var_params['number'] is None): - raise ValueError( - "Missing the required parameter `number` when calling `test_endpoint_parameters`" - ) # noqa: E501 + if ('number' not in local_var_params or + local_var_params['number'] is None): + raise ValueError("Missing the required parameter `number` when calling `test_endpoint_parameters`") # noqa: E501 # verify the required parameter 'double' is set - if ('double' not in local_var_params - or local_var_params['double'] is None): - raise ValueError( - "Missing the required parameter `double` when calling `test_endpoint_parameters`" - ) # noqa: E501 + if ('double' not in local_var_params or + local_var_params['double'] is None): + raise ValueError("Missing the required parameter `double` when calling `test_endpoint_parameters`") # noqa: E501 # verify the required parameter 'pattern_without_delimiter' is set - if ('pattern_without_delimiter' not in local_var_params - or local_var_params['pattern_without_delimiter'] is None): - raise ValueError( - "Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`" - ) # noqa: E501 + if ('pattern_without_delimiter' not in local_var_params or + local_var_params['pattern_without_delimiter'] is None): + raise ValueError("Missing the required parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`") # noqa: E501 # verify the required parameter 'byte' is set - if ('byte' not in local_var_params - or local_var_params['byte'] is None): - raise ValueError( - "Missing the required parameter `byte` when calling `test_endpoint_parameters`" - ) # noqa: E501 - - if 'number' in local_var_params and local_var_params[ - 'number'] > 543.2: # noqa: E501 - raise ValueError( - "Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`" - ) # noqa: E501 - if 'number' in local_var_params and local_var_params[ - 'number'] < 32.1: # noqa: E501 - raise ValueError( - "Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`" - ) # noqa: E501 - if 'double' in local_var_params and local_var_params[ - 'double'] > 123.4: # noqa: E501 - raise ValueError( - "Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`" - ) # noqa: E501 - if 'double' in local_var_params and local_var_params[ - 'double'] < 67.8: # noqa: E501 - raise ValueError( - "Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`" - ) # noqa: E501 - if 'pattern_without_delimiter' in local_var_params and not re.search( - '^[A-Z].*', - local_var_params['pattern_without_delimiter']): # noqa: E501 - raise ValueError( - "Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`" - ) # noqa: E501 - if 'integer' in local_var_params and local_var_params[ - 'integer'] > 100: # noqa: E501 - raise ValueError( - "Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`" - ) # noqa: E501 - if 'integer' in local_var_params and local_var_params[ - 'integer'] < 10: # noqa: E501 - raise ValueError( - "Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`" - ) # noqa: E501 - if 'int32' in local_var_params and local_var_params[ - 'int32'] > 200: # noqa: E501 - raise ValueError( - "Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`" - ) # noqa: E501 - if 'int32' in local_var_params and local_var_params[ - 'int32'] < 20: # noqa: E501 - raise ValueError( - "Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`" - ) # noqa: E501 - if 'float' in local_var_params and local_var_params[ - 'float'] > 987.6: # noqa: E501 - raise ValueError( - "Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`" - ) # noqa: E501 - if 'string' in local_var_params and not re.search( - '[a-z]', local_var_params['string'], - flags=re.IGNORECASE): # noqa: E501 - raise ValueError( - "Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`" - ) # noqa: E501 - if ('password' in local_var_params - and len(local_var_params['password']) > 64): - raise ValueError( - "Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`" - ) # noqa: E501 - if ('password' in local_var_params - and len(local_var_params['password']) < 10): - raise ValueError( - "Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`" - ) # noqa: E501 + if ('byte' not in local_var_params or + local_var_params['byte'] is None): + raise ValueError("Missing the required parameter `byte` when calling `test_endpoint_parameters`") # noqa: E501 + + if 'number' in local_var_params and local_var_params['number'] > 543.2: # noqa: E501 + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value less than or equal to `543.2`") # noqa: E501 + if 'number' in local_var_params and local_var_params['number'] < 32.1: # noqa: E501 + raise ValueError("Invalid value for parameter `number` when calling `test_endpoint_parameters`, must be a value greater than or equal to `32.1`") # noqa: E501 + if 'double' in local_var_params and local_var_params['double'] > 123.4: # noqa: E501 + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value less than or equal to `123.4`") # noqa: E501 + if 'double' in local_var_params and local_var_params['double'] < 67.8: # noqa: E501 + raise ValueError("Invalid value for parameter `double` when calling `test_endpoint_parameters`, must be a value greater than or equal to `67.8`") # noqa: E501 + if 'pattern_without_delimiter' in local_var_params and not re.search('^[A-Z].*', local_var_params['pattern_without_delimiter']): # noqa: E501 + raise ValueError("Invalid value for parameter `pattern_without_delimiter` when calling `test_endpoint_parameters`, must conform to the pattern `/^[A-Z].*/`") # noqa: E501 + if 'integer' in local_var_params and local_var_params['integer'] > 100: # noqa: E501 + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value less than or equal to `100`") # noqa: E501 + if 'integer' in local_var_params and local_var_params['integer'] < 10: # noqa: E501 + raise ValueError("Invalid value for parameter `integer` when calling `test_endpoint_parameters`, must be a value greater than or equal to `10`") # noqa: E501 + if 'int32' in local_var_params and local_var_params['int32'] > 200: # noqa: E501 + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value less than or equal to `200`") # noqa: E501 + if 'int32' in local_var_params and local_var_params['int32'] < 20: # noqa: E501 + raise ValueError("Invalid value for parameter `int32` when calling `test_endpoint_parameters`, must be a value greater than or equal to `20`") # noqa: E501 + if 'float' in local_var_params and local_var_params['float'] > 987.6: # noqa: E501 + raise ValueError("Invalid value for parameter `float` when calling `test_endpoint_parameters`, must be a value less than or equal to `987.6`") # noqa: E501 + if 'string' in local_var_params and not re.search('[a-z]', local_var_params['string'], flags=re.IGNORECASE): # noqa: E501 + raise ValueError("Invalid value for parameter `string` when calling `test_endpoint_parameters`, must conform to the pattern `/[a-z]/i`") # noqa: E501 + if ('password' in local_var_params and + len(local_var_params['password']) > 64): + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be less than or equal to `64`") # noqa: E501 + if ('password' in local_var_params and + len(local_var_params['password']) < 10): + raise ValueError("Invalid value for parameter `password` when calling `test_endpoint_parameters`, length must be greater than or equal to `10`") # noqa: E501 collection_formats = {} path_params = {} @@ -924,61 +834,44 @@ class FakeApi(object): form_params = [] local_var_files = {} if 'integer' in local_var_params: - form_params.append(('integer', - local_var_params['integer'])) # noqa: E501 + form_params.append(('integer', local_var_params['integer'])) # noqa: E501 if 'int32' in local_var_params: - form_params.append(('int32', - local_var_params['int32'])) # noqa: E501 + form_params.append(('int32', local_var_params['int32'])) # noqa: E501 if 'int64' in local_var_params: - form_params.append(('int64', - local_var_params['int64'])) # noqa: E501 + form_params.append(('int64', local_var_params['int64'])) # noqa: E501 if 'number' in local_var_params: - form_params.append(('number', - local_var_params['number'])) # noqa: E501 + form_params.append(('number', local_var_params['number'])) # noqa: E501 if 'float' in local_var_params: - form_params.append(('float', - local_var_params['float'])) # noqa: E501 + form_params.append(('float', local_var_params['float'])) # noqa: E501 if 'double' in local_var_params: - form_params.append(('double', - local_var_params['double'])) # noqa: E501 + form_params.append(('double', local_var_params['double'])) # noqa: E501 if 'string' in local_var_params: - form_params.append(('string', - local_var_params['string'])) # noqa: E501 + form_params.append(('string', local_var_params['string'])) # noqa: E501 if 'pattern_without_delimiter' in local_var_params: - form_params.append( - ('pattern_without_delimiter', - local_var_params['pattern_without_delimiter'])) # noqa: E501 + form_params.append(('pattern_without_delimiter', local_var_params['pattern_without_delimiter'])) # noqa: E501 if 'byte' in local_var_params: - form_params.append(('byte', - local_var_params['byte'])) # noqa: E501 + form_params.append(('byte', local_var_params['byte'])) # noqa: E501 if 'binary' in local_var_params: - local_var_files['binary'] = local_var_params[ - 'binary'] # noqa: E501 + local_var_files['binary'] = local_var_params['binary'] # noqa: E501 if 'date' in local_var_params: - form_params.append(('date', - local_var_params['date'])) # noqa: E501 + form_params.append(('date', local_var_params['date'])) # noqa: E501 if 'date_time' in local_var_params: - form_params.append(('dateTime', - local_var_params['date_time'])) # noqa: E501 + form_params.append(('dateTime', local_var_params['date_time'])) # noqa: E501 if 'password' in local_var_params: - form_params.append(('password', - local_var_params['password'])) # noqa: E501 + form_params.append(('password', local_var_params['password'])) # noqa: E501 if 'param_callback' in local_var_params: - form_params.append( - ('callback', local_var_params['param_callback'])) # noqa: E501 + form_params.append(('callback', local_var_params['param_callback'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = ['http_basic_test'] # noqa: E501 return self.api_client.call_api( - '/fake', - 'POST', + '/fake', 'POST', path_params, query_params, header_params, @@ -988,8 +881,7 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -1018,11 +910,9 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_enum_parameters_with_http_info( - **kwargs) # noqa: E501 + return self.test_enum_parameters_with_http_info(**kwargs) # noqa: E501 else: - (data) = self.test_enum_parameters_with_http_info( - **kwargs) # noqa: E501 + (data) = self.test_enum_parameters_with_http_info(**kwargs) # noqa: E501 return data def test_enum_parameters_with_http_info(self, **kwargs): # noqa: E501 @@ -1050,12 +940,7 @@ class FakeApi(object): local_var_params = locals() - all_params = [ - 'enum_header_string_array', 'enum_header_string', - 'enum_query_string_array', 'enum_query_string', - 'enum_query_integer', 'enum_query_double', - 'enum_form_string_array', 'enum_form_string' - ] # noqa: E501 + all_params = ['enum_header_string_array', 'enum_header_string', 'enum_query_string_array', 'enum_query_string', 'enum_query_integer', 'enum_query_double', 'enum_form_string_array', 'enum_form_string'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -1063,8 +948,10 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method test_enum_parameters" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_enum_parameters" % key + ) local_var_params[key] = val del local_var_params['kwargs'] @@ -1074,57 +961,40 @@ class FakeApi(object): query_params = [] if 'enum_query_string_array' in local_var_params: - query_params.append( - ('enum_query_string_array', - local_var_params['enum_query_string_array'])) # noqa: E501 + query_params.append(('enum_query_string_array', local_var_params['enum_query_string_array'])) # noqa: E501 collection_formats['enum_query_string_array'] = 'csv' # noqa: E501 if 'enum_query_string' in local_var_params: - query_params.append( - ('enum_query_string', - local_var_params['enum_query_string'])) # noqa: E501 + query_params.append(('enum_query_string', local_var_params['enum_query_string'])) # noqa: E501 if 'enum_query_integer' in local_var_params: - query_params.append( - ('enum_query_integer', - local_var_params['enum_query_integer'])) # noqa: E501 + query_params.append(('enum_query_integer', local_var_params['enum_query_integer'])) # noqa: E501 if 'enum_query_double' in local_var_params: - query_params.append( - ('enum_query_double', - local_var_params['enum_query_double'])) # noqa: E501 + query_params.append(('enum_query_double', local_var_params['enum_query_double'])) # noqa: E501 header_params = {} if 'enum_header_string_array' in local_var_params: - header_params['enum_header_string_array'] = local_var_params[ - 'enum_header_string_array'] # noqa: E501 - collection_formats[ - 'enum_header_string_array'] = 'csv' # noqa: E501 + header_params['enum_header_string_array'] = local_var_params['enum_header_string_array'] # noqa: E501 + collection_formats['enum_header_string_array'] = 'csv' # noqa: E501 if 'enum_header_string' in local_var_params: - header_params['enum_header_string'] = local_var_params[ - 'enum_header_string'] # noqa: E501 + header_params['enum_header_string'] = local_var_params['enum_header_string'] # noqa: E501 form_params = [] local_var_files = {} if 'enum_form_string_array' in local_var_params: - form_params.append( - ('enum_form_string_array', - local_var_params['enum_form_string_array'])) # noqa: E501 + form_params.append(('enum_form_string_array', local_var_params['enum_form_string_array'])) # noqa: E501 collection_formats['enum_form_string_array'] = 'csv' # noqa: E501 if 'enum_form_string' in local_var_params: - form_params.append( - ('enum_form_string', - local_var_params['enum_form_string'])) # noqa: E501 + form_params.append(('enum_form_string', local_var_params['enum_form_string'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake', - 'GET', + '/fake', 'GET', path_params, query_params, header_params, @@ -1134,14 +1004,12 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def test_inline_additional_properties(self, request_body, - **kwargs): # noqa: E501 + def test_inline_additional_properties(self, request_body, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1157,15 +1025,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_inline_additional_properties_with_http_info( - request_body, **kwargs) # noqa: E501 + return self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 else: - (data) = self.test_inline_additional_properties_with_http_info( - request_body, **kwargs) # noqa: E501 + (data) = self.test_inline_additional_properties_with_http_info(request_body, **kwargs) # noqa: E501 return data - def test_inline_additional_properties_with_http_info( - self, request_body, **kwargs): # noqa: E501 + def test_inline_additional_properties_with_http_info(self, request_body, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1192,15 +1057,14 @@ class FakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method test_inline_additional_properties" % key) + " to method test_inline_additional_properties" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'request_body' is set - if ('request_body' not in local_var_params - or local_var_params['request_body'] is None): - raise ValueError( - "Missing the required parameter `request_body` when calling `test_inline_additional_properties`" - ) # noqa: E501 + if ('request_body' not in local_var_params or + local_var_params['request_body'] is None): + raise ValueError("Missing the required parameter `request_body` when calling `test_inline_additional_properties`") # noqa: E501 collection_formats = {} @@ -1217,16 +1081,14 @@ class FakeApi(object): if 'request_body' in local_var_params: body_params = local_var_params['request_body'] # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/inline-additionalProperties', - 'POST', + '/fake/inline-additionalProperties', 'POST', path_params, query_params, header_params, @@ -1236,8 +1098,7 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -1259,15 +1120,12 @@ class FakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_json_form_data_with_http_info( - param, param2, **kwargs) # noqa: E501 + return self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 else: - (data) = self.test_json_form_data_with_http_info( - param, param2, **kwargs) # noqa: E501 + (data) = self.test_json_form_data_with_http_info(param, param2, **kwargs) # noqa: E501 return data - def test_json_form_data_with_http_info(self, param, param2, - **kwargs): # noqa: E501 + def test_json_form_data_with_http_info(self, param, param2, **kwargs): # noqa: E501 """test json serialization of form data # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -1293,22 +1151,20 @@ class FakeApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method test_json_form_data" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_json_form_data" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'param' is set - if ('param' not in local_var_params - or local_var_params['param'] is None): - raise ValueError( - "Missing the required parameter `param` when calling `test_json_form_data`" - ) # noqa: E501 + if ('param' not in local_var_params or + local_var_params['param'] is None): + raise ValueError("Missing the required parameter `param` when calling `test_json_form_data`") # noqa: E501 # verify the required parameter 'param2' is set - if ('param2' not in local_var_params - or local_var_params['param2'] is None): - raise ValueError( - "Missing the required parameter `param2` when calling `test_json_form_data`" - ) # noqa: E501 + if ('param2' not in local_var_params or + local_var_params['param2'] is None): + raise ValueError("Missing the required parameter `param2` when calling `test_json_form_data`") # noqa: E501 collection_formats = {} @@ -1321,24 +1177,20 @@ class FakeApi(object): form_params = [] local_var_files = {} if 'param' in local_var_params: - form_params.append(('param', - local_var_params['param'])) # noqa: E501 + form_params.append(('param', local_var_params['param'])) # noqa: E501 if 'param2' in local_var_params: - form_params.append(('param2', - local_var_params['param2'])) # noqa: E501 + form_params.append(('param2', local_var_params['param2'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/fake/jsonFormData', - 'GET', + '/fake/jsonFormData', 'GET', path_params, query_params, header_params, @@ -1348,8 +1200,7 @@ class FakeApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index 9330ac8bed1..80e03e6626e 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import re # noqa: F401 @@ -47,11 +49,9 @@ class FakeClassnameTags123Api(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_classname_with_http_info(client, - **kwargs) # noqa: E501 + return self.test_classname_with_http_info(client, **kwargs) # noqa: E501 else: - (data) = self.test_classname_with_http_info(client, - **kwargs) # noqa: E501 + (data) = self.test_classname_with_http_info(client, **kwargs) # noqa: E501 return data def test_classname_with_http_info(self, client, **kwargs): # noqa: E501 @@ -80,16 +80,16 @@ class FakeClassnameTags123Api(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method test_classname" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method test_classname" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set - if ('client' not in local_var_params - or local_var_params['client'] is None): - raise ValueError( - "Missing the required parameter `client` when calling `test_classname`" - ) # noqa: E501 + if ('client' not in local_var_params or + local_var_params['client'] is None): + raise ValueError("Missing the required parameter `client` when calling `test_classname`") # noqa: E501 collection_formats = {} @@ -110,16 +110,14 @@ class FakeClassnameTags123Api(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json']) # noqa: E501 # Authentication setting auth_settings = ['api_key_query'] # noqa: E501 return self.api_client.call_api( - '/fake_classname_test', - 'PATCH', + '/fake_classname_test', 'PATCH', path_params, query_params, header_params, @@ -129,8 +127,7 @@ class FakeClassnameTags123Api(object): response_type='Client', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/pet_api.py b/samples/client/petstore/python/petstore_api/api/pet_api.py index 8612eeed9f1..cee0e90ab5c 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import re # noqa: F401 @@ -76,15 +78,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method add_pet" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method add_pet" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet' is set - if ('pet' not in local_var_params or local_var_params['pet'] is None): - raise ValueError( - "Missing the required parameter `pet` when calling `add_pet`" - ) # noqa: E501 + if ('pet' not in local_var_params or + local_var_params['pet'] is None): + raise ValueError("Missing the required parameter `pet` when calling `add_pet`") # noqa: E501 collection_formats = {} @@ -101,16 +104,14 @@ class PetApi(object): if 'pet' in local_var_params: body_params = local_var_params['pet'] # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json', 'application/xml']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json', 'application/xml']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet', - 'POST', + '/pet', 'POST', path_params, query_params, header_params, @@ -120,8 +121,7 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -143,11 +143,9 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.delete_pet_with_http_info(pet_id, - **kwargs) # noqa: E501 + return self.delete_pet_with_http_info(pet_id, **kwargs) # noqa: E501 else: - (data) = self.delete_pet_with_http_info(pet_id, - **kwargs) # noqa: E501 + (data) = self.delete_pet_with_http_info(pet_id, **kwargs) # noqa: E501 return data def delete_pet_with_http_info(self, pet_id, **kwargs): # noqa: E501 @@ -176,16 +174,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method delete_pet" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_pet" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params - or local_var_params['pet_id'] is None): - raise ValueError( - "Missing the required parameter `pet_id` when calling `delete_pet`" - ) # noqa: E501 + if ('pet_id' not in local_var_params or + local_var_params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`") # noqa: E501 collection_formats = {} @@ -197,8 +195,7 @@ class PetApi(object): header_params = {} if 'api_key' in local_var_params: - header_params['api_key'] = local_var_params[ - 'api_key'] # noqa: E501 + header_params['api_key'] = local_var_params['api_key'] # noqa: E501 form_params = [] local_var_files = {} @@ -208,8 +205,7 @@ class PetApi(object): auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}', - 'DELETE', + '/pet/{petId}', 'DELETE', path_params, query_params, header_params, @@ -219,8 +215,7 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -242,15 +237,12 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.find_pets_by_status_with_http_info( - status, **kwargs) # noqa: E501 + return self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 else: - (data) = self.find_pets_by_status_with_http_info( - status, **kwargs) # noqa: E501 + (data) = self.find_pets_by_status_with_http_info(status, **kwargs) # noqa: E501 return data - def find_pets_by_status_with_http_info(self, status, - **kwargs): # noqa: E501 + def find_pets_by_status_with_http_info(self, status, **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 Multiple status values can be provided with comma separated strings # noqa: E501 @@ -276,16 +268,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method find_pets_by_status" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_pets_by_status" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'status' is set - if ('status' not in local_var_params - or local_var_params['status'] is None): - raise ValueError( - "Missing the required parameter `status` when calling `find_pets_by_status`" - ) # noqa: E501 + if ('status' not in local_var_params or + local_var_params['status'] is None): + raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") # noqa: E501 collection_formats = {} @@ -293,8 +285,7 @@ class PetApi(object): query_params = [] if 'status' in local_var_params: - query_params.append(('status', - local_var_params['status'])) # noqa: E501 + query_params.append(('status', local_var_params['status'])) # noqa: E501 collection_formats['status'] = 'csv' # noqa: E501 header_params = {} @@ -311,8 +302,7 @@ class PetApi(object): auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/findByStatus', - 'GET', + '/pet/findByStatus', 'GET', path_params, query_params, header_params, @@ -322,8 +312,7 @@ class PetApi(object): response_type='list[Pet]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -345,11 +334,9 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.find_pets_by_tags_with_http_info( - tags, **kwargs) # noqa: E501 + return self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 else: - (data) = self.find_pets_by_tags_with_http_info( - tags, **kwargs) # noqa: E501 + (data) = self.find_pets_by_tags_with_http_info(tags, **kwargs) # noqa: E501 return data def find_pets_by_tags_with_http_info(self, tags, **kwargs): # noqa: E501 @@ -378,16 +365,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method find_pets_by_tags" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method find_pets_by_tags" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'tags' is set - if ('tags' not in local_var_params - or local_var_params['tags'] is None): - raise ValueError( - "Missing the required parameter `tags` when calling `find_pets_by_tags`" - ) # noqa: E501 + if ('tags' not in local_var_params or + local_var_params['tags'] is None): + raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") # noqa: E501 collection_formats = {} @@ -395,8 +382,7 @@ class PetApi(object): query_params = [] if 'tags' in local_var_params: - query_params.append(('tags', - local_var_params['tags'])) # noqa: E501 + query_params.append(('tags', local_var_params['tags'])) # noqa: E501 collection_formats['tags'] = 'csv' # noqa: E501 header_params = {} @@ -413,8 +399,7 @@ class PetApi(object): auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/findByTags', - 'GET', + '/pet/findByTags', 'GET', path_params, query_params, header_params, @@ -424,8 +409,7 @@ class PetApi(object): response_type='list[Pet]', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -447,11 +431,9 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.get_pet_by_id_with_http_info(pet_id, - **kwargs) # noqa: E501 + return self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 else: - (data) = self.get_pet_by_id_with_http_info(pet_id, - **kwargs) # noqa: E501 + (data) = self.get_pet_by_id_with_http_info(pet_id, **kwargs) # noqa: E501 return data def get_pet_by_id_with_http_info(self, pet_id, **kwargs): # noqa: E501 @@ -480,16 +462,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method get_pet_by_id" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_pet_by_id" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params - or local_var_params['pet_id'] is None): - raise ValueError( - "Missing the required parameter `pet_id` when calling `get_pet_by_id`" - ) # noqa: E501 + if ('pet_id' not in local_var_params or + local_var_params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`") # noqa: E501 collection_formats = {} @@ -513,8 +495,7 @@ class PetApi(object): auth_settings = ['api_key'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}', - 'GET', + '/pet/{petId}', 'GET', path_params, query_params, header_params, @@ -524,8 +505,7 @@ class PetApi(object): response_type='Pet', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -548,8 +528,7 @@ class PetApi(object): if kwargs.get('async_req'): return self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 else: - (data) = self.update_pet_with_http_info(pet, - **kwargs) # noqa: E501 + (data) = self.update_pet_with_http_info(pet, **kwargs) # noqa: E501 return data def update_pet_with_http_info(self, pet, **kwargs): # noqa: E501 @@ -577,15 +556,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method update_pet" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_pet" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet' is set - if ('pet' not in local_var_params or local_var_params['pet'] is None): - raise ValueError( - "Missing the required parameter `pet` when calling `update_pet`" - ) # noqa: E501 + if ('pet' not in local_var_params or + local_var_params['pet'] is None): + raise ValueError("Missing the required parameter `pet` when calling `update_pet`") # noqa: E501 collection_formats = {} @@ -602,16 +582,14 @@ class PetApi(object): if 'pet' in local_var_params: body_params = local_var_params['pet'] # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json', 'application/xml']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/json', 'application/xml']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet', - 'PUT', + '/pet', 'PUT', path_params, query_params, header_params, @@ -621,8 +599,7 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -645,15 +622,12 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.update_pet_with_form_with_http_info( - pet_id, **kwargs) # noqa: E501 + return self.update_pet_with_form_with_http_info(pet_id, **kwargs) # noqa: E501 else: - (data) = self.update_pet_with_form_with_http_info( - pet_id, **kwargs) # noqa: E501 + (data) = self.update_pet_with_form_with_http_info(pet_id, **kwargs) # noqa: E501 return data - def update_pet_with_form_with_http_info(self, pet_id, - **kwargs): # noqa: E501 + def update_pet_with_form_with_http_info(self, pet_id, **kwargs): # noqa: E501 """Updates a pet in the store with form data # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -680,16 +654,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method update_pet_with_form" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_pet_with_form" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params - or local_var_params['pet_id'] is None): - raise ValueError( - "Missing the required parameter `pet_id` when calling `update_pet_with_form`" - ) # noqa: E501 + if ('pet_id' not in local_var_params or + local_var_params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`") # noqa: E501 collection_formats = {} @@ -704,24 +678,20 @@ class PetApi(object): form_params = [] local_var_files = {} if 'name' in local_var_params: - form_params.append(('name', - local_var_params['name'])) # noqa: E501 + form_params.append(('name', local_var_params['name'])) # noqa: E501 if 'status' in local_var_params: - form_params.append(('status', - local_var_params['status'])) # noqa: E501 + form_params.append(('status', local_var_params['status'])) # noqa: E501 body_params = None # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/x-www-form-urlencoded']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['application/x-www-form-urlencoded']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}', - 'POST', + '/pet/{petId}', 'POST', path_params, query_params, header_params, @@ -731,8 +701,7 @@ class PetApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -755,11 +724,9 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.upload_file_with_http_info(pet_id, - **kwargs) # noqa: E501 + return self.upload_file_with_http_info(pet_id, **kwargs) # noqa: E501 else: - (data) = self.upload_file_with_http_info(pet_id, - **kwargs) # noqa: E501 + (data) = self.upload_file_with_http_info(pet_id, **kwargs) # noqa: E501 return data def upload_file_with_http_info(self, pet_id, **kwargs): # noqa: E501 @@ -789,16 +756,16 @@ class PetApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method upload_file" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method upload_file" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params - or local_var_params['pet_id'] is None): - raise ValueError( - "Missing the required parameter `pet_id` when calling `upload_file`" - ) # noqa: E501 + if ('pet_id' not in local_var_params or + local_var_params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`") # noqa: E501 collection_formats = {} @@ -813,9 +780,7 @@ class PetApi(object): form_params = [] local_var_files = {} if 'additional_metadata' in local_var_params: - form_params.append( - ('additionalMetadata', - local_var_params['additional_metadata'])) # noqa: E501 + form_params.append(('additionalMetadata', local_var_params['additional_metadata'])) # noqa: E501 if 'file' in local_var_params: local_var_files['file'] = local_var_params['file'] # noqa: E501 @@ -825,16 +790,14 @@ class PetApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['multipart/form-data']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/pet/{petId}/uploadImage', - 'POST', + '/pet/{petId}/uploadImage', 'POST', path_params, query_params, header_params, @@ -844,14 +807,12 @@ class PetApi(object): response_type='ApiResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) - def upload_file_with_required_file(self, pet_id, required_file, - **kwargs): # noqa: E501 + def upload_file_with_required_file(self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -869,15 +830,12 @@ class PetApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.upload_file_with_required_file_with_http_info( - pet_id, required_file, **kwargs) # noqa: E501 + return self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 else: - (data) = self.upload_file_with_required_file_with_http_info( - pet_id, required_file, **kwargs) # noqa: E501 + (data) = self.upload_file_with_required_file_with_http_info(pet_id, required_file, **kwargs) # noqa: E501 return data - def upload_file_with_required_file_with_http_info( - self, pet_id, required_file, **kwargs): # noqa: E501 + def upload_file_with_required_file_with_http_info(self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -896,8 +854,7 @@ class PetApi(object): local_var_params = locals() - all_params = ['pet_id', 'required_file', - 'additional_metadata'] # noqa: E501 + all_params = ['pet_id', 'required_file', 'additional_metadata'] # noqa: E501 all_params.append('async_req') all_params.append('_return_http_data_only') all_params.append('_preload_content') @@ -907,21 +864,18 @@ class PetApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method upload_file_with_required_file" % key) + " to method upload_file_with_required_file" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'pet_id' is set - if ('pet_id' not in local_var_params - or local_var_params['pet_id'] is None): - raise ValueError( - "Missing the required parameter `pet_id` when calling `upload_file_with_required_file`" - ) # noqa: E501 + if ('pet_id' not in local_var_params or + local_var_params['pet_id'] is None): + raise ValueError("Missing the required parameter `pet_id` when calling `upload_file_with_required_file`") # noqa: E501 # verify the required parameter 'required_file' is set - if ('required_file' not in local_var_params - or local_var_params['required_file'] is None): - raise ValueError( - "Missing the required parameter `required_file` when calling `upload_file_with_required_file`" - ) # noqa: E501 + if ('required_file' not in local_var_params or + local_var_params['required_file'] is None): + raise ValueError("Missing the required parameter `required_file` when calling `upload_file_with_required_file`") # noqa: E501 collection_formats = {} @@ -936,12 +890,9 @@ class PetApi(object): form_params = [] local_var_files = {} if 'additional_metadata' in local_var_params: - form_params.append( - ('additionalMetadata', - local_var_params['additional_metadata'])) # noqa: E501 + form_params.append(('additionalMetadata', local_var_params['additional_metadata'])) # noqa: E501 if 'required_file' in local_var_params: - local_var_files['requiredFile'] = local_var_params[ - 'required_file'] # noqa: E501 + local_var_files['requiredFile'] = local_var_params['required_file'] # noqa: E501 body_params = None # HTTP header `Accept` @@ -949,16 +900,14 @@ class PetApi(object): ['application/json']) # noqa: E501 # HTTP header `Content-Type` - header_params[ - 'Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['multipart/form-data']) # noqa: E501 + header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 + ['multipart/form-data']) # noqa: E501 # Authentication setting auth_settings = ['petstore_auth'] # noqa: E501 return self.api_client.call_api( - '/fake/{petId}/uploadImageWithRequiredFile', - 'POST', + '/fake/{petId}/uploadImageWithRequiredFile', 'POST', path_params, query_params, header_params, @@ -968,8 +917,7 @@ class PetApi(object): response_type='ApiResponse', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/store_api.py b/samples/client/petstore/python/petstore_api/api/store_api.py index da2bcd3f7bd..8d471fddabf 100644 --- a/samples/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/client/petstore/python/petstore_api/api/store_api.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import re # noqa: F401 @@ -47,11 +49,9 @@ class StoreApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.delete_order_with_http_info(order_id, - **kwargs) # noqa: E501 + return self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 else: - (data) = self.delete_order_with_http_info(order_id, - **kwargs) # noqa: E501 + (data) = self.delete_order_with_http_info(order_id, **kwargs) # noqa: E501 return data def delete_order_with_http_info(self, order_id, **kwargs): # noqa: E501 @@ -80,23 +80,22 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method delete_order" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_order" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params - or local_var_params['order_id'] is None): - raise ValueError( - "Missing the required parameter `order_id` when calling `delete_order`" - ) # noqa: E501 + if ('order_id' not in local_var_params or + local_var_params['order_id'] is None): + raise ValueError("Missing the required parameter `order_id` when calling `delete_order`") # noqa: E501 collection_formats = {} path_params = {} if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params[ - 'order_id'] # noqa: E501 + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] @@ -110,8 +109,7 @@ class StoreApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/store/order/{order_id}', - 'DELETE', + '/store/order/{order_id}', 'DELETE', path_params, query_params, header_params, @@ -121,8 +119,7 @@ class StoreApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -173,8 +170,10 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method get_inventory" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_inventory" % key + ) local_var_params[key] = val del local_var_params['kwargs'] @@ -198,8 +197,7 @@ class StoreApi(object): auth_settings = ['api_key'] # noqa: E501 return self.api_client.call_api( - '/store/inventory', - 'GET', + '/store/inventory', 'GET', path_params, query_params, header_params, @@ -209,8 +207,7 @@ class StoreApi(object): response_type='dict(str, int)', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -232,11 +229,9 @@ class StoreApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.get_order_by_id_with_http_info(order_id, - **kwargs) # noqa: E501 + return self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 else: - (data) = self.get_order_by_id_with_http_info( - order_id, **kwargs) # noqa: E501 + (data) = self.get_order_by_id_with_http_info(order_id, **kwargs) # noqa: E501 return data def get_order_by_id_with_http_info(self, order_id, **kwargs): # noqa: E501 @@ -265,33 +260,26 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method get_order_by_id" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_order_by_id" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order_id' is set - if ('order_id' not in local_var_params - or local_var_params['order_id'] is None): - raise ValueError( - "Missing the required parameter `order_id` when calling `get_order_by_id`" - ) # noqa: E501 - - if 'order_id' in local_var_params and local_var_params[ - 'order_id'] > 5: # noqa: E501 - raise ValueError( - "Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`" - ) # noqa: E501 - if 'order_id' in local_var_params and local_var_params[ - 'order_id'] < 1: # noqa: E501 - raise ValueError( - "Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`" - ) # noqa: E501 + if ('order_id' not in local_var_params or + local_var_params['order_id'] is None): + raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`") # noqa: E501 + + if 'order_id' in local_var_params and local_var_params['order_id'] > 5: # noqa: E501 + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value less than or equal to `5`") # noqa: E501 + if 'order_id' in local_var_params and local_var_params['order_id'] < 1: # noqa: E501 + raise ValueError("Invalid value for parameter `order_id` when calling `get_order_by_id`, must be a value greater than or equal to `1`") # noqa: E501 collection_formats = {} path_params = {} if 'order_id' in local_var_params: - path_params['order_id'] = local_var_params[ - 'order_id'] # noqa: E501 + path_params['order_id'] = local_var_params['order_id'] # noqa: E501 query_params = [] @@ -309,8 +297,7 @@ class StoreApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/store/order/{order_id}', - 'GET', + '/store/order/{order_id}', 'GET', path_params, query_params, header_params, @@ -320,8 +307,7 @@ class StoreApi(object): response_type='Order', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -342,11 +328,9 @@ class StoreApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.place_order_with_http_info(order, - **kwargs) # noqa: E501 + return self.place_order_with_http_info(order, **kwargs) # noqa: E501 else: - (data) = self.place_order_with_http_info(order, - **kwargs) # noqa: E501 + (data) = self.place_order_with_http_info(order, **kwargs) # noqa: E501 return data def place_order_with_http_info(self, order, **kwargs): # noqa: E501 @@ -374,16 +358,16 @@ class StoreApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method place_order" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method place_order" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'order' is set - if ('order' not in local_var_params - or local_var_params['order'] is None): - raise ValueError( - "Missing the required parameter `order` when calling `place_order`" - ) # noqa: E501 + if ('order' not in local_var_params or + local_var_params['order'] is None): + raise ValueError("Missing the required parameter `order` when calling `place_order`") # noqa: E501 collection_formats = {} @@ -407,8 +391,7 @@ class StoreApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/store/order', - 'POST', + '/store/order', 'POST', path_params, query_params, header_params, @@ -418,8 +401,7 @@ class StoreApi(object): response_type='Order', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api/user_api.py b/samples/client/petstore/python/petstore_api/api/user_api.py index e163bad77d9..e86ac277e97 100644 --- a/samples/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/client/petstore/python/petstore_api/api/user_api.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import re # noqa: F401 @@ -47,11 +49,9 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.create_user_with_http_info(user, - **kwargs) # noqa: E501 + return self.create_user_with_http_info(user, **kwargs) # noqa: E501 else: - (data) = self.create_user_with_http_info(user, - **kwargs) # noqa: E501 + (data) = self.create_user_with_http_info(user, **kwargs) # noqa: E501 return data def create_user_with_http_info(self, user, **kwargs): # noqa: E501 @@ -80,16 +80,16 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method create_user" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method create_user" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'user' is set - if ('user' not in local_var_params - or local_var_params['user'] is None): - raise ValueError( - "Missing the required parameter `user` when calling `create_user`" - ) # noqa: E501 + if ('user' not in local_var_params or + local_var_params['user'] is None): + raise ValueError("Missing the required parameter `user` when calling `create_user`") # noqa: E501 collection_formats = {} @@ -109,8 +109,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user', - 'POST', + '/user', 'POST', path_params, query_params, header_params, @@ -120,8 +119,7 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -142,15 +140,12 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.create_users_with_array_input_with_http_info( - user, **kwargs) # noqa: E501 + return self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 else: - (data) = self.create_users_with_array_input_with_http_info( - user, **kwargs) # noqa: E501 + (data) = self.create_users_with_array_input_with_http_info(user, **kwargs) # noqa: E501 return data - def create_users_with_array_input_with_http_info(self, user, - **kwargs): # noqa: E501 + def create_users_with_array_input_with_http_info(self, user, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -177,15 +172,14 @@ class UserApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method create_users_with_array_input" % key) + " to method create_users_with_array_input" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'user' is set - if ('user' not in local_var_params - or local_var_params['user'] is None): - raise ValueError( - "Missing the required parameter `user` when calling `create_users_with_array_input`" - ) # noqa: E501 + if ('user' not in local_var_params or + local_var_params['user'] is None): + raise ValueError("Missing the required parameter `user` when calling `create_users_with_array_input`") # noqa: E501 collection_formats = {} @@ -205,8 +199,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/createWithArray', - 'POST', + '/user/createWithArray', 'POST', path_params, query_params, header_params, @@ -216,8 +209,7 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -238,15 +230,12 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.create_users_with_list_input_with_http_info( - user, **kwargs) # noqa: E501 + return self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 else: - (data) = self.create_users_with_list_input_with_http_info( - user, **kwargs) # noqa: E501 + (data) = self.create_users_with_list_input_with_http_info(user, **kwargs) # noqa: E501 return data - def create_users_with_list_input_with_http_info(self, user, - **kwargs): # noqa: E501 + def create_users_with_list_input_with_http_info(self, user, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -273,15 +262,14 @@ class UserApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method create_users_with_list_input" % key) + " to method create_users_with_list_input" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'user' is set - if ('user' not in local_var_params - or local_var_params['user'] is None): - raise ValueError( - "Missing the required parameter `user` when calling `create_users_with_list_input`" - ) # noqa: E501 + if ('user' not in local_var_params or + local_var_params['user'] is None): + raise ValueError("Missing the required parameter `user` when calling `create_users_with_list_input`") # noqa: E501 collection_formats = {} @@ -301,8 +289,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/createWithList', - 'POST', + '/user/createWithList', 'POST', path_params, query_params, header_params, @@ -312,8 +299,7 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -335,11 +321,9 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.delete_user_with_http_info(username, - **kwargs) # noqa: E501 + return self.delete_user_with_http_info(username, **kwargs) # noqa: E501 else: - (data) = self.delete_user_with_http_info(username, - **kwargs) # noqa: E501 + (data) = self.delete_user_with_http_info(username, **kwargs) # noqa: E501 return data def delete_user_with_http_info(self, username, **kwargs): # noqa: E501 @@ -368,23 +352,22 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method delete_user" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method delete_user" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params - or local_var_params['username'] is None): - raise ValueError( - "Missing the required parameter `username` when calling `delete_user`" - ) # noqa: E501 + if ('username' not in local_var_params or + local_var_params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `delete_user`") # noqa: E501 collection_formats = {} path_params = {} if 'username' in local_var_params: - path_params['username'] = local_var_params[ - 'username'] # noqa: E501 + path_params['username'] = local_var_params['username'] # noqa: E501 query_params = [] @@ -398,8 +381,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/{username}', - 'DELETE', + '/user/{username}', 'DELETE', path_params, query_params, header_params, @@ -409,8 +391,7 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -431,15 +412,12 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.get_user_by_name_with_http_info(username, - **kwargs) # noqa: E501 + return self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 else: - (data) = self.get_user_by_name_with_http_info( - username, **kwargs) # noqa: E501 + (data) = self.get_user_by_name_with_http_info(username, **kwargs) # noqa: E501 return data - def get_user_by_name_with_http_info(self, username, - **kwargs): # noqa: E501 + def get_user_by_name_with_http_info(self, username, **kwargs): # noqa: E501 """Get user by user name # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -464,23 +442,22 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method get_user_by_name" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method get_user_by_name" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params - or local_var_params['username'] is None): - raise ValueError( - "Missing the required parameter `username` when calling `get_user_by_name`" - ) # noqa: E501 + if ('username' not in local_var_params or + local_var_params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`") # noqa: E501 collection_formats = {} path_params = {} if 'username' in local_var_params: - path_params['username'] = local_var_params[ - 'username'] # noqa: E501 + path_params['username'] = local_var_params['username'] # noqa: E501 query_params = [] @@ -498,8 +475,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/{username}', - 'GET', + '/user/{username}', 'GET', path_params, query_params, header_params, @@ -509,8 +485,7 @@ class UserApi(object): response_type='User', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -532,15 +507,12 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.login_user_with_http_info(username, password, - **kwargs) # noqa: E501 + return self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 else: - (data) = self.login_user_with_http_info(username, password, - **kwargs) # noqa: E501 + (data) = self.login_user_with_http_info(username, password, **kwargs) # noqa: E501 return data - def login_user_with_http_info(self, username, password, - **kwargs): # noqa: E501 + def login_user_with_http_info(self, username, password, **kwargs): # noqa: E501 """Logs user into the system # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -566,22 +538,20 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method login_user" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method login_user" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params - or local_var_params['username'] is None): - raise ValueError( - "Missing the required parameter `username` when calling `login_user`" - ) # noqa: E501 + if ('username' not in local_var_params or + local_var_params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `login_user`") # noqa: E501 # verify the required parameter 'password' is set - if ('password' not in local_var_params - or local_var_params['password'] is None): - raise ValueError( - "Missing the required parameter `password` when calling `login_user`" - ) # noqa: E501 + if ('password' not in local_var_params or + local_var_params['password'] is None): + raise ValueError("Missing the required parameter `password` when calling `login_user`") # noqa: E501 collection_formats = {} @@ -589,11 +559,9 @@ class UserApi(object): query_params = [] if 'username' in local_var_params: - query_params.append(('username', - local_var_params['username'])) # noqa: E501 + query_params.append(('username', local_var_params['username'])) # noqa: E501 if 'password' in local_var_params: - query_params.append(('password', - local_var_params['password'])) # noqa: E501 + query_params.append(('password', local_var_params['password'])) # noqa: E501 header_params = {} @@ -609,8 +577,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/login', - 'GET', + '/user/login', 'GET', path_params, query_params, header_params, @@ -620,8 +587,7 @@ class UserApi(object): response_type='str', # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -670,8 +636,10 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method logout_user" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method logout_user" % key + ) local_var_params[key] = val del local_var_params['kwargs'] @@ -691,8 +659,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/logout', - 'GET', + '/user/logout', 'GET', path_params, query_params, header_params, @@ -702,8 +669,7 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) @@ -726,15 +692,12 @@ class UserApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.update_user_with_http_info(username, user, - **kwargs) # noqa: E501 + return self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 else: - (data) = self.update_user_with_http_info(username, user, - **kwargs) # noqa: E501 + (data) = self.update_user_with_http_info(username, user, **kwargs) # noqa: E501 return data - def update_user_with_http_info(self, username, user, - **kwargs): # noqa: E501 + def update_user_with_http_info(self, username, user, **kwargs): # noqa: E501 """Updated user # noqa: E501 This can only be done by the logged in user. # noqa: E501 @@ -761,29 +724,26 @@ class UserApi(object): for key, val in six.iteritems(local_var_params['kwargs']): if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" - " to method update_user" % key) + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method update_user" % key + ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'username' is set - if ('username' not in local_var_params - or local_var_params['username'] is None): - raise ValueError( - "Missing the required parameter `username` when calling `update_user`" - ) # noqa: E501 + if ('username' not in local_var_params or + local_var_params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `update_user`") # noqa: E501 # verify the required parameter 'user' is set - if ('user' not in local_var_params - or local_var_params['user'] is None): - raise ValueError( - "Missing the required parameter `user` when calling `update_user`" - ) # noqa: E501 + if ('user' not in local_var_params or + local_var_params['user'] is None): + raise ValueError("Missing the required parameter `user` when calling `update_user`") # noqa: E501 collection_formats = {} path_params = {} if 'username' in local_var_params: - path_params['username'] = local_var_params[ - 'username'] # noqa: E501 + path_params['username'] = local_var_params['username'] # noqa: E501 query_params = [] @@ -799,8 +759,7 @@ class UserApi(object): auth_settings = [] # noqa: E501 return self.api_client.call_api( - '/user/{username}', - 'PUT', + '/user/{username}', 'PUT', path_params, query_params, header_params, @@ -810,8 +769,7 @@ class UserApi(object): response_type=None, # noqa: E501 auth_settings=auth_settings, async_req=local_var_params.get('async_req'), - _return_http_data_only=local_var_params.get( - '_return_http_data_only'), # noqa: E501 + _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), collection_formats=collection_formats) diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index eba6151d293..e90d9f7e205 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -59,10 +59,7 @@ class ApiClient(object): 'object': object, } - def __init__(self, - configuration=None, - header_name=None, - header_value=None, + def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None): if configuration is None: configuration = Configuration() @@ -93,21 +90,12 @@ class ApiClient(object): def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value - def __call_api(self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None): + def __call_api( + self, resource_path, method, path_params=None, + query_params=None, header_params=None, body=None, post_params=None, + files=None, response_type=None, auth_settings=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): config = self.configuration @@ -118,8 +106,8 @@ class ApiClient(object): header_params['Cookie'] = self.cookie if header_params: header_params = self.sanitize_for_serialization(header_params) - header_params = dict( - self.parameters_to_tuples(header_params, collection_formats)) + header_params = dict(self.parameters_to_tuples(header_params, + collection_formats)) # path parameters if path_params: @@ -130,7 +118,8 @@ class ApiClient(object): # specified safe chars, encode everything resource_path = resource_path.replace( '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param)) + quote(str(v), safe=config.safe_chars_for_path_param) + ) # query parameters if query_params: @@ -157,12 +146,8 @@ class ApiClient(object): # perform request and return response response_data = self.request( - method, - url, - query_params=query_params, - headers=header_params, - post_params=post_params, - body=body, + method, url, query_params=query_params, headers=header_params, + post_params=post_params, body=body, _preload_content=_preload_content, _request_timeout=_request_timeout) @@ -201,12 +186,11 @@ class ApiClient(object): elif isinstance(obj, self.PRIMITIVE_TYPES): return obj elif isinstance(obj, list): - return [ - self.sanitize_for_serialization(sub_obj) for sub_obj in obj - ] + return [self.sanitize_for_serialization(sub_obj) + for sub_obj in obj] elif isinstance(obj, tuple): - return tuple( - self.sanitize_for_serialization(sub_obj) for sub_obj in obj) + return tuple(self.sanitize_for_serialization(sub_obj) + for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() @@ -218,16 +202,12 @@ class ApiClient(object): # and attributes which value is not None. # Convert attribute name to json key in # model definition for request. - obj_dict = { - obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.openapi_types) - if getattr(obj, attr) is not None - } + obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) + for attr, _ in six.iteritems(obj.openapi_types) + if getattr(obj, attr) is not None} - return { - key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict) - } + return {key: self.sanitize_for_serialization(val) + for key, val in six.iteritems(obj_dict)} def deserialize(self, response, response_type): """Deserializes response into an object. @@ -265,16 +245,13 @@ class ApiClient(object): if type(klass) == str: if klass.startswith('list['): sub_kls = re.match('list\[(.*)\]', klass).group(1) - return [ - self.__deserialize(sub_data, sub_kls) for sub_data in data - ] + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] if klass.startswith('dict('): sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) - return { - k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data) - } + return {k: self.__deserialize(v, sub_kls) + for k, v in six.iteritems(data)} # convert str to class if klass in self.NATIVE_TYPES_MAPPING: @@ -293,22 +270,12 @@ class ApiClient(object): else: return self.__deserialize_model(data, klass) - def call_api(self, - resource_path, - method, - path_params=None, - query_params=None, - header_params=None, - body=None, - post_params=None, - files=None, - response_type=None, - auth_settings=None, - async_req=None, - _return_http_data_only=None, - collection_formats=None, - _preload_content=True, - _request_timeout=None): + def call_api(self, resource_path, method, + path_params=None, query_params=None, header_params=None, + body=None, post_params=None, files=None, + response_type=None, auth_settings=None, async_req=None, + _return_http_data_only=None, collection_formats=None, + _preload_content=True, _request_timeout=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -346,91 +313,83 @@ class ApiClient(object): then the method will return the response directly. """ if not async_req: - return self.__call_api( - resource_path, method, path_params, query_params, - header_params, body, post_params, files, response_type, - auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout) + return self.__call_api(resource_path, method, + path_params, query_params, header_params, + body, post_params, files, + response_type, auth_settings, + _return_http_data_only, collection_formats, + _preload_content, _request_timeout) else: - thread = self.pool.apply_async( - self.__call_api, - (resource_path, method, path_params, query_params, - header_params, body, post_params, files, response_type, - auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout)) + thread = self.pool.apply_async(self.__call_api, (resource_path, + method, path_params, query_params, + header_params, body, + post_params, files, + response_type, auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, _request_timeout)) return thread - def request(self, - method, - url, - query_params=None, - headers=None, - post_params=None, - body=None, - _preload_content=True, + def request(self, method, url, query_params=None, headers=None, + post_params=None, body=None, _preload_content=True, _request_timeout=None): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.GET(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "HEAD": - return self.rest_client.HEAD( - url, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.HEAD(url, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers) elif method == "OPTIONS": - return self.rest_client.OPTIONS( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.OPTIONS(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "POST": - return self.rest_client.POST( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.POST(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PUT": - return self.rest_client.PUT( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PUT(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "PATCH": - return self.rest_client.PATCH( - url, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PATCH(url, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) elif method == "DELETE": - return self.rest_client.DELETE( - url, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.DELETE(url, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) else: - raise ValueError("http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`.") + raise ValueError( + "http method must be `GET`, `HEAD`, `OPTIONS`," + " `POST`, `PATCH`, `PUT` or `DELETE`." + ) def parameters_to_tuples(self, params, collection_formats): """Get parameters as list of tuples, formatting collections. @@ -442,8 +401,7 @@ class ApiClient(object): new_params = [] if collection_formats is None: collection_formats = {} - for k, v in six.iteritems(params) if isinstance( - params, dict) else params: # noqa: E501 + for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': @@ -457,9 +415,8 @@ class ApiClient(object): delimiter = '|' else: # csv is the default delimiter = ',' - new_params.append((k, - delimiter.join( - str(value) for value in v))) + new_params.append( + (k, delimiter.join(str(value) for value in v))) else: new_params.append((k, v)) return new_params @@ -485,8 +442,8 @@ class ApiClient(object): with open(n, 'rb') as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] - or 'application/octet-stream') + mimetype = (mimetypes.guess_type(filename)[0] or + 'application/octet-stream') params.append( tuple([k, tuple([filename, filedata, mimetype])])) @@ -545,7 +502,8 @@ class ApiClient(object): querys.append((auth_setting['key'], auth_setting['value'])) else: raise ValueError( - 'Authentication token must be in `query` or `header`') + 'Authentication token must be in `query` or `header`' + ) def __deserialize_file(self, response): """Deserializes body to file @@ -607,7 +565,8 @@ class ApiClient(object): except ValueError: raise rest.ApiException( status=0, - reason="Failed to parse `{0}` as date object".format(string)) + reason="Failed to parse `{0}` as date object".format(string) + ) def __deserialize_datatime(self, string): """Deserializes string to datetime. @@ -626,7 +585,10 @@ class ApiClient(object): raise rest.ApiException( status=0, reason=( - "Failed to parse `{0}` as datetime object".format(string))) + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) def __deserialize_model(self, data, klass): """Deserializes list or dict to model. @@ -643,8 +605,9 @@ class ApiClient(object): kwargs = {} if klass.openapi_types is not None: 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 (data is not None and + klass.attribute_map[attr] in data and + isinstance(data, (list, dict))): value = data[klass.attribute_map[attr]] kwargs[attr] = self.__deserialize(value, attr_type) diff --git a/samples/client/petstore/python/petstore_api/configuration.py b/samples/client/petstore/python/petstore_api/configuration.py index 17fb9a663a4..c6816043455 100644 --- a/samples/client/petstore/python/petstore_api/configuration.py +++ b/samples/client/petstore/python/petstore_api/configuration.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import copy @@ -192,10 +194,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): :param identifier: The identifier of apiKey. :return: The token for api key authentication. """ - if (self.api_key.get(identifier) - and self.api_key_prefix.get(identifier)): - return self.api_key_prefix[identifier] + ' ' + self.api_key[ - identifier] # noqa: E501 + if (self.api_key.get(identifier) and + self.api_key_prefix.get(identifier)): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501 elif self.api_key.get(identifier): return self.api_key[identifier] @@ -204,8 +205,9 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): :return: The token for basic HTTP authentication. """ - return urllib3.util.make_headers(basic_auth=self.username + ':' + - self.password).get('authorization') + return urllib3.util.make_headers( + basic_auth=self.username + ':' + self.password + ).get('authorization') def auth_settings(self): """Gets Auth Settings dict for api client. @@ -213,30 +215,36 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)): :return: The Auth Settings information dict. """ return { - 'api_key': { - 'type': 'api_key', - 'in': 'header', - 'key': 'api_key', - 'value': self.get_api_key_with_prefix('api_key') - }, - 'api_key_query': { - 'type': 'api_key', - 'in': 'query', - 'key': 'api_key_query', - 'value': self.get_api_key_with_prefix('api_key_query') - }, - 'http_basic_test': { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - }, - 'petstore_auth': { - 'type': 'oauth2', - 'in': 'header', - 'key': 'Authorization', - 'value': 'Bearer ' + self.access_token - }, + 'api_key': + { + 'type': 'api_key', + 'in': 'header', + 'key': 'api_key', + 'value': self.get_api_key_with_prefix('api_key') + }, + 'api_key_query': + { + 'type': 'api_key', + 'in': 'query', + 'key': 'api_key_query', + 'value': self.get_api_key_with_prefix('api_key_query') + }, + 'http_basic_test': + { + 'type': 'basic', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_basic_auth_token() + }, + + 'petstore_auth': + { + 'type': 'oauth2', + 'in': 'header', + 'key': 'Authorization', + 'value': 'Bearer ' + self.access_token + }, + } def to_debug_report(self): diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index 119bf4bbc8c..2450cb334f7 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -10,6 +10,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import # import models into model package diff --git a/samples/client/petstore/python/petstore_api/models/additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/additional_properties_class.py index 6928820ef27..dc4648ae1c7 100644 --- a/samples/client/petstore/python/petstore_api/models/additional_properties_class.py +++ b/samples/client/petstore/python/petstore_api/models/additional_properties_class.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class AdditionalPropertiesClass(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -37,8 +40,7 @@ class AdditionalPropertiesClass(object): 'map_of_map_property': 'map_of_map_property' } - def __init__(self, map_property=None, - map_of_map_property=None): # noqa: E501 + def __init__(self, map_property=None, map_of_map_property=None): # noqa: E501 """AdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501 self._map_property = None @@ -99,9 +101,10 @@ class AdditionalPropertiesClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/animal.py b/samples/client/petstore/python/petstore_api/models/animal.py index 78324c64916..5acccf50f7a 100644 --- a/samples/client/petstore/python/petstore_api/models/animal.py +++ b/samples/client/petstore/python/petstore_api/models/animal.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Animal(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,11 +30,20 @@ class Animal(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'class_name': 'str', 'color': 'str'} + openapi_types = { + 'class_name': 'str', + 'color': 'str' + } - attribute_map = {'class_name': 'className', 'color': 'color'} + attribute_map = { + 'class_name': 'className', + 'color': 'color' + } - discriminator_value_class_map = {'Dog': 'Dog', 'Cat': 'Cat'} + discriminator_value_class_map = { + 'Dog': 'Dog', + 'Cat': 'Cat' + } def __init__(self, class_name=None, color='red'): # noqa: E501 """Animal - a model defined in OpenAPI""" # noqa: E501 @@ -63,9 +75,7 @@ class Animal(object): :type: str """ if class_name is None: - raise ValueError( - "Invalid value for `class_name`, must not be `None`" - ) # noqa: E501 + raise ValueError("Invalid value for `class_name`, must not be `None`") # noqa: E501 self._class_name = class_name @@ -102,9 +112,10 @@ class Animal(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/animal_farm.py b/samples/client/petstore/python/petstore_api/models/animal_farm.py index ae9397ca2c2..4894e5530a3 100644 --- a/samples/client/petstore/python/petstore_api/models/animal_farm.py +++ b/samples/client/petstore/python/petstore_api/models/animal_farm.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class AnimalFarm(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,11 @@ class AnimalFarm(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {} + openapi_types = { + } - attribute_map = {} + attribute_map = { + } def __init__(self): # noqa: E501 """AnimalFarm - a model defined in OpenAPI""" # noqa: E501 @@ -42,9 +47,10 @@ class AnimalFarm(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/api_response.py b/samples/client/petstore/python/petstore_api/models/api_response.py index 6208d24b15b..e6298303049 100644 --- a/samples/client/petstore/python/petstore_api/models/api_response.py +++ b/samples/client/petstore/python/petstore_api/models/api_response.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class ApiResponse(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,17 @@ class ApiResponse(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'code': 'int', 'type': 'str', 'message': 'str'} - - attribute_map = {'code': 'code', 'type': 'type', 'message': 'message'} + openapi_types = { + 'code': 'int', + 'type': 'str', + 'message': 'str' + } + + attribute_map = { + 'code': 'code', + 'type': 'type', + 'message': 'message' + } def __init__(self, code=None, type=None, message=None): # noqa: E501 """ApiResponse - a model defined in OpenAPI""" # noqa: E501 @@ -116,9 +127,10 @@ class ApiResponse(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py b/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py index 45ec0074811..fde218a4661 100644 --- a/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py +++ b/samples/client/petstore/python/petstore_api/models/array_of_array_of_number_only.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class ArrayOfArrayOfNumberOnly(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class ArrayOfArrayOfNumberOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'array_array_number': 'list[list[float]]'} + openapi_types = { + 'array_array_number': 'list[list[float]]' + } - attribute_map = {'array_array_number': 'ArrayArrayNumber'} + attribute_map = { + 'array_array_number': 'ArrayArrayNumber' + } def __init__(self, array_array_number=None): # noqa: E501 """ArrayOfArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class ArrayOfArrayOfNumberOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/array_of_number_only.py b/samples/client/petstore/python/petstore_api/models/array_of_number_only.py index 8062023a37b..8999e563c4a 100644 --- a/samples/client/petstore/python/petstore_api/models/array_of_number_only.py +++ b/samples/client/petstore/python/petstore_api/models/array_of_number_only.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class ArrayOfNumberOnly(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class ArrayOfNumberOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'array_number': 'list[float]'} + openapi_types = { + 'array_number': 'list[float]' + } - attribute_map = {'array_number': 'ArrayNumber'} + attribute_map = { + 'array_number': 'ArrayNumber' + } def __init__(self, array_number=None): # noqa: E501 """ArrayOfNumberOnly - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class ArrayOfNumberOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/array_test.py b/samples/client/petstore/python/petstore_api/models/array_test.py index 0fb3848087e..05cc108139a 100644 --- a/samples/client/petstore/python/petstore_api/models/array_test.py +++ b/samples/client/petstore/python/petstore_api/models/array_test.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class ArrayTest(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -39,10 +42,7 @@ class ArrayTest(object): 'array_array_of_model': 'array_array_of_model' } - def __init__(self, - array_of_string=None, - array_array_of_integer=None, - array_array_of_model=None): # noqa: E501 + def __init__(self, array_of_string=None, array_array_of_integer=None, array_array_of_model=None): # noqa: E501 """ArrayTest - a model defined in OpenAPI""" # noqa: E501 self._array_of_string = None @@ -127,9 +127,10 @@ class ArrayTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/capitalization.py b/samples/client/petstore/python/petstore_api/models/capitalization.py index d6b88188619..923f5c4aae8 100644 --- a/samples/client/petstore/python/petstore_api/models/capitalization.py +++ b/samples/client/petstore/python/petstore_api/models/capitalization.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Capitalization(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -45,13 +48,7 @@ class Capitalization(object): 'att_name': 'ATT_NAME' } - def __init__(self, - small_camel=None, - capital_camel=None, - small_snake=None, - capital_snake=None, - sca_eth_flow_points=None, - att_name=None): # noqa: E501 + def __init__(self, small_camel=None, capital_camel=None, small_snake=None, capital_snake=None, sca_eth_flow_points=None, att_name=None): # noqa: E501 """Capitalization - a model defined in OpenAPI""" # noqa: E501 self._small_camel = None @@ -210,9 +207,10 @@ class Capitalization(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/cat.py b/samples/client/petstore/python/petstore_api/models/cat.py index d1e7b3095b0..c5c87a6b111 100644 --- a/samples/client/petstore/python/petstore_api/models/cat.py +++ b/samples/client/petstore/python/petstore_api/models/cat.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Cat(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class Cat(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'declawed': 'bool'} + openapi_types = { + 'declawed': 'bool' + } - attribute_map = {'declawed': 'declawed'} + attribute_map = { + 'declawed': 'declawed' + } def __init__(self, declawed=None): # noqa: E501 """Cat - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class Cat(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/category.py b/samples/client/petstore/python/petstore_api/models/category.py index ae61bbb2f43..9fbd44a7b34 100644 --- a/samples/client/petstore/python/petstore_api/models/category.py +++ b/samples/client/petstore/python/petstore_api/models/category.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Category(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,15 @@ class Category(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'id': 'int', 'name': 'str'} + openapi_types = { + 'id': 'int', + 'name': 'str' + } - attribute_map = {'id': 'id', 'name': 'name'} + attribute_map = { + 'id': 'id', + 'name': 'name' + } def __init__(self, id=None, name=None): # noqa: E501 """Category - a model defined in OpenAPI""" # noqa: E501 @@ -92,9 +101,10 @@ class Category(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/class_model.py b/samples/client/petstore/python/petstore_api/models/class_model.py index 3fdbfba95f5..e207ba41ec9 100644 --- a/samples/client/petstore/python/petstore_api/models/class_model.py +++ b/samples/client/petstore/python/petstore_api/models/class_model.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class ClassModel(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class ClassModel(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'_class': 'str'} + openapi_types = { + '_class': 'str' + } - attribute_map = {'_class': '_class'} + attribute_map = { + '_class': '_class' + } def __init__(self, _class=None): # noqa: E501 """ClassModel - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class ClassModel(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/client.py b/samples/client/petstore/python/petstore_api/models/client.py index 756619d0976..e742468e776 100644 --- a/samples/client/petstore/python/petstore_api/models/client.py +++ b/samples/client/petstore/python/petstore_api/models/client.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Client(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class Client(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'client': 'str'} + openapi_types = { + 'client': 'str' + } - attribute_map = {'client': 'client'} + attribute_map = { + 'client': 'client' + } def __init__(self, client=None): # noqa: E501 """Client - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class Client(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/dog.py b/samples/client/petstore/python/petstore_api/models/dog.py index c6379d89ac8..c2bc8f745d1 100644 --- a/samples/client/petstore/python/petstore_api/models/dog.py +++ b/samples/client/petstore/python/petstore_api/models/dog.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Dog(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class Dog(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'breed': 'str'} + openapi_types = { + 'breed': 'str' + } - attribute_map = {'breed': 'breed'} + attribute_map = { + 'breed': 'breed' + } def __init__(self, breed=None): # noqa: E501 """Dog - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class Dog(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/enum_arrays.py b/samples/client/petstore/python/petstore_api/models/enum_arrays.py index f8db82dd6d0..df4363c356c 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_arrays.py +++ b/samples/client/petstore/python/petstore_api/models/enum_arrays.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class EnumArrays(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,15 @@ class EnumArrays(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'just_symbol': 'str', 'array_enum': 'list[str]'} + openapi_types = { + 'just_symbol': 'str', + 'array_enum': 'list[str]' + } - attribute_map = {'just_symbol': 'just_symbol', 'array_enum': 'array_enum'} + attribute_map = { + 'just_symbol': 'just_symbol', + 'array_enum': 'array_enum' + } def __init__(self, just_symbol=None, array_enum=None): # noqa: E501 """EnumArrays - a model defined in OpenAPI""" # noqa: E501 @@ -65,7 +74,8 @@ class EnumArrays(object): if just_symbol not in allowed_values: raise ValueError( "Invalid value for `just_symbol` ({0}), must be one of {1}" # noqa: E501 - .format(just_symbol, allowed_values)) + .format(just_symbol, allowed_values) + ) self._just_symbol = just_symbol @@ -91,11 +101,9 @@ class EnumArrays(object): if not set(array_enum).issubset(set(allowed_values)): raise ValueError( "Invalid values for `array_enum` [{0}], must be a subset of [{1}]" # noqa: E501 - .format( - ", ".join(map( - str, - set(array_enum) - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values)))) + .format(", ".join(map(str, set(array_enum) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) self._array_enum = array_enum @@ -106,9 +114,10 @@ class EnumArrays(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/enum_class.py b/samples/client/petstore/python/petstore_api/models/enum_class.py index 7e7e40302a2..182197d8aa6 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_class.py +++ b/samples/client/petstore/python/petstore_api/models/enum_class.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,12 +22,14 @@ class EnumClass(object): Do not edit the class manually. """ + """ allowed enum values """ _ABC = "_abc" _EFG = "-efg" _XYZ_ = "(xyz)" + """ Attributes: openapi_types (dict): The key is attribute name @@ -33,9 +37,11 @@ class EnumClass(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {} + openapi_types = { + } - attribute_map = {} + attribute_map = { + } def __init__(self): # noqa: E501 """EnumClass - a model defined in OpenAPI""" # noqa: E501 @@ -48,9 +54,10 @@ class EnumClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/enum_test.py b/samples/client/petstore/python/petstore_api/models/enum_test.py index 4789af781b8..0fd60c4a351 100644 --- a/samples/client/petstore/python/petstore_api/models/enum_test.py +++ b/samples/client/petstore/python/petstore_api/models/enum_test.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class EnumTest(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -43,12 +46,7 @@ class EnumTest(object): 'outer_enum': 'outerEnum' } - def __init__(self, - enum_string=None, - enum_string_required=None, - enum_integer=None, - enum_number=None, - outer_enum=None): # noqa: E501 + def __init__(self, enum_string=None, enum_string_required=None, enum_integer=None, enum_number=None, outer_enum=None): # noqa: E501 """EnumTest - a model defined in OpenAPI""" # noqa: E501 self._enum_string = None @@ -90,7 +88,8 @@ class EnumTest(object): if enum_string not in allowed_values: raise ValueError( "Invalid value for `enum_string` ({0}), must be one of {1}" # noqa: E501 - .format(enum_string, allowed_values)) + .format(enum_string, allowed_values) + ) self._enum_string = enum_string @@ -113,14 +112,13 @@ class EnumTest(object): :type: str """ if enum_string_required is None: - raise ValueError( - "Invalid value for `enum_string_required`, must not be `None`" - ) # noqa: E501 + raise ValueError("Invalid value for `enum_string_required`, must not be `None`") # noqa: E501 allowed_values = ["UPPER", "lower", ""] # noqa: E501 if enum_string_required not in allowed_values: raise ValueError( "Invalid value for `enum_string_required` ({0}), must be one of {1}" # noqa: E501 - .format(enum_string_required, allowed_values)) + .format(enum_string_required, allowed_values) + ) self._enum_string_required = enum_string_required @@ -146,7 +144,8 @@ class EnumTest(object): if enum_integer not in allowed_values: raise ValueError( "Invalid value for `enum_integer` ({0}), must be one of {1}" # noqa: E501 - .format(enum_integer, allowed_values)) + .format(enum_integer, allowed_values) + ) self._enum_integer = enum_integer @@ -172,7 +171,8 @@ class EnumTest(object): if enum_number not in allowed_values: raise ValueError( "Invalid value for `enum_number` ({0}), must be one of {1}" # noqa: E501 - .format(enum_number, allowed_values)) + .format(enum_number, allowed_values) + ) self._enum_number = enum_number @@ -204,9 +204,10 @@ class EnumTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/file.py b/samples/client/petstore/python/petstore_api/models/file.py index 1172eea1381..34d77c3b4cf 100644 --- a/samples/client/petstore/python/petstore_api/models/file.py +++ b/samples/client/petstore/python/petstore_api/models/file.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class File(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class File(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'source_uri': 'str'} + openapi_types = { + 'source_uri': 'str' + } - attribute_map = {'source_uri': 'sourceURI'} + attribute_map = { + 'source_uri': 'sourceURI' + } def __init__(self, source_uri=None): # noqa: E501 """File - a model defined in OpenAPI""" # noqa: E501 @@ -70,9 +77,10 @@ class File(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py b/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py index 57079748cd6..026822dee74 100644 --- a/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py +++ b/samples/client/petstore/python/petstore_api/models/file_schema_test_class.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class FileSchemaTestClass(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,15 @@ class FileSchemaTestClass(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'file': 'File', 'files': 'list[File]'} + openapi_types = { + 'file': 'File', + 'files': 'list[File]' + } - attribute_map = {'file': 'file', 'files': 'files'} + attribute_map = { + 'file': 'file', + 'files': 'files' + } def __init__(self, file=None, files=None): # noqa: E501 """FileSchemaTestClass - a model defined in OpenAPI""" # noqa: E501 @@ -92,9 +101,10 @@ class FileSchemaTestClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/format_test.py b/samples/client/petstore/python/petstore_api/models/format_test.py index 0b25c4b271b..68c8953ee19 100644 --- a/samples/client/petstore/python/petstore_api/models/format_test.py +++ b/samples/client/petstore/python/petstore_api/models/format_test.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class FormatTest(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -59,20 +62,7 @@ class FormatTest(object): 'password': 'password' } - def __init__(self, - integer=None, - int32=None, - int64=None, - number=None, - float=None, - double=None, - string=None, - byte=None, - binary=None, - date=None, - date_time=None, - uuid=None, - password=None): # noqa: E501 + def __init__(self, integer=None, int32=None, int64=None, number=None, float=None, double=None, string=None, byte=None, binary=None, date=None, date_time=None, uuid=None, password=None): # noqa: E501 """FormatTest - a model defined in OpenAPI""" # noqa: E501 self._integer = None @@ -132,13 +122,9 @@ class FormatTest(object): :type: int """ if integer is not None and integer > 100: # noqa: E501 - raise ValueError( - "Invalid value for `integer`, must be a value less than or equal to `100`" - ) # noqa: E501 + raise ValueError("Invalid value for `integer`, must be a value less than or equal to `100`") # noqa: E501 if integer is not None and integer < 10: # noqa: E501 - raise ValueError( - "Invalid value for `integer`, must be a value greater than or equal to `10`" - ) # noqa: E501 + raise ValueError("Invalid value for `integer`, must be a value greater than or equal to `10`") # noqa: E501 self._integer = integer @@ -161,13 +147,9 @@ class FormatTest(object): :type: int """ if int32 is not None and int32 > 200: # noqa: E501 - raise ValueError( - "Invalid value for `int32`, must be a value less than or equal to `200`" - ) # noqa: E501 + raise ValueError("Invalid value for `int32`, must be a value less than or equal to `200`") # noqa: E501 if int32 is not None and int32 < 20: # noqa: E501 - raise ValueError( - "Invalid value for `int32`, must be a value greater than or equal to `20`" - ) # noqa: E501 + raise ValueError("Invalid value for `int32`, must be a value greater than or equal to `20`") # noqa: E501 self._int32 = int32 @@ -211,16 +193,11 @@ class FormatTest(object): :type: float """ if number is None: - raise ValueError( - "Invalid value for `number`, must not be `None`") # noqa: E501 + raise ValueError("Invalid value for `number`, must not be `None`") # noqa: E501 if number is not None and number > 543.2: # noqa: E501 - raise ValueError( - "Invalid value for `number`, must be a value less than or equal to `543.2`" - ) # noqa: E501 + raise ValueError("Invalid value for `number`, must be a value less than or equal to `543.2`") # noqa: E501 if number is not None and number < 32.1: # noqa: E501 - raise ValueError( - "Invalid value for `number`, must be a value greater than or equal to `32.1`" - ) # noqa: E501 + raise ValueError("Invalid value for `number`, must be a value greater than or equal to `32.1`") # noqa: E501 self._number = number @@ -243,13 +220,9 @@ class FormatTest(object): :type: float """ if float is not None and float > 987.6: # noqa: E501 - raise ValueError( - "Invalid value for `float`, must be a value less than or equal to `987.6`" - ) # noqa: E501 + raise ValueError("Invalid value for `float`, must be a value less than or equal to `987.6`") # noqa: E501 if float is not None and float < 54.3: # noqa: E501 - raise ValueError( - "Invalid value for `float`, must be a value greater than or equal to `54.3`" - ) # noqa: E501 + raise ValueError("Invalid value for `float`, must be a value greater than or equal to `54.3`") # noqa: E501 self._float = float @@ -272,13 +245,9 @@ class FormatTest(object): :type: float """ if double is not None and double > 123.4: # noqa: E501 - raise ValueError( - "Invalid value for `double`, must be a value less than or equal to `123.4`" - ) # noqa: E501 + raise ValueError("Invalid value for `double`, must be a value less than or equal to `123.4`") # noqa: E501 if double is not None and double < 67.8: # noqa: E501 - raise ValueError( - "Invalid value for `double`, must be a value greater than or equal to `67.8`" - ) # noqa: E501 + raise ValueError("Invalid value for `double`, must be a value greater than or equal to `67.8`") # noqa: E501 self._double = double @@ -300,11 +269,8 @@ class FormatTest(object): :param string: The string of this FormatTest. # noqa: E501 :type: str """ - if string is not None and not re.search( - '[a-z]', string, flags=re.IGNORECASE): # noqa: E501 - raise ValueError( - "Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`" - ) # noqa: E501 + if string is not None and not re.search('[a-z]', string, flags=re.IGNORECASE): # noqa: E501 + raise ValueError("Invalid value for `string`, must be a follow pattern or equal to `/[a-z]/i`") # noqa: E501 self._string = string @@ -327,14 +293,9 @@ class FormatTest(object): :type: str """ if byte is None: - raise ValueError( - "Invalid value for `byte`, must not be `None`") # noqa: E501 - if byte is not None and not re.search( - '^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', - byte): # noqa: E501 - raise ValueError( - "Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`" - ) # noqa: E501 + raise ValueError("Invalid value for `byte`, must not be `None`") # noqa: E501 + if byte is not None and not re.search('^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$', byte): # noqa: E501 + raise ValueError("Invalid value for `byte`, must be a follow pattern or equal to `/^(?:[A-Za-z0-9+\/]{4})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/`") # noqa: E501 self._byte = byte @@ -378,8 +339,7 @@ class FormatTest(object): :type: date """ if date is None: - raise ValueError( - "Invalid value for `date`, must not be `None`") # noqa: E501 + raise ValueError("Invalid value for `date`, must not be `None`") # noqa: E501 self._date = date @@ -444,16 +404,11 @@ class FormatTest(object): :type: str """ if password is None: - raise ValueError("Invalid value for `password`, must not be `None`" - ) # noqa: E501 + raise ValueError("Invalid value for `password`, must not be `None`") # noqa: E501 if password is not None and len(password) > 64: - raise ValueError( - "Invalid value for `password`, length must be less than or equal to `64`" - ) # noqa: E501 + raise ValueError("Invalid value for `password`, length must be less than or equal to `64`") # noqa: E501 if password is not None and len(password) < 10: - raise ValueError( - "Invalid value for `password`, length must be greater than or equal to `10`" - ) # noqa: E501 + raise ValueError("Invalid value for `password`, length must be greater than or equal to `10`") # noqa: E501 self._password = password @@ -464,9 +419,10 @@ class FormatTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/has_only_read_only.py b/samples/client/petstore/python/petstore_api/models/has_only_read_only.py index 5ce28ac0570..41db3ff7195 100644 --- a/samples/client/petstore/python/petstore_api/models/has_only_read_only.py +++ b/samples/client/petstore/python/petstore_api/models/has_only_read_only.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class HasOnlyReadOnly(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,15 @@ class HasOnlyReadOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'bar': 'str', 'foo': 'str'} + openapi_types = { + 'bar': 'str', + 'foo': 'str' + } - attribute_map = {'bar': 'bar', 'foo': 'foo'} + attribute_map = { + 'bar': 'bar', + 'foo': 'foo' + } def __init__(self, bar=None, foo=None): # noqa: E501 """HasOnlyReadOnly - a model defined in OpenAPI""" # noqa: E501 @@ -92,9 +101,10 @@ class HasOnlyReadOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/list.py b/samples/client/petstore/python/petstore_api/models/list.py index 9757c960b4a..08e12ad5310 100644 --- a/samples/client/petstore/python/petstore_api/models/list.py +++ b/samples/client/petstore/python/petstore_api/models/list.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class List(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class List(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'_123_list': 'str'} + openapi_types = { + '_123_list': 'str' + } - attribute_map = {'_123_list': '123-list'} + attribute_map = { + '_123_list': '123-list' + } def __init__(self, _123_list=None): # noqa: E501 """List - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class List(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/map_test.py b/samples/client/petstore/python/petstore_api/models/map_test.py index 10295f5790e..f04bd2cc142 100644 --- a/samples/client/petstore/python/petstore_api/models/map_test.py +++ b/samples/client/petstore/python/petstore_api/models/map_test.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class MapTest(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -41,11 +44,7 @@ class MapTest(object): 'indirect_map': 'indirect_map' } - def __init__(self, - map_map_of_string=None, - map_of_enum_string=None, - direct_map=None, - indirect_map=None): # noqa: E501 + def __init__(self, map_map_of_string=None, map_of_enum_string=None, direct_map=None, indirect_map=None): # noqa: E501 """MapTest - a model defined in OpenAPI""" # noqa: E501 self._map_map_of_string = None @@ -106,13 +105,9 @@ class MapTest(object): if not set(map_of_enum_string.keys()).issubset(set(allowed_values)): raise ValueError( "Invalid keys in `map_of_enum_string` [{0}], must be a subset of [{1}]" # noqa: E501 - .format( - ", ".join( - map( - str, - set(map_of_enum_string.keys()) - - set(allowed_values))), # noqa: E501 - ", ".join(map(str, allowed_values)))) + .format(", ".join(map(str, set(map_of_enum_string.keys()) - set(allowed_values))), # noqa: E501 + ", ".join(map(str, allowed_values))) + ) self._map_of_enum_string = map_of_enum_string @@ -165,9 +160,10 @@ class MapTest(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py index ecc53b139d0..ecf67acc5e9 100644 --- a/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py +++ b/samples/client/petstore/python/petstore_api/models/mixed_properties_and_additional_properties_class.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -33,7 +36,11 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): 'map': 'dict(str, Animal)' } - attribute_map = {'uuid': 'uuid', 'date_time': 'dateTime', 'map': 'map'} + attribute_map = { + 'uuid': 'uuid', + 'date_time': 'dateTime', + 'map': 'map' + } def __init__(self, uuid=None, date_time=None, map=None): # noqa: E501 """MixedPropertiesAndAdditionalPropertiesClass - a model defined in OpenAPI""" # noqa: E501 @@ -120,9 +127,10 @@ class MixedPropertiesAndAdditionalPropertiesClass(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/model200_response.py b/samples/client/petstore/python/petstore_api/models/model200_response.py index bc4920e3cad..ec778cdcb74 100644 --- a/samples/client/petstore/python/petstore_api/models/model200_response.py +++ b/samples/client/petstore/python/petstore_api/models/model200_response.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Model200Response(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,15 @@ class Model200Response(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'name': 'int', '_class': 'str'} + openapi_types = { + 'name': 'int', + '_class': 'str' + } - attribute_map = {'name': 'name', '_class': 'class'} + attribute_map = { + 'name': 'name', + '_class': 'class' + } def __init__(self, name=None, _class=None): # noqa: E501 """Model200Response - a model defined in OpenAPI""" # noqa: E501 @@ -92,9 +101,10 @@ class Model200Response(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/model_return.py b/samples/client/petstore/python/petstore_api/models/model_return.py index d54b3f5775f..3862245ef71 100644 --- a/samples/client/petstore/python/petstore_api/models/model_return.py +++ b/samples/client/petstore/python/petstore_api/models/model_return.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class ModelReturn(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class ModelReturn(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'_return': 'int'} + openapi_types = { + '_return': 'int' + } - attribute_map = {'_return': 'return'} + attribute_map = { + '_return': 'return' + } def __init__(self, _return=None): # noqa: E501 """ModelReturn - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class ModelReturn(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/name.py b/samples/client/petstore/python/petstore_api/models/name.py index e99ccefa613..b2e97e596a4 100644 --- a/samples/client/petstore/python/petstore_api/models/name.py +++ b/samples/client/petstore/python/petstore_api/models/name.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Name(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -41,11 +44,7 @@ class Name(object): '_123_number': '123Number' } - def __init__(self, - name=None, - snake_case=None, - _property=None, - _123_number=None): # noqa: E501 + def __init__(self, name=None, snake_case=None, _property=None, _123_number=None): # noqa: E501 """Name - a model defined in OpenAPI""" # noqa: E501 self._name = None @@ -81,8 +80,7 @@ class Name(object): :type: int """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`") # noqa: E501 + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -156,9 +154,10 @@ class Name(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/number_only.py b/samples/client/petstore/python/petstore_api/models/number_only.py index 8144dceca0e..ab39ee8195d 100644 --- a/samples/client/petstore/python/petstore_api/models/number_only.py +++ b/samples/client/petstore/python/petstore_api/models/number_only.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class NumberOnly(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class NumberOnly(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'just_number': 'float'} + openapi_types = { + 'just_number': 'float' + } - attribute_map = {'just_number': 'JustNumber'} + attribute_map = { + 'just_number': 'JustNumber' + } def __init__(self, just_number=None): # noqa: E501 """NumberOnly - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class NumberOnly(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/order.py b/samples/client/petstore/python/petstore_api/models/order.py index 6aaed05966f..697d84447cd 100644 --- a/samples/client/petstore/python/petstore_api/models/order.py +++ b/samples/client/petstore/python/petstore_api/models/order.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Order(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -45,13 +48,7 @@ class Order(object): 'complete': 'complete' } - def __init__(self, - id=None, - pet_id=None, - quantity=None, - ship_date=None, - status=None, - complete=False): # noqa: E501 + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501 """Order - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -183,7 +180,8 @@ class Order(object): if status not in allowed_values: raise ValueError( "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 - .format(status, allowed_values)) + .format(status, allowed_values) + ) self._status = status @@ -215,9 +213,10 @@ class Order(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/outer_composite.py b/samples/client/petstore/python/petstore_api/models/outer_composite.py index 03246b6af73..b22b16c6fdc 100644 --- a/samples/client/petstore/python/petstore_api/models/outer_composite.py +++ b/samples/client/petstore/python/petstore_api/models/outer_composite.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class OuterComposite(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -39,8 +42,7 @@ class OuterComposite(object): 'my_boolean': 'my_boolean' } - def __init__(self, my_number=None, my_string=None, - my_boolean=None): # noqa: E501 + def __init__(self, my_number=None, my_string=None, my_boolean=None): # noqa: E501 """OuterComposite - a model defined in OpenAPI""" # noqa: E501 self._my_number = None @@ -125,9 +127,10 @@ class OuterComposite(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/outer_enum.py b/samples/client/petstore/python/petstore_api/models/outer_enum.py index 3d64982b023..10d6be19a4c 100644 --- a/samples/client/petstore/python/petstore_api/models/outer_enum.py +++ b/samples/client/petstore/python/petstore_api/models/outer_enum.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,12 +22,14 @@ class OuterEnum(object): Do not edit the class manually. """ + """ allowed enum values """ PLACED = "placed" APPROVED = "approved" DELIVERED = "delivered" + """ Attributes: openapi_types (dict): The key is attribute name @@ -33,9 +37,11 @@ class OuterEnum(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {} + openapi_types = { + } - attribute_map = {} + attribute_map = { + } def __init__(self): # noqa: E501 """OuterEnum - a model defined in OpenAPI""" # noqa: E501 @@ -48,9 +54,10 @@ class OuterEnum(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/pet.py b/samples/client/petstore/python/petstore_api/models/pet.py index fc530e7d78c..d3c412f4a82 100644 --- a/samples/client/petstore/python/petstore_api/models/pet.py +++ b/samples/client/petstore/python/petstore_api/models/pet.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Pet(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -45,13 +48,7 @@ class Pet(object): 'status': 'status' } - def __init__(self, - id=None, - category=None, - name=None, - photo_urls=None, - tags=None, - status=None): # noqa: E501 + def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501 """Pet - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -134,8 +131,7 @@ class Pet(object): :type: str """ if name is None: - raise ValueError( - "Invalid value for `name`, must not be `None`") # noqa: E501 + raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 self._name = name @@ -158,9 +154,7 @@ class Pet(object): :type: list[str] """ if photo_urls is None: - raise ValueError( - "Invalid value for `photo_urls`, must not be `None`" - ) # noqa: E501 + raise ValueError("Invalid value for `photo_urls`, must not be `None`") # noqa: E501 self._photo_urls = photo_urls @@ -209,7 +203,8 @@ class Pet(object): if status not in allowed_values: raise ValueError( "Invalid value for `status` ({0}), must be one of {1}" # noqa: E501 - .format(status, allowed_values)) + .format(status, allowed_values) + ) self._status = status @@ -220,9 +215,10 @@ class Pet(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/read_only_first.py b/samples/client/petstore/python/petstore_api/models/read_only_first.py index 513fdbb20eb..2b257be18de 100644 --- a/samples/client/petstore/python/petstore_api/models/read_only_first.py +++ b/samples/client/petstore/python/petstore_api/models/read_only_first.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class ReadOnlyFirst(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,15 @@ class ReadOnlyFirst(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'bar': 'str', 'baz': 'str'} + openapi_types = { + 'bar': 'str', + 'baz': 'str' + } - attribute_map = {'bar': 'bar', 'baz': 'baz'} + attribute_map = { + 'bar': 'bar', + 'baz': 'baz' + } def __init__(self, bar=None, baz=None): # noqa: E501 """ReadOnlyFirst - a model defined in OpenAPI""" # noqa: E501 @@ -92,9 +101,10 @@ class ReadOnlyFirst(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/special_model_name.py b/samples/client/petstore/python/petstore_api/models/special_model_name.py index 6f0cbb35edd..fa59b887471 100644 --- a/samples/client/petstore/python/petstore_api/models/special_model_name.py +++ b/samples/client/petstore/python/petstore_api/models/special_model_name.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class SpecialModelName(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,13 @@ class SpecialModelName(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'special_property_name': 'int'} + openapi_types = { + 'special_property_name': 'int' + } - attribute_map = {'special_property_name': '$special[property.name]'} + attribute_map = { + 'special_property_name': '$special[property.name]' + } def __init__(self, special_property_name=None): # noqa: E501 """SpecialModelName - a model defined in OpenAPI""" # noqa: E501 @@ -68,9 +75,10 @@ class SpecialModelName(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/string_boolean_map.py b/samples/client/petstore/python/petstore_api/models/string_boolean_map.py index 83f46b35820..e837adf6195 100644 --- a/samples/client/petstore/python/petstore_api/models/string_boolean_map.py +++ b/samples/client/petstore/python/petstore_api/models/string_boolean_map.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class StringBooleanMap(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,11 @@ class StringBooleanMap(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {} + openapi_types = { + } - attribute_map = {} + attribute_map = { + } def __init__(self): # noqa: E501 """StringBooleanMap - a model defined in OpenAPI""" # noqa: E501 @@ -42,9 +47,10 @@ class StringBooleanMap(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/tag.py b/samples/client/petstore/python/petstore_api/models/tag.py index fb343184f27..8fcc8a84866 100644 --- a/samples/client/petstore/python/petstore_api/models/tag.py +++ b/samples/client/petstore/python/petstore_api/models/tag.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class Tag(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -27,9 +30,15 @@ class Tag(object): attribute_map (dict): The key is attribute name and the value is json key in definition. """ - openapi_types = {'id': 'int', 'name': 'str'} + openapi_types = { + 'id': 'int', + 'name': 'str' + } - attribute_map = {'id': 'id', 'name': 'name'} + attribute_map = { + 'id': 'id', + 'name': 'name' + } def __init__(self, id=None, name=None): # noqa: E501 """Tag - a model defined in OpenAPI""" # noqa: E501 @@ -92,9 +101,10 @@ class Tag(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/models/user.py b/samples/client/petstore/python/petstore_api/models/user.py index 95e8dff756a..9736c47c1f8 100644 --- a/samples/client/petstore/python/petstore_api/models/user.py +++ b/samples/client/petstore/python/petstore_api/models/user.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + import pprint import re # noqa: F401 @@ -20,6 +22,7 @@ class User(object): Do not edit the class manually. """ + """ Attributes: openapi_types (dict): The key is attribute name @@ -49,15 +52,7 @@ class User(object): 'user_status': 'userStatus' } - def __init__(self, - id=None, - username=None, - first_name=None, - last_name=None, - email=None, - password=None, - phone=None, - user_status=None): # noqa: E501 + def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501 """User - a model defined in OpenAPI""" # noqa: E501 self._id = None @@ -264,9 +259,10 @@ class User(object): for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) if isinstance(value, list): - result[attr] = list( - map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value)) + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index 6922a7a3cc3..30ba5fb8d3f 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from __future__ import absolute_import import io @@ -26,10 +28,12 @@ try: except ImportError: raise ImportError('OpenAPI Python client requires urllib3.') + logger = logging.getLogger(__name__) class RESTResponse(io.IOBase): + def __init__(self, resp): self.urllib3_response = resp self.status = resp.status @@ -46,6 +50,7 @@ class RESTResponse(io.IOBase): class RESTClientObject(object): + def __init__(self, configuration, pools_size=4, maxsize=None): # urllib3.PoolManager will pass all kw parameters to connectionpool # https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501 @@ -68,8 +73,7 @@ class RESTClientObject(object): addition_pool_args = {} if configuration.assert_hostname is not None: - addition_pool_args[ - 'assert_hostname'] = configuration.assert_hostname # noqa: E501 + addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501 if maxsize is None: if configuration.connection_pool_maxsize is not None: @@ -87,7 +91,8 @@ class RESTClientObject(object): cert_file=configuration.cert_file, key_file=configuration.key_file, proxy_url=configuration.proxy, - **addition_pool_args) + **addition_pool_args + ) else: self.pool_manager = urllib3.PoolManager( num_pools=pools_size, @@ -96,16 +101,11 @@ class RESTClientObject(object): ca_certs=ca_certs, cert_file=configuration.cert_file, key_file=configuration.key_file, - **addition_pool_args) - - def request(self, - method, - url, - query_params=None, - headers=None, - body=None, - post_params=None, - _preload_content=True, + **addition_pool_args + ) + + def request(self, method, url, query_params=None, headers=None, + body=None, post_params=None, _preload_content=True, _request_timeout=None): """Perform requests. @@ -126,24 +126,23 @@ class RESTClientObject(object): (connection, read) timeouts. """ method = method.upper() - assert method in [ - 'GET', 'HEAD', 'DELETE', 'POST', 'PUT', 'PATCH', 'OPTIONS' - ] + assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT', + 'PATCH', 'OPTIONS'] if post_params and body: raise ValueError( - "body parameter cannot be used with post_params parameter.") + "body parameter cannot be used with post_params parameter." + ) post_params = post_params or {} headers = headers or {} timeout = None if _request_timeout: - if isinstance(_request_timeout, (int, ) if six.PY3 else - (int, long)): # noqa: E501,F821 + if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821 timeout = urllib3.Timeout(total=_request_timeout) - elif (isinstance(_request_timeout, tuple) - and len(_request_timeout) == 2): + elif (isinstance(_request_timeout, tuple) and + len(_request_timeout) == 2): timeout = urllib3.Timeout( connect=_request_timeout[0], read=_request_timeout[1]) @@ -160,17 +159,14 @@ class RESTClientObject(object): if body is not None: request_body = json.dumps(body) r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, headers=headers) - elif headers[ - 'Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501 r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=False, preload_content=_preload_content, @@ -182,8 +178,7 @@ class RESTClientObject(object): # overwritten. del headers['Content-Type'] r = self.pool_manager.request( - method, - url, + method, url, fields=post_params, encode_multipart=True, preload_content=_preload_content, @@ -195,8 +190,7 @@ class RESTClientObject(object): elif isinstance(body, str): request_body = body r = self.pool_manager.request( - method, - url, + method, url, body=request_body, preload_content=_preload_content, timeout=timeout, @@ -209,13 +203,11 @@ class RESTClientObject(object): raise ApiException(status=0, reason=msg) # For `GET`, `HEAD` else: - r = self.pool_manager.request( - method, - url, - fields=query_params, - preload_content=_preload_content, - timeout=timeout, - headers=headers) + r = self.pool_manager.request(method, url, + fields=query_params, + preload_content=_preload_content, + timeout=timeout, + headers=headers) except urllib3.exceptions.SSLError as e: msg = "{0}\n{1}".format(type(e).__name__, str(e)) raise ApiException(status=0, reason=msg) @@ -236,124 +228,74 @@ class RESTClientObject(object): return r - def GET(self, - url, - headers=None, - query_params=None, - _preload_content=True, + def GET(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): - return self.request( - "GET", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def HEAD(self, - url, - headers=None, - query_params=None, - _preload_content=True, - _request_timeout=None): - return self.request( - "HEAD", - url, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - query_params=query_params) - - def OPTIONS(self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None): - return self.request( - "OPTIONS", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def DELETE(self, - url, - headers=None, - query_params=None, - body=None, - _preload_content=True, - _request_timeout=None): - return self.request( - "DELETE", - url, - headers=headers, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def POST(self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, + return self.request("GET", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def HEAD(self, url, headers=None, query_params=None, _preload_content=True, _request_timeout=None): - return self.request( - "POST", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PUT(self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None): - return self.request( - "PUT", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - - def PATCH(self, - url, - headers=None, - query_params=None, - post_params=None, - body=None, - _preload_content=True, - _request_timeout=None): - return self.request( - "PATCH", - url, - headers=headers, - query_params=query_params, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.request("HEAD", url, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + query_params=query_params) + + def OPTIONS(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("OPTIONS", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def DELETE(self, url, headers=None, query_params=None, body=None, + _preload_content=True, _request_timeout=None): + return self.request("DELETE", url, + headers=headers, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def POST(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("POST", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PUT(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PUT", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) + + def PATCH(self, url, headers=None, query_params=None, post_params=None, + body=None, _preload_content=True, _request_timeout=None): + return self.request("PATCH", url, + headers=headers, + query_params=query_params, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body) class ApiException(Exception): + def __init__(self, status=None, reason=None, http_resp=None): if http_resp: self.status = http_resp.status diff --git a/samples/client/petstore/python/setup.py b/samples/client/petstore/python/setup.py index 0d534f6768d..3cfa069e204 100644 --- a/samples/client/petstore/python/setup.py +++ b/samples/client/petstore/python/setup.py @@ -1,4 +1,5 @@ # coding: utf-8 + """ OpenAPI Petstore @@ -8,6 +9,7 @@ Generated by: https://openapi-generator.tech """ + from setuptools import setup, find_packages # noqa: H301 NAME = "petstore-api" @@ -33,4 +35,5 @@ setup( include_package_data=True, long_description="""\ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501 - """) + """ +) -- GitLab