summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrajat29 <rajat.sharma@nectechnologies.in>2017-11-03 12:55:57 +0530
committerrajat29 <rajat.sharma@nectechnologies.in>2017-11-10 09:09:49 +0530
commite49dcb1995062e24d44a0691d6b8c0d8d1b7f64f (patch)
treea82d1d1f7754ac27603287e0efe1b27a0631d979
parent056e57deba44e6671110d8b5916fd588f0c12e64 (diff)
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
Notes
Notes (review): Code-Review+1: M V P Nitesh <parimalanitesh@gmail.com> Code-Review+1: Akhil jain <akhil.jain@nectechnologies.in> Code-Review+1: Dai Dang Van <daidv@vn.fujitsu.com> Code-Review+2: Spyros Trigazis (strigazi) <strigazi@gmail.com> Code-Review+2: yatin <ykarel@redhat.com> Workflow+1: yatin <ykarel@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 05 Dec 2017 10:42:14 +0000 Reviewed-on: https://review.openstack.org/517558 Project: openstack/python-magnumclient Branch: refs/heads/master
-rw-r--r--magnumclient/tests/osc/unit/osc_fakes.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/magnumclient/tests/osc/unit/osc_fakes.py b/magnumclient/tests/osc/unit/osc_fakes.py
index f28f910..2df0686 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
21import requests 21import requests
22import six 22import six
23 23
24
25AUTH_TOKEN = "foobar" 24AUTH_TOKEN = "foobar"
26AUTH_URL = "http://0.0.0.0" 25AUTH_URL = "http://0.0.0.0"
27USERNAME = "itchy" 26USERNAME = "itchy"
@@ -191,7 +190,7 @@ class FakeResource(object):
191 self._loaded = loaded 190 self._loaded = loaded
192 191
193 def _add_details(self, info): 192 def _add_details(self, info):
194 for (k, v) in six.iteritems(info): 193 for (k, v) in info.items():
195 setattr(self, k, v) 194 setattr(self, k, v)
196 195
197 def _add_methods(self, methods): 196 def _add_methods(self, methods):
@@ -202,7 +201,7 @@ class FakeResource(object):
202 @value. When users access the attribute with (), @value will be 201 @value. When users access the attribute with (), @value will be
203 returned, which looks like a function call. 202 returned, which looks like a function call.
204 """ 203 """
205 for (name, ret) in six.iteritems(methods): 204 for (name, ret) in methods.items():
206 method = mock.Mock(return_value=ret) 205 method = mock.Mock(return_value=ret)
207 setattr(self, name, method) 206 setattr(self, name, method)
208 207