Replace six.iteritems() with .items()
1.As mentioned in [1], we should avoid usingg 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: I4c51b6f2f2d48681530f7369dfd8cfc1126f9d76
This commit is contained in:
parent
056e57deba
commit
e49dcb1995
|
@ -21,7 +21,6 @@ from keystoneauth1 import fixture
|
|||
import requests
|
||||
import six
|
||||
|
||||
|
||||
AUTH_TOKEN = "foobar"
|
||||
AUTH_URL = "http://0.0.0.0"
|
||||
USERNAME = "itchy"
|
||||
|
@ -191,7 +190,7 @@ class FakeResource(object):
|
|||
self._loaded = loaded
|
||||
|
||||
def _add_details(self, info):
|
||||
for (k, v) in six.iteritems(info):
|
||||
for (k, v) in info.items():
|
||||
setattr(self, k, v)
|
||||
|
||||
def _add_methods(self, methods):
|
||||
|
@ -202,7 +201,7 @@ class FakeResource(object):
|
|||
@value. When users access the attribute with (), @value will be
|
||||
returned, which looks like a function call.
|
||||
"""
|
||||
for (name, ret) in six.iteritems(methods):
|
||||
for (name, ret) in methods.items():
|
||||
method = mock.Mock(return_value=ret)
|
||||
setattr(self, name, method)
|
||||
|
||||
|
|
Loading…
Reference in New Issue