summaryrefslogtreecommitdiff
path: root/glanceclient/v1/images.py
diff options
context:
space:
mode:
authorji-xuepeng <ji.xuepeng@zte.com.cn>2017-02-08 16:27:54 +0800
committerji-xuepeng <ji.xuepeng@zte.com.cn>2017-02-08 16:33:46 +0800
commit5fca39dbde82d4cf836fa666b549b606f7ccdb7f (patch)
treec51fbbbf2a62b170cd7d4625ea5a7c7bab9ef190 /glanceclient/v1/images.py
parentc1f54742f9ed61cd33e1f20342583bee07f1dfae (diff)
downloadpython-glanceclient-5fca39dbde82d4cf836fa666b549b606f7ccdb7f.tar.gz
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: I71c13040318eca6e5ed993e8aa03f8003986a71c
Diffstat (limited to 'glanceclient/v1/images.py')
-rw-r--r--glanceclient/v1/images.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/glanceclient/v1/images.py b/glanceclient/v1/images.py
index 182f1e5..966d45a 100644
--- a/glanceclient/v1/images.py
+++ b/glanceclient/v1/images.py
@@ -72,7 +72,7 @@ class ImageManager(base.ManagerWithFind):
def _image_meta_from_headers(self, headers):
meta = {'properties': {}}
safe_decode = encodeutils.safe_decode
- for key, value in six.iteritems(headers):
+ for key, value in headers.items():
# NOTE(flaper87): this is a compatibility fix
# for urllib3 >= 1.11. Please, refer to this
# bug for more info:
@@ -105,9 +105,9 @@ class ImageManager(base.ManagerWithFind):
return str(value)
return value
- for key, value in six.iteritems(fields_copy.pop('properties', {})):
+ for key, value in fields_copy.pop('properties', {}).items():
headers['x-image-meta-property-%s' % key] = to_str(value)
- for key, value in six.iteritems(fields_copy):
+ for key, value in fields_copy.items():
headers['x-image-meta-%s' % key] = to_str(value)
return headers
@@ -224,7 +224,7 @@ class ImageManager(base.ManagerWithFind):
return not (image.owner == owner)
def paginate(qp, return_request_id=None):
- for param, value in six.iteritems(qp):
+ for param, value in qp.items():
if isinstance(value, six.string_types):
# Note(flaper87) Url encoding should
# be moved inside http utils, at least