Skip to content

Commit 6898cf2

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Remove six.iteritems/itervalues/iterkeys"
2 parents 80b807a + 28ad7c5 commit 6898cf2

File tree

12 files changed

+14
-21
lines changed

12 files changed

+14
-21
lines changed

nova/api/openstack/compute/hosts.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"""The hosts admin extension."""
1717

1818
from oslo_log import log as logging
19-
import six
2019
import webob.exc
2120

2221
from nova.api.openstack import common
@@ -287,6 +286,6 @@ def show(self, req, id):
287286
instances))
288287
by_proj_resources = self._get_resources_by_project(host_name,
289288
instances)
290-
for resource in six.itervalues(by_proj_resources):
289+
for resource in by_proj_resources.values():
291290
resources.append({'resource': resource})
292291
return {'host': resources}

nova/cmd/manage.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,8 +2584,7 @@ def _check_orphaned_allocations_for_provider(self, ctxt, placement,
25842584
raise
25852585

25862586
# Verify every allocations for each consumer UUID
2587-
for consumer_uuid, consumer_resources in six.iteritems(
2588-
pallocs.allocations):
2587+
for consumer_uuid, consumer_resources in pallocs.allocations.items():
25892588
consumer_allocs = consumer_resources['resources']
25902589
if any(rc in NOVA_RCS
25912590
for rc in consumer_allocs):

nova/compute/provider_tree.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from oslo_concurrency import lockutils
2626
from oslo_log import log as logging
2727
from oslo_utils import uuidutils
28-
import six
2928

3029
from nova.i18n import _
3130

@@ -255,7 +254,7 @@ def __init__(self):
255254

256255
@property
257256
def roots(self):
258-
return six.itervalues(self.roots_by_uuid)
257+
return self.roots_by_uuid.values()
259258

260259
def get_provider_uuids(self, name_or_uuid=None):
261260
"""Return a list, in top-down traversable order, of the UUIDs of all

nova/scheduler/host_manager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import iso8601
3030
from oslo_log import log as logging
3131
from oslo_utils import timeutils
32-
import six
3332

3433
import nova.conf
3534
from nova import context as context_module
@@ -600,7 +599,7 @@ def _get_hosts_matching_request(hosts, requested_destination):
600599
return name_to_cls_map.values()
601600
else:
602601
return []
603-
hosts = six.itervalues(name_to_cls_map)
602+
hosts = name_to_cls_map.values()
604603

605604
return self.filter_handler.get_filtered_objects(self.enabled_filters,
606605
hosts, spec_obj, index)

nova/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ def inner(expected, observed, path='root'):
549549
self.assertEqual(
550550
expected_keys, observed_keys,
551551
'path: %s. Dict keys are not equal' % path)
552-
for key in list(six.iterkeys(expected)):
552+
for key in expected:
553553
inner(expected[key], observed[key], path + '.%s' % key)
554554
elif (isinstance(expected, (list, tuple, set)) and
555555
isinstance(observed, (list, tuple, set))):

nova/tests/unit/api/openstack/compute/test_extended_ips.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# under the License.
1515

1616
from oslo_serialization import jsonutils
17-
import six
1817

1918
from nova import objects
2019
from nova import test
@@ -120,7 +119,7 @@ def _get_servers(self, body):
120119
return jsonutils.loads(body).get('servers')
121120

122121
def _get_ips(self, server):
123-
for network in six.itervalues(server['addresses']):
122+
for network in server['addresses'].values():
124123
for ip in network:
125124
yield ip
126125

nova/tests/unit/api/openstack/compute/test_extended_ips_mac.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# under the License.
1515

1616
from oslo_serialization import jsonutils
17-
import six
1817

1918
from nova import objects
2019
from nova import test
@@ -125,7 +124,7 @@ def _get_servers(self, body):
125124
return jsonutils.loads(body).get('servers')
126125

127126
def _get_ips(self, server):
128-
for network in six.itervalues(server['addresses']):
127+
for network in server['addresses'].values():
129128
for ip in network:
130129
yield ip
131130

nova/tests/unit/api/openstack/compute/test_instance_actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_list_actions(self):
129129
def fake_get_actions(context, uuid, limit=None, marker=None,
130130
filters=None):
131131
actions = []
132-
for act in six.itervalues(self.fake_actions[uuid]):
132+
for act in self.fake_actions[uuid].values():
133133
action = models.InstanceAction()
134134
action.update(act)
135135
actions.append(action)

nova/tests/unit/api/openstack/test_wsgi.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import mock
1414
from oslo_serialization import jsonutils
15-
import six
1615
import testscenarios
1716
import webob
1817

@@ -747,7 +746,7 @@ def index(self, req):
747746
req = webob.Request.blank('/tests')
748747
app = fakes.TestRouter(Controller())
749748
response = req.get_response(app)
750-
for val in six.itervalues(response.headers):
749+
for val in response.headers.values():
751750
# All headers must be utf8
752751
self.assertThat(val, matchers.EncodedByUTF8())
753752
self.assertEqual('1', response.headers['x-header1'])

nova/tests/unit/db/test_db_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6327,7 +6327,7 @@ def test_archive_deleted_rows_before(self):
63276327

63286328
def test_archive_deleted_rows_for_every_uuid_table(self):
63296329
tablenames = []
6330-
for model_class in six.itervalues(models.__dict__):
6330+
for model_class in models.__dict__.values():
63316331
if hasattr(model_class, "__tablename__"):
63326332
tablenames.append(model_class.__tablename__)
63336333
tablenames.sort()

nova/tests/unit/objects/test_objects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,11 +956,11 @@ def test_object_serialization_iterables(self):
956956
thing = {'key': obj}
957957
primitive = ser.serialize_entity(self.context, thing)
958958
self.assertEqual(1, len(primitive))
959-
for item in six.itervalues(primitive):
959+
for item in primitive.values():
960960
self.assertNotIsInstance(item, base.NovaObject)
961961
thing2 = ser.deserialize_entity(self.context, primitive)
962962
self.assertEqual(1, len(thing2))
963-
for item in six.itervalues(thing2):
963+
for item in thing2.values():
964964
self.assertIsInstance(item, MyObj)
965965

966966
# object-action updates dict case

nova/virt/libvirt/driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ def _recreate_assigned_mediated_devices(self):
804804
# devices by looking up existing guest XMLs and doesn't use
805805
# the Placement API so it works with or without a vGPU reshape.
806806
mdevs = self._get_all_assigned_mediated_devices()
807-
for (mdev_uuid, instance_uuid) in six.iteritems(mdevs):
807+
for (mdev_uuid, instance_uuid) in mdevs.items():
808808
if not self._is_existing_mdev(mdev_uuid):
809809
dev_name = libvirt_utils.mdev_uuid2name(mdev_uuid)
810810
dev_info = self._get_mediated_device_information(dev_name)
@@ -7353,7 +7353,7 @@ def _allocate_mdevs(self, allocations):
73537353
LOG.warning('More than one allocation was passed over to libvirt '
73547354
'while at the moment libvirt only supports one. Only '
73557355
'the first allocation will be looked up.')
7356-
rp_uuid, alloc = six.next(six.iteritems(vgpu_allocations))
7356+
rp_uuid, alloc = next(iter(vgpu_allocations.items()))
73577357
vgpus_asked = alloc['resources'][orc.VGPU]
73587358

73597359
# Find if we allocated against a specific pGPU (and then the allocation

0 commit comments

Comments
 (0)