Python compat - iteritems() vs. items()

Always use `items()` and introduce extra `list(...)` call when needed.

Differential Revision: https://reviews.llvm.org/D56257

llvm-svn: 350312
This commit is contained in:
Serge Guelton 2019-01-03 14:12:23 +00:00
parent beb6fee542
commit 873cba17b2
3 changed files with 4 additions and 4 deletions

View File

@ -75,7 +75,7 @@ class EnumType(type):
def makeKey(item):
return (item[1], item[0])
e = []
for pair in sorted(self._nameMap.iteritems(), key=makeKey):
for pair in sorted(self._nameMap.items(), key=makeKey):
e.append(pair)
return e

View File

@ -52,10 +52,10 @@ class PhabObjectCache:
return self.id2PhabObjects[id]
def get_ids_in_cache(self):
return self.id2PhabObjects.keys()
return list(self.id2PhabObjects.keys())
def get_objects(self):
return self.id2PhabObjects.values()
return list(self.id2PhabObjects.values())
DEFAULT_DIRECTORY = "PhabObjectCache"

View File

@ -183,7 +183,7 @@ def ValidateChecksums(reference_checksums,
if len(new_checksums) != len(reference_checksums):
return False
for proj, checksum in new_checksums.iteritems():
for proj, checksum in new_checksums.items():
# We never computed a checksum for this project.
if proj not in reference_checksums:
return False