summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhijeet Kasurde <akasurde@redhat.com>2024-10-16 21:33:07 +0200
committerGitHub <noreply@github.com>2024-10-16 21:33:07 +0200
commit279de623d06a7f4a857b6629f8fa21fb516e65d8 (patch)
tree5583f4a5709228536f68304d3a4a53a46d81639b
parentRemove unnecessary code (#84085) (diff)
downloadansible-279de623d06a7f4a857b6629f8fa21fb516e65d8.tar.xz
ansible-279de623d06a7f4a857b6629f8fa21fb516e65d8.zip
Use dict comprehension instead (#83680)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
-rw-r--r--lib/ansible/module_utils/basic.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py
index 2e2362b3fe..6fad0d928e 100644
--- a/lib/ansible/module_utils/basic.py
+++ b/lib/ansible/module_utils/basic.py
@@ -1433,11 +1433,7 @@ class AnsibleModule(object):
kwargs['deprecations'] = deprecations
# preserve bools/none from no_log
- # TODO: once python version on target high enough, dict comprehensions
- preserved = {}
- for k, v in kwargs.items():
- if v is None or isinstance(v, bool):
- preserved[k] = v
+ preserved = {k: v for k, v in kwargs.items() if v is None or isinstance(v, bool)}
# strip no_log collisions
kwargs = remove_values(kwargs, self.no_log_values)