python: several typing and style improvements (#16378)

* python: several typing and style improvements

The generated (python) code fails with several standard validation tools,
including `flake8`, `mypy`, and `autoflake`. While fixing every possible
violation -- especially wrto typing -- woudl be a project, some of the
changes are fairly easy.

 - The `autoflake` tool picks up on unused imports. These can just be removed.

 - The `mypy` tool picks up on numerious typing violations, especially if set
   to its strictest mode. As a starting point, all functions ought to annotate
   a return type, including constructors, even if the return type is `None`
   because otherwise the functions are omitted from type checking and it's
   impossible to make incremental progress towards adding types.

 - The `flake8` tool mostly finds whitespace and line-length issues; while
   line-length standards very, the source already includes several flake8
   ignores, so it seems safe to add a few more.

* Add generated files

* Restore imports used by `AbstractPythonCodegen.java`

* Update generated files
This commit is contained in:
jessemyers-lettuce
2023-09-01 10:03:02 -07:00
committed by GitHub
parent c0abeceb85
commit 40731ed52d
61 changed files with 910 additions and 807 deletions

View File

@@ -35,14 +35,14 @@ from openapi_client.exceptions import ( # noqa: F401
)
class BodyApi(object):
class BodyApi:
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
def __init__(self, api_client=None) -> None:
if api_client is None:
api_client = ApiClient.get_default()
self.api_client = api_client
@@ -60,10 +60,10 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -71,7 +71,8 @@ class BodyApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_binary_gif_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_binary_gif_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_binary_gif_with_http_info(**kwargs) # noqa: E501
@validate_arguments
@@ -88,7 +89,7 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -193,10 +194,10 @@ class BodyApi(object):
:type body: bytearray
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -204,7 +205,8 @@ class BodyApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_body_application_octetstream_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_body_application_octetstream_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_body_application_octetstream_binary_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
@@ -223,7 +225,7 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -344,10 +346,10 @@ class BodyApi(object):
:type files: List[bytearray]
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -355,7 +357,8 @@ class BodyApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_body_multipart_formdata_array_of_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_body_multipart_formdata_array_of_binary_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_body_multipart_formdata_array_of_binary_with_http_info(files, **kwargs) # noqa: E501
@validate_arguments
@@ -374,7 +377,7 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -491,10 +494,10 @@ class BodyApi(object):
:type body: object
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -502,7 +505,8 @@ class BodyApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_echo_body_free_form_object_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_echo_body_free_form_object_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_echo_body_free_form_object_response_string_with_http_info(body, **kwargs) # noqa: E501
@validate_arguments
@@ -521,7 +525,7 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -637,10 +641,10 @@ class BodyApi(object):
:type pet: Pet
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -648,7 +652,8 @@ class BodyApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_echo_body_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_echo_body_pet_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_echo_body_pet_with_http_info(pet, **kwargs) # noqa: E501
@validate_arguments
@@ -667,7 +672,7 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -783,10 +788,10 @@ class BodyApi(object):
:type pet: Pet
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -794,7 +799,8 @@ class BodyApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_echo_body_pet_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_echo_body_pet_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_echo_body_pet_response_string_with_http_info(pet, **kwargs) # noqa: E501
@validate_arguments
@@ -813,7 +819,7 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -929,10 +935,10 @@ class BodyApi(object):
:type tag: Tag
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -940,7 +946,8 @@ class BodyApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_echo_body_tag_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_echo_body_tag_response_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_echo_body_tag_response_string_with_http_info(tag, **kwargs) # noqa: E501
@validate_arguments
@@ -959,7 +966,7 @@ class BodyApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional

View File

@@ -33,14 +33,14 @@ from openapi_client.exceptions import ( # noqa: F401
)
class FormApi(object):
class FormApi:
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
def __init__(self, api_client=None) -> None:
if api_client is None:
api_client = ApiClient.get_default()
self.api_client = api_client
@@ -64,10 +64,10 @@ class FormApi(object):
:type string_form: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -75,7 +75,8 @@ class FormApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_form_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_form_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_form_integer_boolean_string_with_http_info(integer_form, boolean_form, string_form, **kwargs) # noqa: E501
@validate_arguments
@@ -98,7 +99,7 @@ class FormApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional

View File

@@ -33,14 +33,14 @@ from openapi_client.exceptions import ( # noqa: F401
)
class HeaderApi(object):
class HeaderApi:
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
def __init__(self, api_client=None) -> None:
if api_client is None:
api_client = ApiClient.get_default()
self.api_client = api_client
@@ -64,10 +64,10 @@ class HeaderApi(object):
:type string_header: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -75,7 +75,8 @@ class HeaderApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_header_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_header_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_header_integer_boolean_string_with_http_info(integer_header, boolean_header, string_header, **kwargs) # noqa: E501
@validate_arguments
@@ -98,7 +99,7 @@ class HeaderApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional

View File

@@ -31,14 +31,14 @@ from openapi_client.exceptions import ( # noqa: F401
)
class PathApi(object):
class PathApi:
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
def __init__(self, api_client=None) -> None:
if api_client is None:
api_client = ApiClient.get_default()
self.api_client = api_client
@@ -60,10 +60,10 @@ class PathApi(object):
:type path_integer: int
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -71,7 +71,8 @@ class PathApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the tests_path_string_path_string_integer_path_integer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the tests_path_string_path_string_integer_path_integer_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.tests_path_string_path_string_integer_path_integer_with_http_info(path_string, path_integer, **kwargs) # noqa: E501
@validate_arguments
@@ -92,7 +93,7 @@ class PathApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional

View File

@@ -38,14 +38,14 @@ from openapi_client.exceptions import ( # noqa: F401
)
class QueryApi(object):
class QueryApi:
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
def __init__(self, api_client=None) -> None:
if api_client is None:
api_client = ApiClient.get_default()
self.api_client = api_client
@@ -65,10 +65,10 @@ class QueryApi(object):
:type enum_ref_string_query: StringEnumRef
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -76,7 +76,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_enum_ref_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_enum_ref_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_enum_ref_string_with_http_info(enum_ref_string_query, **kwargs) # noqa: E501
@validate_arguments
@@ -95,7 +96,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -208,10 +209,10 @@ class QueryApi(object):
:type string_query: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -219,7 +220,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_query_datetime_date_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_query_datetime_date_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_query_datetime_date_string_with_http_info(datetime_query, date_query, string_query, **kwargs) # noqa: E501
@validate_arguments
@@ -242,7 +244,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -369,10 +371,10 @@ class QueryApi(object):
:type string_query: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -380,7 +382,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_query_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_query_integer_boolean_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_query_integer_boolean_string_with_http_info(integer_query, boolean_query, string_query, **kwargs) # noqa: E501
@validate_arguments
@@ -403,7 +406,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -520,10 +523,10 @@ class QueryApi(object):
:type query_object: Pet
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -531,7 +534,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_query_style_deep_object_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_query_style_deep_object_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_query_style_deep_object_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
@@ -550,7 +554,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -659,10 +663,10 @@ class QueryApi(object):
:type query_object: TestQueryStyleDeepObjectExplodeTrueObjectAllOfQueryObjectParameter
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -670,7 +674,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_query_style_deep_object_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_query_style_deep_object_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_query_style_deep_object_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
@@ -689,7 +694,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -798,10 +803,10 @@ class QueryApi(object):
:type query_object: TestQueryStyleFormExplodeTrueArrayStringQueryObjectParameter
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -809,7 +814,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_query_style_form_explode_true_array_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_query_style_form_explode_true_array_string_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_query_style_form_explode_true_array_string_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
@@ -828,7 +834,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -937,10 +943,10 @@ class QueryApi(object):
:type query_object: Pet
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -948,7 +954,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_query_style_form_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_query_style_form_explode_true_object_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_query_style_form_explode_true_object_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
@@ -967,7 +974,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional
@@ -1076,10 +1083,10 @@ class QueryApi(object):
:type query_object: DataQuery
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_timeout: timeout setting for this request.
If one number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
@@ -1087,7 +1094,8 @@ class QueryApi(object):
"""
kwargs['_return_http_data_only'] = True
if '_preload_content' in kwargs:
raise ValueError("Error! Please call the test_query_style_form_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data")
message = "Error! Please call the test_query_style_form_explode_true_object_all_of_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501
raise ValueError(message)
return self.test_query_style_form_explode_true_object_all_of_with_http_info(query_object, **kwargs) # noqa: E501
@validate_arguments
@@ -1106,7 +1114,7 @@ class QueryApi(object):
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the ApiResponse.data will
be set to none and raw_data will store the
be set to none and raw_data will store the
HTTP response body without reading/decoding.
Default is True.
:type _preload_content: bool, optional

View File

@@ -32,7 +32,7 @@ from openapi_client import rest
from openapi_client.exceptions import ApiValueError, ApiException
class ApiClient(object):
class ApiClient:
"""Generic API client for OpenAPI client library builds.
OpenAPI generic API client. This client handles the client-
@@ -64,7 +64,7 @@ class ApiClient(object):
_pool = None
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None, pool_threads=1):
cookie=None, pool_threads=1) -> None:
# use default configuration if none is provided
if configuration is None:
configuration = Configuration.get_default()
@@ -330,7 +330,7 @@ class ApiClient(object):
if data is None:
return None
if type(klass) == str:
if isinstance(klass, str):
if klass.startswith('List['):
sub_kls = re.match(r'List\[(.*)]', klass).group(1)
return [self.__deserialize(sub_data, sub_kls)

View File

@@ -18,7 +18,7 @@ class ApiResponse:
status_code=None,
headers=None,
data=None,
raw_data=None):
raw_data=None) -> None:
self.status_code = status_code
self.headers = headers
self.data = data

View File

@@ -20,7 +20,6 @@ import sys
import urllib3
import http.client as httplib
from openapi_client.exceptions import ApiValueError
JSON_SCHEMA_VALIDATION_KEYWORDS = {
'multipleOf', 'maximum', 'exclusiveMaximum',
@@ -28,7 +27,7 @@ JSON_SCHEMA_VALIDATION_KEYWORDS = {
'minLength', 'pattern', 'maxItems', 'minItems'
}
class Configuration(object):
class Configuration:
"""This class contains various settings of the API client.
:param host: Base url.
@@ -50,7 +49,8 @@ class Configuration(object):
configuration.
:param server_operation_variables: Mapping from operation ID to a mapping with
string values to replace variables in templated server configuration.
The validation of enums is performed for variables with defined enum values before.
The validation of enums is performed for variables with defined enum
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
@@ -65,7 +65,7 @@ class Configuration(object):
server_index=None, server_variables=None,
server_operation_index=None, server_operation_variables=None,
ssl_ca_cert=None,
):
) -> None:
"""Constructor
"""
self._base_path = "http://localhost:3000" if host is None else host

View File

@@ -19,7 +19,7 @@ class OpenApiException(Exception):
class ApiTypeError(OpenApiException, TypeError):
def __init__(self, msg, path_to_item=None, valid_classes=None,
key_type=None):
key_type=None) -> None:
""" Raises an exception for TypeErrors
Args:
@@ -47,7 +47,7 @@ class ApiTypeError(OpenApiException, TypeError):
class ApiValueError(OpenApiException, ValueError):
def __init__(self, msg, path_to_item=None):
def __init__(self, msg, path_to_item=None) -> None:
"""
Args:
msg (str): the exception message
@@ -65,7 +65,7 @@ class ApiValueError(OpenApiException, ValueError):
class ApiAttributeError(OpenApiException, AttributeError):
def __init__(self, msg, path_to_item=None):
def __init__(self, msg, path_to_item=None) -> None:
"""
Raised when an attribute reference or assignment fails.
@@ -84,7 +84,7 @@ class ApiAttributeError(OpenApiException, AttributeError):
class ApiKeyError(OpenApiException, KeyError):
def __init__(self, msg, path_to_item=None):
def __init__(self, msg, path_to_item=None) -> None:
"""
Args:
msg (str): the exception message
@@ -102,7 +102,7 @@ class ApiKeyError(OpenApiException, KeyError):
class ApiException(OpenApiException):
def __init__(self, status=None, reason=None, http_resp=None):
def __init__(self, status=None, reason=None, http_resp=None) -> None:
if http_resp:
self.status = http_resp.status
self.reason = http_resp.reason
@@ -129,30 +129,30 @@ class ApiException(OpenApiException):
class BadRequestException(ApiException):
def __init__(self, status=None, reason=None, http_resp=None):
def __init__(self, status=None, reason=None, http_resp=None) -> None:
super(BadRequestException, self).__init__(status, reason, http_resp)
class NotFoundException(ApiException):
def __init__(self, status=None, reason=None, http_resp=None):
def __init__(self, status=None, reason=None, http_resp=None) -> None:
super(NotFoundException, self).__init__(status, reason, http_resp)
class UnauthorizedException(ApiException):
def __init__(self, status=None, reason=None, http_resp=None):
def __init__(self, status=None, reason=None, http_resp=None) -> None:
super(UnauthorizedException, self).__init__(status, reason, http_resp)
class ForbiddenException(ApiException):
def __init__(self, status=None, reason=None, http_resp=None):
def __init__(self, status=None, reason=None, http_resp=None) -> None:
super(ForbiddenException, self).__init__(status, reason, http_resp)
class ServiceException(ApiException):
def __init__(self, status=None, reason=None, http_resp=None):
def __init__(self, status=None, reason=None, http_resp=None) -> None:
super(ServiceException, self).__init__(status, reason, http_resp)

View File

@@ -30,7 +30,7 @@ logger = logging.getLogger(__name__)
class RESTResponse(io.IOBase):
def __init__(self, resp):
def __init__(self, resp) -> None:
self.urllib3_response = resp
self.status = resp.status
self.reason = resp.reason
@@ -45,9 +45,9 @@ class RESTResponse(io.IOBase):
return self.urllib3_response.headers.get(name, default)
class RESTClientObject(object):
class RESTClientObject:
def __init__(self, configuration, pools_size=4, maxsize=None):
def __init__(self, configuration, pools_size=4, maxsize=None) -> None:
# urllib3.PoolManager will pass all kw parameters to connectionpool
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501