-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
lookup plugins: use f-strings #9324
base: main
Are you sure you want to change the base?
lookup plugins: use f-strings #9324
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
@felixfontein this looks like a snafu from |
For now it's best to add ignore.txt entries. The check has been removed from ansible-core 2.17 anyway, so fixing it is no longer possible. |
(Ref: ansible/ansible@9dd3eaf) |
Co-authored-by: Felix Fontein <[email protected]>
@@ -144,7 +144,7 @@ def __evaluate(self, expression, templar, variables): | |||
``variables`` are the variables to use. | |||
""" | |||
templar.available_variables = variables or {} | |||
expression = "{0}{1}{2}".format("{{", expression, "}}") | |||
expression = '{{%s}}' % expression |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here again the opening and ending sequence is part of the formatting string, which was intentionally not the case before. How about reverting to the original code?
expression = '{{%s}}' % expression | |
expression = "{0}{1}{2}".format("{{", expression, "}}") |
Using format()
is still totally legal and fine.
SUMMARY
Use f-strings instead of string interpolations or string format().
ISSUE TYPE
COMPONENT NAME
plugins/lookup/bitwarden.py
plugins/lookup/chef_databag.py
plugins/lookup/collection_version.py
plugins/lookup/consul_kv.py
plugins/lookup/credstash.py
plugins/lookup/cyberarkpassword.py
plugins/lookup/dependent.py
plugins/lookup/dig.py
plugins/lookup/dnstxt.py
plugins/lookup/dsv.py
plugins/lookup/etcd.py
plugins/lookup/etcd3.py
plugins/lookup/filetree.py
plugins/lookup/github_app_access_token.py
plugins/lookup/hiera.py
plugins/lookup/keyring.py
plugins/lookup/lastpass.py
plugins/lookup/lmdb_kv.py
plugins/lookup/manifold.py
plugins/lookup/merge_variables.py
plugins/lookup/onepassword.py
plugins/lookup/onepassword_doc.py
plugins/lookup/passwordstore.py
plugins/lookup/random_pet.py
plugins/lookup/redis.py
plugins/lookup/revbitspss.py
plugins/lookup/shelvefile.py
plugins/lookup/tss.py