[2/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: 1. cells. 2. compute api. 3. image. 4. network. 5. objects. 6. scheduler. 7. virt. 8. other resources. Partial-Implements: blueprint replace-iteritems-with-items Change-Id: Ic6e469eb80ee1774de1374bb36f38b5134b6b311
This commit is contained in:
@@ -14,7 +14,7 @@ import functools
|
||||
import inspect
|
||||
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
|
||||
import nova.conf
|
||||
from nova.notifications.objects import base
|
||||
@@ -91,4 +91,4 @@ def _get_call_dict(function, self, context, *args, **kw):
|
||||
|
||||
def _cleanse_dict(original):
|
||||
"""Strip all admin_password, new_pass, rescue_pass keys from a dict."""
|
||||
return {k: v for k, v in six.iteritems(original) if "_pass" not in k}
|
||||
return {k: v for k, v in original.items() if "_pass" not in k}
|
||||
|
Reference in New Issue
Block a user