diff options
author | loooosy <syluo5695@fiberhome.com> | 2017-04-05 19:44:14 +0800 |
---|---|---|
committer | loooosy <syluo5695@fiberhome.com> | 2017-04-07 15:23:50 +0800 |
commit | d72b0b9fac9b5a79a9a156b493d36395743dc5a7 (patch) | |
tree | 985d4c8e800ae3fe31e13a98f2df19fc904e4779 | |
parent | 29faa38ddca3a91d6944bdda8daceda4dde2b128 (diff) |
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
-rwxr-xr-x | tools/yaml-nic-config-2-script.py | 2 |
1 files changed, 1 insertions, 1 deletions
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')): |