mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-24 04:54:00 -07:00
[PR #8814/ecc048bc backport][stable-9] Use dict comprehension in plugins (#8819)
Use dict comprehension in plugins (#8814)
* use dict comprehension in plugins
* Apply suggestions from code review
* add changelog frag
* fix references in changelog frag
(cherry picked from commit ecc048bc12)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
7f729d99a2
commit
af08ea33b1
24 changed files with 81 additions and 45 deletions
|
|
@ -113,7 +113,7 @@ class VarDict(object):
|
|||
self._meta[name] = meta
|
||||
|
||||
def output(self):
|
||||
return dict((k, v) for k, v in self._data.items() if self.meta(k).output)
|
||||
return {k: v for k, v in self._data.items() if self.meta(k).output}
|
||||
|
||||
def diff(self):
|
||||
diff_results = [(k, self.meta(k).diff_result) for k in self._data]
|
||||
|
|
@ -125,7 +125,7 @@ class VarDict(object):
|
|||
return None
|
||||
|
||||
def facts(self):
|
||||
facts_result = dict((k, v) for k, v in self._data.items() if self._meta[k].fact)
|
||||
facts_result = {k: v for k, v in self._data.items() if self._meta[k].fact}
|
||||
return facts_result if facts_result else None
|
||||
|
||||
def change_vars(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue