Replace six.iteritems/itervalues with dict.items()/values()

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: I88c133a37a11ef9049766a151a134106440bef6a
This commit is contained in:
xurong00037997 2017-02-06 16:24:34 +08:00
parent b7b9e13de6
commit 9f7bf67b87
2 changed files with 2 additions and 2 deletions

View File

@ -132,7 +132,7 @@ def _get_file_contents(from_data, files):
if not isinstance(from_data, (dict, list)):
return
if isinstance(from_data, dict):
recurse_data = six.itervalues(from_data)
recurse_data = from_data.values()
for key, value in from_data.items():
if _ignore_if(key, value):
continue

View File

@ -319,7 +319,7 @@ resource_types = {
def get_resource_type(type):
for key, value in six.iteritems(resource_types):
for key, value in resource_types.items():
if key in type:
return value