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: I199f276ce4cd1841539aea9cb15822fd67c8b6bd
This commit is contained in:
parent
bb1f4adca0
commit
e437e1926c
|
@ -19,7 +19,6 @@ import logging
|
|||
from cliff import command
|
||||
from cliff import lister
|
||||
from cliff import show
|
||||
import six
|
||||
|
||||
from cueclient import utils
|
||||
|
||||
|
@ -59,7 +58,7 @@ class ShowClusterCommand(show.ShowOne):
|
|||
|
||||
data = client.clusters.get(parsed_args.id)
|
||||
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return zip(*sorted(data.items()))
|
||||
|
||||
|
||||
class CreateClusterCommand(show.ShowOne):
|
||||
|
@ -107,7 +106,7 @@ class CreateClusterCommand(show.ShowOne):
|
|||
username=username,
|
||||
password=password)
|
||||
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return zip(*sorted(data.items()))
|
||||
|
||||
|
||||
class SetClusterCommand(command.Command):
|
||||
|
@ -152,7 +151,7 @@ class SetClusterCommand(command.Command):
|
|||
data['masters'] = parsed_args.masters
|
||||
|
||||
updated = client.clusters.update(parsed_args.id, data)
|
||||
return zip(*sorted(six.iteritems(updated)))
|
||||
return zip(*sorted(updated.items()))
|
||||
|
||||
|
||||
class DeleteClusterCommand(command.Command):
|
||||
|
|
Loading…
Reference in New Issue