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 Change-Id: I9488135957934da0f3fc7a57b36ec58c269665bf
This commit is contained in:
parent
fcef46e5d3
commit
4d0d078e5e
|
@ -1657,7 +1657,7 @@ class Resource(dict):
|
|||
links = data.get(pagination_key, {})
|
||||
# keystone might return a dict
|
||||
if isinstance(links, dict):
|
||||
links = ({k: v} for k, v in six.iteritems(links))
|
||||
links = ({k: v} for k, v in links.items())
|
||||
for item in links:
|
||||
if item.get('rel') == 'next' and 'href' in item:
|
||||
next_link = item['href']
|
||||
|
|
Loading…
Reference in New Issue