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: I1ca4470fe8aae2098899b3f7ed29f83b56d57f79
This commit is contained in:
loooosy 2017-04-05 19:50:56 +08:00
parent d2234bf46d
commit a8542f11fe
2 changed files with 2 additions and 5 deletions

View File

@ -15,8 +15,6 @@
import functools
import six
from blazar.api.v1 import utils as api_utils
from blazar import exceptions
@ -41,7 +39,7 @@ def check_exists(get_function, object_id=None, **get_args):
"""Decorator handler."""
get_kwargs = {}
for k, v in six.iteritems(get_args):
for k, v in get_args.items():
get_kwargs[k] = kwargs[v]
try:

View File

@ -18,7 +18,6 @@ import datetime
import eventlet
from oslo_config import cfg
from oslo_log import log as logging
import six
from stevedore import enabled
from blazar.db import api as db_api
@ -106,7 +105,7 @@ class ManagerService(service_utils.RPCServer):
"""
actions = {}
for resource_type, plugin in six.iteritems(self.plugins):
for resource_type, plugin in self.plugins.items():
plugin = self.plugins[resource_type]
CONF.register_opts(plugin.get_plugin_opts(), group=resource_type)