mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Performance improvement using in-operator on dicts
Just a small cleanup for the existing occurances. 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:
@@ -2782,11 +2782,11 @@ class GenericBsdIfconfigNetwork(Network):
|
||||
return
|
||||
ifinfo = interfaces[defaults['interface']]
|
||||
# copy all the interface values across except addresses
|
||||
for item in ifinfo.keys():
|
||||
for item in ifinfo:
|
||||
if item != 'ipv4' and item != 'ipv6':
|
||||
defaults[item] = ifinfo[item]
|
||||
if len(ifinfo[ip_type]) > 0:
|
||||
for item in ifinfo[ip_type][0].keys():
|
||||
for item in ifinfo[ip_type][0]:
|
||||
defaults[item] = ifinfo[ip_type][0][item]
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user