Replace six.iteritems() with .items()

1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: I7c8f540eced0731f4dfb1dfd045828b5a9bb6c67
This commit is contained in:
loooosy 2017-04-05 19:44:14 +08:00
parent 29faa38ddc
commit d72b0b9fac
1 changed files with 1 additions and 1 deletions

View File

@ -157,7 +157,7 @@ def convert(filename):
print("Error couldn't find run-os-net-config.sh relative to filename")
exit_usage()
for r in six.iteritems(tpl.get('resources', {})):
for r in (tpl.get('resources', {})).items():
if (r[1].get('type') == 'OS::Heat::StructuredConfig' and
r[1].get('properties', {}).get('group') == 'os-apply-config' and
r[1].get('properties', {}).get('config', {}).get('os_net_config')):