Replace six.itervalues() with dict.values() in python-novaclient

1.As mentioned in [1], we should avoid using six.itervalues
  to achieve iterators. We can use dict.values instead, as it
  will return iterators in PY3 as well. And dict.values will
  more readable.
2.In py2, the performance about list should be negligible,
  see the link [2].

[1] https://wiki.openstack.org/wiki/Python3#Common_patterns
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: I77df96b09fc0b66449339a474ac725edb890c0bc
This commit is contained in:
yanghuichan 2017-08-04 15:51:46 +08:00
parent de8bb757dd
commit 0fe136a9e0

View File

@ -3864,7 +3864,7 @@ def do_ssh(cs, args):
msg = _("Server '%(server)s' is not attached to any network.")
raise exceptions.CommandError(msg % {'server': args.server})
else:
network_addresses = list(six.itervalues(addresses))[0]
network_addresses = list(addresses.values())[0]
# Select the address in the selected network.
# If the extension is not present, we assume the address to be floating.