Replace six.iteritems() with .items()
authorloooosy <syluo5695@fiberhome.com>
Wed, 5 Apr 2017 11:44:14 +0000 (19:44 +0800)
committerloooosy <syluo5695@fiberhome.com>
Fri, 7 Apr 2017 07:23:50 +0000 (15:23 +0800)
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

tools/yaml-nic-config-2-script.py

index b8f07e4..cdda108 100755 (executable)
@@ -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')):