Drop dict.iterkeys() for python3

dict.iterkeys() has been removed in python3, replace it with
dict.keys().
Don't use six.iterkeys(dict). ref:
http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html

Change-Id: Ifbb27c748f43155ea1f6b43b718516c3a348daf2
This commit is contained in:
Bo Wang 2016-01-20 11:26:09 +08:00
parent f4d46d1c34
commit eb2e7c04fe
2 changed files with 2 additions and 4 deletions

View File

@ -14,8 +14,6 @@
import collections import collections
import six
from glance.common import exception as exc from glance.common import exception as exc
from glance.domain import proxy as image_proxy from glance.domain import proxy as image_proxy
@ -42,7 +40,7 @@ class ArtifactHelper(image_proxy.Helper):
if not hasattr(obj, 'metadata'): if not hasattr(obj, 'metadata'):
return super(ArtifactHelper, self).proxy(obj) return super(ArtifactHelper, self).proxy(obj)
extra_attrs = {} extra_attrs = {}
for att_name in six.iterkeys(obj.metadata.attributes.all): for att_name in obj.metadata.attributes.all.keys():
extra_attrs[att_name] = _proxy_artifact_property(att_name) extra_attrs[att_name] = _proxy_artifact_property(att_name)
new_proxy_class = type("%s(%s)" % (obj.metadata.type_name, new_proxy_class = type("%s(%s)" % (obj.metadata.type_name,
self.proxy_class.__module__), self.proxy_class.__module__),

View File

@ -271,7 +271,7 @@ class SubunitTestResult(testtools.TestResult):
self.stopTestRun() self.stopTestRun()
def stopTestRun(self): def stopTestRun(self):
for cls in list(self.results.iterkeys()): for cls in list(self.results.keys()):
self.writeTestCase(cls) self.writeTestCase(cls)
self.stream.writeln() self.stream.writeln()
self.writeSlowTests() self.writeSlowTests()