Skip to content

Commit

Permalink
Bulk migration to Python 3.6 f-strings (ansible-collections#1810)
Browse files Browse the repository at this point in the history
Bulk migration to Python 3.6 f-strings

SUMMARY
We've dropped support for Python <3.6, bulk migrate to fstrings and perform some general string cleanup
A combination of

black --preview
flynt
some manual cleanup

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/
tests/
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@de33821
  • Loading branch information
tremble authored and abikouo committed Oct 20, 2023
1 parent 4c24069 commit 8c680fa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/modules/api_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def get_api_definitions(module, swagger_file=None, swagger_dict=None, swagger_te
with open(swagger_file) as f:
apidata = f.read()
except OSError as e:
msg = "Failed trying to read swagger file {0}: {1}".format(str(swagger_file), str(e))
msg = f"Failed trying to read swagger file {str(swagger_file)}: {str(e)}"
module.fail_json(msg=msg, exception=traceback.format_exc())
if swagger_dict is not None:
apidata = json.dumps(swagger_dict)
Expand Down Expand Up @@ -281,7 +281,7 @@ def delete_rest_api(module, client, api_id):
try:
delete_response = delete_api(client, api_id)
except (botocore.exceptions.ClientError, botocore.exceptions.EndpointConnectionError) as e:
module.fail_json_aws(e, msg="deleting API {0}".format(api_id))
module.fail_json_aws(e, msg=f"deleting API {api_id}")
return delete_response


Expand All @@ -299,7 +299,7 @@ def ensure_api_in_correct_state(module, client, api_id, api_data):
try:
configure_response = configure_api(client, api_id, api_data=api_data)
except (botocore.exceptions.ClientError, botocore.exceptions.EndpointConnectionError) as e:
module.fail_json_aws(e, msg="configuring API {0}".format(api_id))
module.fail_json_aws(e, msg=f"configuring API {api_id}")

deploy_response = None

Expand All @@ -308,7 +308,7 @@ def ensure_api_in_correct_state(module, client, api_id, api_data):
try:
deploy_response = create_deployment(client, api_id, **module.params)
except (botocore.exceptions.ClientError, botocore.exceptions.EndpointConnectionError) as e:
msg = "deploying api {0} to stage {1}".format(api_id, stage)
msg = f"deploying api {api_id} to stage {stage}"
module.fail_json_aws(e, msg)

return configure_response, deploy_response
Expand Down

0 comments on commit 8c680fa

Please sign in to comment.