From e49dcb1995062e24d44a0691d6b8c0d8d1b7f64f Mon Sep 17 00:00:00 2001 From: rajat29 Date: Fri, 3 Nov 2017 12:55:57 +0530 Subject: [PATCH] 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 --- magnumclient/tests/osc/unit/osc_fakes.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/magnumclient/tests/osc/unit/osc_fakes.py b/magnumclient/tests/osc/unit/osc_fakes.py index f28f9103..2df06862 100644 --- a/magnumclient/tests/osc/unit/osc_fakes.py +++ b/magnumclient/tests/osc/unit/osc_fakes.py @@ -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)