Replace six.iteritems() with .items()

As mentioned in the developer's guide[0] and in a discussion[1],
we shouldn't use six.iteritems() unless there's a good reason (eg
large data set).

Since there's no need to use six.iteritems() in the places where
it is being used, this patch replaces them with items().

[0] http://docs.openstack.org/infra/manual/developers.html#peer-review
[1] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: If91afd37a7bf42dcbcf9dcd70fbbe82787de850e
This commit is contained in:
Ruby Loo 2015-09-28 18:20:00 +00:00
parent 104a5b4c81
commit 07fc85c5e1
4 changed files with 4 additions and 9 deletions

View File

@ -588,7 +588,7 @@ def _construct_http_client(endpoint=None,
'key_file': key_file,
'insecure': insecure}
dvars = [k for k, v in six.iteritems(ignored) if v]
dvars = [k for k, v in ignored.items() if v]
if dvars:
LOG.warn('The following arguments are ignored when using the '

View File

@ -15,7 +15,6 @@
#
import logging
import six
from cliff import command
from cliff import lister
@ -283,7 +282,7 @@ class ShowBaremetal(show.ShowOne):
for field in self.LONG_FIELDS:
node.pop(field, None)
return zip(*sorted(six.iteritems(node)))
return zip(*sorted(node.items()))
class UnsetBaremetal(command.Command):

View File

@ -16,8 +16,6 @@
import sys
import six
AUTH_TOKEN = "foobar"
AUTH_URL = "http://0.0.0.0"
@ -48,7 +46,7 @@ class FakeResource(object):
self._loaded = loaded
def _add_details(self, info):
for (k, v) in six.iteritems(info):
for (k, v) in info.items():
setattr(self, k, v)
def __repr__(self):

View File

@ -15,8 +15,6 @@
import argparse
import six
from ironicclient.common.i18n import _
from ironicclient.common import utils
from ironicclient.openstack.common.apiclient import exceptions
@ -408,7 +406,7 @@ def do_node_validate(cc, args):
"""Validate a node's driver interfaces."""
ifaces = cc.node.validate(args.node)
obj_list = []
for key, value in six.iteritems(ifaces.to_dict()):
for key, value in ifaces.to_dict().items():
data = {'interface': key}
data.update(value)
obj_list.append(type('iface', (object,), data))