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 github-actions[bot] committed Oct 24, 2023
1 parent 7e35700 commit 582751e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugins/modules/ec2_ami_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def copy_image(module, ec2):

try:
if module.params.get("tag_equality"):
filters = [{"Name": "tag:%s" % k, "Values": [v]} for (k, v) in module.params.get("tags").items()]
filters = [{"Name": f"tag:{k}", "Values": [v]} for (k, v) in module.params.get("tags").items()]
filters.append(dict(Name="state", Values=["available", "pending"]))
images = ec2.describe_images(Filters=filters)
if len(images["Images"]) > 0:
Expand All @@ -197,7 +197,7 @@ def copy_image(module, ec2):
except (ClientError, BotoCoreError) as e:
module.fail_json_aws(e, msg="Could not copy AMI")
except Exception as e:
module.fail_json(msg="Unhandled exception. (%s)" % to_native(e))
module.fail_json(msg=f"Unhandled exception. ({to_native(e)})")


def main():
Expand Down

0 comments on commit 582751e

Please sign in to comment.