From d72b0b9fac9b5a79a9a156b493d36395743dc5a7 Mon Sep 17 00:00:00 2001 From: loooosy Date: Wed, 5 Apr 2017 19:44:14 +0800 Subject: 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 --- tools/yaml-nic-config-2-script.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools/yaml-nic-config-2-script.py') diff --git a/tools/yaml-nic-config-2-script.py b/tools/yaml-nic-config-2-script.py index b8f07e4f..cdda108f 100755 --- a/tools/yaml-nic-config-2-script.py +++ b/tools/yaml-nic-config-2-script.py @@ -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')): -- cgit 1.2.3-korg