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:
parent
104a5b4c81
commit
07fc85c5e1
@ -588,7 +588,7 @@ def _construct_http_client(endpoint=None,
|
|||||||
'key_file': key_file,
|
'key_file': key_file,
|
||||||
'insecure': insecure}
|
'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:
|
if dvars:
|
||||||
LOG.warn('The following arguments are ignored when using the '
|
LOG.warn('The following arguments are ignored when using the '
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import six
|
|
||||||
|
|
||||||
from cliff import command
|
from cliff import command
|
||||||
from cliff import lister
|
from cliff import lister
|
||||||
@ -283,7 +282,7 @@ class ShowBaremetal(show.ShowOne):
|
|||||||
for field in self.LONG_FIELDS:
|
for field in self.LONG_FIELDS:
|
||||||
node.pop(field, None)
|
node.pop(field, None)
|
||||||
|
|
||||||
return zip(*sorted(six.iteritems(node)))
|
return zip(*sorted(node.items()))
|
||||||
|
|
||||||
|
|
||||||
class UnsetBaremetal(command.Command):
|
class UnsetBaremetal(command.Command):
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
|
|
||||||
AUTH_TOKEN = "foobar"
|
AUTH_TOKEN = "foobar"
|
||||||
AUTH_URL = "http://0.0.0.0"
|
AUTH_URL = "http://0.0.0.0"
|
||||||
@ -48,7 +46,7 @@ class FakeResource(object):
|
|||||||
self._loaded = loaded
|
self._loaded = loaded
|
||||||
|
|
||||||
def _add_details(self, info):
|
def _add_details(self, info):
|
||||||
for (k, v) in six.iteritems(info):
|
for (k, v) in info.items():
|
||||||
setattr(self, k, v)
|
setattr(self, k, v)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -15,8 +15,6 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
import six
|
|
||||||
|
|
||||||
from ironicclient.common.i18n import _
|
from ironicclient.common.i18n import _
|
||||||
from ironicclient.common import utils
|
from ironicclient.common import utils
|
||||||
from ironicclient.openstack.common.apiclient import exceptions
|
from ironicclient.openstack.common.apiclient import exceptions
|
||||||
@ -408,7 +406,7 @@ def do_node_validate(cc, args):
|
|||||||
"""Validate a node's driver interfaces."""
|
"""Validate a node's driver interfaces."""
|
||||||
ifaces = cc.node.validate(args.node)
|
ifaces = cc.node.validate(args.node)
|
||||||
obj_list = []
|
obj_list = []
|
||||||
for key, value in six.iteritems(ifaces.to_dict()):
|
for key, value in ifaces.to_dict().items():
|
||||||
data = {'interface': key}
|
data = {'interface': key}
|
||||||
data.update(value)
|
data.update(value)
|
||||||
obj_list.append(type('iface', (object,), data))
|
obj_list.append(type('iface', (object,), data))
|
||||||
|
Loading…
Reference in New Issue
Block a user