Remove six.iter*

As mentioned in [1], we should avoid using
six.iteritems/six.iterkeys to achieve iterators.
Let's use dict.items/dict.keys instead, as
it should return iterators in PY3 as well.
(As for PY2, the performance about list should
be negligible)

[1] https://wiki.openstack.org/wiki/Python3

Change-Id: Ia9659075a206b3b4d3a0dc7eb3b006b7b43f8f4d
This commit is contained in:
xiexs 2016-06-28 10:55:30 -04:00
parent 9af8e7125b
commit d899d88eca
4 changed files with 4 additions and 9 deletions

View File

@ -14,7 +14,6 @@
# under the License.
from oslo_log import log as logging
import six
from cinder.scheduler import filters
from cinder.scheduler.filters import extra_specs_ops
@ -35,7 +34,7 @@ class CapabilitiesFilter(filters.BaseHostFilter):
if not extra_specs:
return True
for key, req in six.iteritems(extra_specs):
for key, req in extra_specs.items():
# Either not scoped format, or in capabilities scope
scope = key.split(':')

View File

@ -17,8 +17,6 @@
Fakes For filters tests.
"""
import six
class FakeHostManager(object):
"""Defines fake hosts.
@ -49,5 +47,5 @@ class FakeHostManager(object):
class FakeHostState(object):
def __init__(self, host, attribute_dict):
self.host = host
for (key, val) in six.iteritems(attribute_dict):
for (key, val) in attribute_dict.items():
setattr(self, key, val)

View File

@ -13,7 +13,6 @@
# under the License.
import mock
import six
from cinder import exception
from cinder import test
@ -91,7 +90,7 @@ class NetAppDriverFactoryTestCase(test.TestCase):
registry = na_common.NETAPP_UNIFIED_DRIVER_REGISTRY
for family in six.iterkeys(registry):
for family in registry:
for protocol, full_class_name in registry[family].items():
driver = na_common.NetAppDriver.create_driver(
family, protocol, **kwargs)

View File

@ -23,7 +23,6 @@ from oslo_utils import units
from oslo_vmware import exceptions
from oslo_vmware import pbm
from oslo_vmware import vim_util
import six
from six.moves import urllib
from cinder.i18n import _, _LE, _LI
@ -688,7 +687,7 @@ class VMwareVolumeOps(object):
cf = self._session.vim.client.factory
option_values = []
for key, value in six.iteritems(extra_config):
for key, value in extra_config.items():
opt = cf.create('ns0:OptionValue')
opt.key = key
opt.value = value