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: Ib0b94e13c0f3cfebe5ce84dfadd850d0143b2de5
This commit is contained in:
gecong1973
2016-11-28 10:51:52 +08:00
parent 6f90fbec81
commit 21b63edb1f

View File

@@ -15,7 +15,6 @@
from glob import glob
import os
import six
import yaml
DEFAULT_METADATA = {
@@ -57,7 +56,7 @@ def build_summary(group, validations):
def format_dict(my_dict):
return ''.join(['\n\n - **{}**: {}'.format(key, value)
for key, value in six.iteritems(my_dict)])
for key, value in my_dict.items()])
def build_detail(group, validations):