Skip to content
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

Merged

Conversation

russoz
Copy link
Collaborator

@russoz russoz commented Dec 23, 2024

SUMMARY

Use f-strings instead of string interpolations or string format().

ISSUE TYPE
  • Refactoring Pull Request
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

@ansibullbot

This comment was marked as outdated.

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI lookup lookup plugin needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR plugins plugin (any type) labels Dec 23, 2024
@russoz
Copy link
Collaborator Author

russoz commented Dec 23, 2024

The test ansible-test sanity --test validate-modules [explain] failed with 2 errors:

plugins/lookup/dependent.py:188:0: unidiomatic-typecheck: Type comparison using type() found. Use isinstance() instead
plugins/lookup/dependent.py:217:0: unidiomatic-typecheck: Type comparison using type() found. Use isinstance() instead

click here for bot help

@felixfontein this looks like a snafu from validate-modules to me. There is no type comparison happening in those lines. Should I just add an ignore file for the file or do you want to adjust something in the validation?

@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI and removed ci_verified Push fixes to PR branch to re-run CI labels Dec 23, 2024
@felixfontein felixfontein added backport-10 Automatically create a backport for the stable-10 branch check-before-release PR will be looked at again shortly before release and merged if possible. labels Dec 23, 2024
@felixfontein
Copy link
Collaborator

@felixfontein this looks like a snafu from validate-modules to me. There is no type comparison happening in those lines. Should I just add an ignore file for the file or do you want to adjust something in the validation?

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.

@felixfontein
Copy link
Collaborator

(Ref: ansible/ansible@9dd3eaf)

Co-authored-by: Felix Fontein <felix@fontein.de>
@ansibullbot ansibullbot added ci_verified Push fixes to PR branch to re-run CI and removed ci_verified Push fixes to PR branch to re-run CI labels Dec 23, 2024
@ansibullbot ansibullbot added tests tests and removed ci_verified Push fixes to PR branch to re-run CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Dec 23, 2024
Co-authored-by: Felix Fontein <felix@fontein.de>
@ansibullbot ansibullbot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI labels Dec 25, 2024
@ansibullbot ansibullbot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR label Dec 25, 2024
@felixfontein felixfontein merged commit 6cd3f79 into ansible-collections:main Dec 25, 2024
129 checks passed
Copy link

patchback bot commented Dec 25, 2024

Backport to stable-10: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-10/6cd3f79e19b00a485132a4e6281656b8e5e6e10c/pr-9324

Backported as #9367

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 25, 2024
patchback bot pushed a commit that referenced this pull request Dec 25, 2024
* lookup plugins: use f-strings

* add changelog frag

* manual change for few occurrences

* Update plugins/lookup/dependent.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* adjustment from review

* no f-string for you

* Update plugins/lookup/dependent.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 6cd3f79)
@felixfontein
Copy link
Collaborator

@russoz thanks for your contribution!

@russoz russoz deleted the fstr-lookup-plugins branch December 25, 2024 09:24
felixfontein pushed a commit that referenced this pull request Dec 25, 2024
…#9367)

lookup plugins: use f-strings (#9324)

* lookup plugins: use f-strings

* add changelog frag

* manual change for few occurrences

* Update plugins/lookup/dependent.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* adjustment from review

* no f-string for you

* Update plugins/lookup/dependent.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 6cd3f79)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Massl123 pushed a commit to Massl123/community.general that referenced this pull request Feb 7, 2025
* lookup plugins: use f-strings

* add changelog frag

* manual change for few occurrences

* Update plugins/lookup/dependent.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* adjustment from review

* no f-string for you

* Update plugins/lookup/dependent.py

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-10 Automatically create a backport for the stable-10 branch lookup lookup plugin plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants