Py3: use dict.items() instead of dict.iteritems()

Python 3 use dict.items(), so we'd better use it.

Change-Id: I41380ebbed60bd33cc7e2494c5c3b226fedec3ac
This commit is contained in:
ting.wang 2016-01-16 10:19:43 +08:00
parent 9e2517a038
commit fdb7fc4498
3 changed files with 5 additions and 5 deletions

View File

@ -48,7 +48,7 @@ class Event(object):
def __eq__(self, other):
if not type(self) == type(other):
return False
for k, v in vars(self).iteritems():
for k, v in vars(self).items():
if k not in vars(other):
return False
if vars(other)[k] != v:

View File

@ -123,7 +123,7 @@ class PezPoolManager(object):
def _check_err_instances(self, pools):
"""Scans the pool and deletes any instances in error state"""
for resource, pool in copy.copy(pools).iteritems():
for resource, pool in copy.copy(pools).items():
err_instances = [i for i in pool if i.status == ERROR]
for err_inst in err_instances:
LOG.error(_LE(
@ -140,7 +140,7 @@ class PezPoolManager(object):
# out what to do with them later.
stuck_instances = []
del_instances = []
for resource, pool in pools.iteritems():
for resource, pool in pools.items():
del_instances += [i for i in pool if i.status == DELETING]
# clean out counters for old instances that have been deleted entirely
@ -164,7 +164,7 @@ class PezPoolManager(object):
def _check_outdated_instances(self, pools):
outdated_instances = []
for resource, pool in pools.iteritems():
for resource, pool in pools.items():
for server in pool:
if server.image['id'] != str(self.images[resource]):
LOG.info(_LI(

View File

@ -19,7 +19,7 @@ from astara import drivers
class DriverFactoryTest(base.RugTestBase):
def test_get_driver(self):
for k, v in drivers.AVAILABLE_DRIVERS.iteritems():
for k, v in drivers.AVAILABLE_DRIVERS.items():
self.assertEqual(drivers.get(k), v)
def test_get_bad_driver(self):