Replace dict.iteritems() with dict.items()

Automated change to replace dict.iteritems() which is no longer present
in python 3 with dict.items(). The later can be very marginally slower
in python 2, however the alternative to this would be to use
six.iteritems(dict) which has a greater cognitive overhead and reduces
readability with little or no performance gain.

Refer to this mailing list thread for more on this issue
http://markmail.org/message/tx7776ewlutxitjx

Code under magnum/common/pythonk8sclient has been ignored as this is
autogenerated code expected to be pull out of Magnum.

Partially-Implements: blueprint magnum-python3
Change-Id: Ib7cd192b2be3776985963bdf7fa14e96a464d0ae
changes/70/195270/3
Tom Cammann 8 years ago
parent ba12803c2f
commit 6e6af73789

@ -214,7 +214,7 @@ class MagnumException(Exception):
# kwargs doesn't match a variable in the message
# log the issue and the kwargs
LOG.exception(_LE('Exception in string format operation'))
for name, value in kwargs.iteritems():
for name, value in kwargs.items():
LOG.error(_LE("%(name)s: %(value)s") %
{'name': name, 'value': value})
try:

@ -105,7 +105,7 @@ class TestCase(base.BaseTestCase):
def config(self, **kw):
"""Override config options for a test."""
group = kw.pop('group', None)
for k, v in kw.iteritems():
for k, v in kw.items():
CONF.set_override(k, v, group)
def path_get(self, project_file=None):

@ -25,7 +25,7 @@ from magnum.tests.unit.db import utils
def remove_internal(values, internal):
# NOTE(yuriyz): internal attributes should not be posted, except uuid
int_attr = [attr.lstrip('/') for attr in internal if attr != '/uuid']
return dict([(k, v) for (k, v) in values.iteritems() if k not in int_attr])
return dict([(k, v) for (k, v) in values.items() if k not in int_attr])
def baymodel_post_data(**kw):

Loading…
Cancel
Save