mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-27 06:09:37 -07:00
ran task_executor through python-modernize and then made changes to the
code pointed out by it:
* Most places where we looped through dict.keys() changed to
for key in dict:
Using keys() in python2 creates a list() of keys. For iterating, we
can iterate over the dict itself and we'll be handed back each key.
In python3, doing it this way does not create a new list and thus is
more memory efficient.
* In one place, use:
for key in list(dict.keys()):
because we're deleting elements from the dictionary inside of the
loop. So we really do need to iterate over a separate list of the
keys to avoid modifying the dictionary that we're iterating over.
(Fixes Python3 bug)
* In one place, change the order of an if-elif-else tree so that the
most frequent cases are evaluated first. (Optimization)
|
||
|---|---|---|
| .. | ||
| process | ||
| __init__.py | ||
| module_common.py | ||
| play_iterator.py | ||
| playbook_executor.py | ||
| stats.py | ||
| task_executor.py | ||
| task_queue_manager.py | ||
| task_result.py | ||