From ac00ec10ca483a3b96349dd2952a7881c6d8b29a Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Sat, 26 Jan 2019 09:55:35 +0000 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/15995 Reviewed-by: Gabe Black Reviewed-by: Giacomo Travaglini --- src/python/m5/stats/__init__.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/python/m5/stats/__init__.py b/src/python/m5/stats/__init__.py index ba91f22c7..acb62f13e 100644 --- a/src/python/m5/stats/__init__.py +++ b/src/python/m5/stats/__init__.py @@ -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() -- 2.30.2