mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-16 18:05:27 -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) |
||
---|---|---|
.. | ||
cli | ||
compat | ||
config | ||
errors | ||
executor | ||
galaxy | ||
inventory | ||
module_utils | ||
modules | ||
parsing | ||
playbook | ||
plugins | ||
template | ||
utils | ||
vars | ||
__init__.py | ||
constants.py | ||
release.py | ||
test-requirements.txt |