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: Ie875158b01666ac0b307492519146a8f005090bc
This commit is contained in:
kavithahr 2017-07-10 18:00:22 +05:30
parent d85752fdda
commit 9e791e79ac
1 changed files with 1 additions and 2 deletions

View File

@ -16,7 +16,6 @@
from oslo_config import cfg
from oslo_log import log
from oslo_utils import excutils
import six
import stevedore
from neutron.api.v2 import attributes
@ -177,7 +176,7 @@ class TypeManager(stevedore.named.NamedExtensionManager):
network[provider.SEGMENTATION_ID] = segment[api.SEGMENTATION_ID]
def initialize(self):
for network_type, driver in six.iteritems(self.drivers):
for network_type, driver in self.drivers.items():
LOG.info("Initializing driver for type '%s'", network_type)
driver.obj.initialize()