From 4d0d078e5e613a745f700867b8a08bf56eba28df Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Thu, 9 Jan 2020 07:50:09 -0600 Subject: [PATCH] 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 --- openstack/resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openstack/resource.py b/openstack/resource.py index fe266c6f5..1a88d8fd5 100644 --- a/openstack/resource.py +++ b/openstack/resource.py @@ -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']