mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 12:21:26 -07:00
Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurrences. Using the in-operator for hash lookups is faster than using .keys() http://stackoverflow.com/questions/29314269/why-do-key-in-dict-and-key-in-dict-keys-have-the-same-output
This commit is contained in:
parent
c843eeabc2
commit
54fdff16db
9 changed files with 10 additions and 10 deletions
|
@ -877,7 +877,7 @@ def get_available_features(feature, module):
|
|||
if 'enabled' in state:
|
||||
state = 'enabled'
|
||||
|
||||
if feature not in available_features.keys():
|
||||
if feature not in available_features:
|
||||
available_features[feature] = state
|
||||
else:
|
||||
if (available_features[feature] == 'disabled' and
|
||||
|
@ -963,7 +963,7 @@ def main():
|
|||
state = module.params['state'].lower()
|
||||
|
||||
available_features = get_available_features(feature, module)
|
||||
if feature not in available_features.keys():
|
||||
if feature not in available_features:
|
||||
module.fail_json(
|
||||
msg='Invalid feature name.',
|
||||
features_currently_supported=available_features,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue