Skip to content

Commit

Permalink
Support for python 3.7 by renaming async to async_req (OpenAPIToo…
Browse files Browse the repository at this point in the history
…ls#519)

* feat: support for python 3.7

* fix: regenerate other sample clients
  • Loading branch information
tomplus authored and wing328 committed Jul 20, 2018
1 parent cc09e54 commit 0d789bc
Show file tree
Hide file tree
Showing 25 changed files with 964 additions and 964 deletions.
22 changes: 11 additions & 11 deletions modules/openapi-generator/src/main/resources/python/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class {{classname}}(object):
{{{notes}}} # noqa: E501
{{/notes}}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
asynchronous HTTP request, please pass async_req=True
{{#sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
{{^sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
>>> result = thread.get()

:param async bool
:param async_req bool
{{#allParams}}
:param {{dataType}} {{paramName}}:{{#description}} {{{description}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional){{/optional}}
{{/allParams}}
Expand All @@ -51,7 +51,7 @@ class {{classname}}(object):
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
if kwargs.get('async_req'):
return self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) # noqa: E501
else:
(data) = self.{{operationId}}_with_http_info({{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs) # noqa: E501
Expand All @@ -64,16 +64,16 @@ class {{classname}}(object):
{{{notes}}} # noqa: E501
{{/notes}}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
asynchronous HTTP request, please pass async_req=True
{{#sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
{{^sortParamsByRequiredFlag}}
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async=True)
>>> thread = api.{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}async_req=True)
{{/sortParamsByRequiredFlag}}
>>> result = thread.get()

:param async bool
:param async_req bool
{{#allParams}}
:param {{dataType}} {{paramName}}:{{#description}} {{{description}}}{{/description}}{{#required}} (required){{/required}}{{#optional}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/optional}}
{{/allParams}}
Expand All @@ -85,7 +85,7 @@ class {{classname}}(object):
local_var_params = locals()

all_params = [{{#allParams}}'{{paramName}}'{{#hasMore}}, {{/hasMore}}{{/allParams}}] # noqa: E501
all_params.append('async')
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
Expand Down Expand Up @@ -206,7 +206,7 @@ class {{classname}}(object):
files=local_var_files,
response_type={{#returnType}}'{{returnType}}'{{/returnType}}{{^returnType}}None{{/returnType}}, # noqa: E501
auth_settings=auth_settings,
async=local_var_params.get('async'),
async_req=local_var_params.get('async_req'),
_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'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,12 @@ class ApiClient(object):
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=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 request, set the async parameter.
To make an async_req request, set the async_req parameter.

:param resource_path: Path to method endpoint.
:param method: Method to call.
Expand All @@ -300,7 +300,7 @@ class ApiClient(object):
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async bool: execute request asynchronously
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query,
Expand All @@ -313,13 +313,13 @@ class ApiClient(object):
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return:
If async parameter is True,
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async is False or missing,
If parameter async_req is False or missing,
then the method will return the response directly.
"""
if not async:
if not async_req:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ def test_special_tags(self, client, **kwargs): # noqa: E501
To test special tags # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_special_tags(client, async=True)
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags(client, async_req=True)
>>> result = thread.get()
:param async bool
:param async_req bool
:param Client client: client model (required)
:return: Client
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
if kwargs.get('async_req'):
return self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
else:
(data) = self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501
Expand All @@ -59,11 +59,11 @@ def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
To test special tags # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.test_special_tags_with_http_info(client, async=True)
asynchronous HTTP request, please pass async_req=True
>>> thread = api.test_special_tags_with_http_info(client, async_req=True)
>>> result = thread.get()
:param async bool
:param async_req bool
:param Client client: client model (required)
:return: Client
If the method is called asynchronously,
Expand All @@ -73,7 +73,7 @@ def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
local_var_params = locals()

all_params = ['client'] # noqa: E501
all_params.append('async')
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
Expand Down Expand Up @@ -126,7 +126,7 @@ def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501
files=local_var_files,
response_type='Client', # noqa: E501
auth_settings=auth_settings,
async=local_var_params.get('async'),
async_req=local_var_params.get('async_req'),
_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'),
Expand Down
Loading

0 comments on commit 0d789bc

Please sign in to comment.