Skip to content

Rename async keyword for py3.7 compatibility #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.0.3 (2018-08-22)
* Removes double call in setup.py
* Adjusts EventsResponse so that event metadata is returned
* Renames async keyword to async_ to allow Python 3.7 support

## 3.0.2 (2018-07-16)
* Removes implicit relative imports which are not supported in Python 3

Expand Down
2 changes: 1 addition & 1 deletion clever/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.0.3
12 changes: 6 additions & 6 deletions clever/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ def __deserialize(self, 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=None,
response_type=None, auth_settings=None, async_=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None):
"""
Makes the HTTP request (synchronous) and return the deserialized data.
To make an async request, set the async parameter.
To make an async request, set the async_ parameter.

:param resource_path: Path to method endpoint.
:param method: Method to call.
Expand All @@ -298,7 +298,7 @@ def call_api(self, resource_path, method,
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async bool: execute request asynchronously
:param async_ 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,
header, and post parameters.
Expand All @@ -307,13 +307,13 @@ def call_api(self, resource_path, method,
: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:
If async parameter is True,
If async_ 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_ is False or missing,
then the method will return the response directly.
"""
if not async:
if not async_:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
Expand Down
918 changes: 459 additions & 459 deletions clever/apis/data_api.py

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions clever/apis/events_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ def get_event(self, id, **kwargs):
"""
Returns the specific event
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_event(id, async=True)
asynchronous HTTP request, please pass async_=True
>>> thread = api.get_event(id, async_=True)
>>> result = thread.get()

:param async bool
:param async_ bool
:param str id: (required)
:return: EventResponse
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
if kwargs.get('async_'):
return self.get_event_with_http_info(id, **kwargs)
else:
(data) = self.get_event_with_http_info(id, **kwargs)
Expand All @@ -60,19 +60,19 @@ def get_event_with_http_info(self, id, **kwargs):
"""
Returns the specific event
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_event_with_http_info(id, async=True)
asynchronous HTTP request, please pass async_=True
>>> thread = api.get_event_with_http_info(id, async_=True)
>>> result = thread.get()

:param async bool
:param async_ bool
:param str id: (required)
:return: EventResponse
If the method is called asynchronously,
returns the request thread.
"""

all_params = ['id']
all_params.append('async')
all_params.append('async_')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
Expand Down Expand Up @@ -121,7 +121,7 @@ def get_event_with_http_info(self, id, **kwargs):
files=local_var_files,
response_type='EventResponse',
auth_settings=auth_settings,
async=params.get('async'),
async_=params.get('async_'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
Expand All @@ -131,11 +131,11 @@ def get_events(self, **kwargs):
"""
Returns a list of events
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_events(async=True)
asynchronous HTTP request, please pass async_=True
>>> thread = api.get_events(async_=True)
>>> result = thread.get()

:param async bool
:param async_ bool
:param int limit:
:param str starting_after:
:param str ending_before:
Expand All @@ -146,7 +146,7 @@ def get_events(self, **kwargs):
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async'):
if kwargs.get('async_'):
return self.get_events_with_http_info(**kwargs)
else:
(data) = self.get_events_with_http_info(**kwargs)
Expand All @@ -156,11 +156,11 @@ def get_events_with_http_info(self, **kwargs):
"""
Returns a list of events
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.get_events_with_http_info(async=True)
asynchronous HTTP request, please pass async_=True
>>> thread = api.get_events_with_http_info(async_=True)
>>> result = thread.get()

:param async bool
:param async_ bool
:param int limit:
:param str starting_after:
:param str ending_before:
Expand All @@ -172,7 +172,7 @@ def get_events_with_http_info(self, **kwargs):
"""

all_params = ['limit', 'starting_after', 'ending_before', 'school', 'record_type']
all_params.append('async')
all_params.append('async_')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
Expand Down Expand Up @@ -227,7 +227,7 @@ def get_events_with_http_info(self, **kwargs):
files=local_var_files,
response_type='EventsResponse',
auth_settings=auth_settings,
async=params.get('async'),
async_=params.get('async_'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
Expand Down
2 changes: 1 addition & 1 deletion override/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.2
3.0.3
12 changes: 6 additions & 6 deletions override/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ def __deserialize(self, 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=None,
response_type=None, auth_settings=None, async_=None,
_return_http_data_only=None, collection_formats=None, _preload_content=True,
_request_timeout=None):
"""
Makes the HTTP request (synchronous) and return the deserialized data.
To make an async request, set the async parameter.
To make an async request, set the async_ parameter.

:param resource_path: Path to method endpoint.
:param method: Method to call.
Expand All @@ -302,7 +302,7 @@ def call_api(self, resource_path, method,
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async bool: execute request asynchronously
:param async_ 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,
header, and post parameters.
Expand All @@ -311,13 +311,13 @@ def call_api(self, resource_path, method,
: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:
If async parameter is True,
If async_ 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_ is False or missing,
then the method will return the response directly.
"""
if not async:
if not async_:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
Expand Down
8 changes: 8 additions & 0 deletions override/override.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ rm -rf swagger_client || true
git grep -l 'swagger_client' -- './*' ':(exclude)override/override.sh' | xargs sed -i "" 's/swagger_client/clever/g'
git grep -l 'swagger-client' -- './*' ':(exclude)override/override.sh' | xargs sed -i "" 's/swagger-client/clever-python/g'

# Rename references of async to async_
git grep -l "param async" -- './*' ':(exclude)override/override.sh' | xargs sed -i "" "s/param async/param async_/g"
git grep -l "parameter async" -- './*' ':(exclude)override/override.sh' | xargs sed -i "" "s/parameter async/parameter async_/g"
git grep -l "async parameter" -- './*' ':(exclude)override/override.sh' | xargs sed -i "" "s/async parameter/async_ parameter/g"
git grep -l "async=" -- './*' ':(exclude)override/override.sh' | xargs sed -i "" "s/async=/async_=/g"
git grep -l "async:" -- './*' ':(exclude)override/override.sh' | xargs sed -i "" "s/async:/async_:/g"
git grep -l "('async')" -- './*' ':(exclude)override/override.sh' | xargs sed -i "" "s/('async')/('async_')/g"

# Update the README
mv README.md docs/README.md
sed -i "" 's/## Documentation for API Endpoints/<EOD>\'$'\n## Documentation for API Endpoints/g' docs/README.md
Expand Down