[3/3]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 The patch list: tests. Partial-Implements: blueprint replace-iteritems-with-items Change-Id: I2d09c1d06370fed9c7c116a9eedea929fa5b5dc2
This commit is contained in:
parent
7e4a543781
commit
4b26b27513
@ -30,7 +30,6 @@ from oslo_config import cfg
|
||||
from oslo_db.sqlalchemy import enginefacade
|
||||
import oslo_messaging as messaging
|
||||
from oslo_messaging import conffixture as messaging_conffixture
|
||||
import six
|
||||
|
||||
from nova.api.openstack.placement import deploy as placement_deploy
|
||||
from nova.compute import rpcapi as compute_rpcapi
|
||||
@ -657,7 +656,7 @@ class ConfPatcher(fixtures.Fixture):
|
||||
|
||||
def setUp(self):
|
||||
super(ConfPatcher, self).setUp()
|
||||
for k, v in six.iteritems(self.args):
|
||||
for k, v in self.args.items():
|
||||
self.addCleanup(CONF.clear_override, k, self.group)
|
||||
CONF.set_override(k, v, self.group)
|
||||
|
||||
|
@ -17,7 +17,6 @@ import os
|
||||
import fixtures
|
||||
from oslo_policy import policy as oslo_policy
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
import nova.conf
|
||||
from nova.conf import paths
|
||||
@ -124,7 +123,7 @@ class RoleBasedPolicyFixture(RealPolicyFixture):
|
||||
self.add_missing_default_rules(policy)
|
||||
|
||||
# Convert all actions to require specified role
|
||||
for action, rule in six.iteritems(policy):
|
||||
for action in policy:
|
||||
policy[action] = 'role:%s' % self.role
|
||||
|
||||
self.policy_dir = self.useFixture(fixtures.TempDir())
|
||||
|
Loading…
Reference in New Issue
Block a user