python: Switch from using compare to key in list sort
Python 3 has deprecated the use of a comparison function in favour of a key extraction function. Change-Id: I4b7eab791ecbdfbf7147f57fdbc7cbe8f1de20dd Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15995 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
@@ -169,12 +169,7 @@ def enable():
|
||||
if not (stat.flags & flags.display):
|
||||
stat.name = "__Stat%06d" % stat.id
|
||||
|
||||
def less(stat1, stat2):
|
||||
v1 = stat1.name.split('.')
|
||||
v2 = stat2.name.split('.')
|
||||
return v1 < v2
|
||||
|
||||
stats_list.sort(less)
|
||||
stats_list.sort(key=lambda s: s.name.split('.'))
|
||||
for stat in stats_list:
|
||||
stats_dict[stat.name] = stat
|
||||
stat.enable()
|
||||
|
||||
Reference in New Issue
Block a user