python: Make iterator handling Python 3 compatible
Many functions that used to return lists (e.g., dict.items()) now return iterators and their iterator counterparts (e.g., dict.iteritems()) have been removed. Switch calls to the Python 2.7 iterator methods to use the Python 3 equivalent and add explicit list conversions where necessary. Change-Id: I0c18114955af8f4932d81fb689a0adb939dafaba Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15992 Reviewed-by: Juha Jäykkä <juha.jaykka@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
@@ -63,7 +63,7 @@ capability_map = {
|
||||
'Normal': 'sgr0'
|
||||
}
|
||||
|
||||
capability_names = capability_map.keys()
|
||||
capability_names = list(capability_map.keys())
|
||||
|
||||
def null_cap_string(s, *args):
|
||||
return ''
|
||||
@@ -84,7 +84,7 @@ class ColorStrings(object):
|
||||
def __init__(self, cap_string):
|
||||
for i, c in enumerate(color_names):
|
||||
setattr(self, c, cap_string('setaf', i))
|
||||
for name, cap in capability_map.iteritems():
|
||||
for name, cap in capability_map.items():
|
||||
setattr(self, name, cap_string(cap))
|
||||
|
||||
termcap = ColorStrings(cap_string)
|
||||
|
||||
Reference in New Issue
Block a user