From 573a5d4e3d84fe01a269c671da1f2ffd8a86de23 Mon Sep 17 00:00:00 2001 From: Rafael Fonseca Date: Fri, 10 Feb 2017 13:56:02 +0100 Subject: [PATCH] ustat: fix lambda syntax on python3. $ ./ustat File "./ustat", line 242 counts = sorted(counts.items(), key=lambda (_, v): ^ SyntaxError: invalid syntax --- tools/ustat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/ustat.py b/tools/ustat.py index cc410df..1c85ea0 100755 --- a/tools/ustat.py +++ b/tools/ustat.py @@ -239,10 +239,10 @@ class Tool(object): counts.update(probe.get_counts(self.bpf)) targets.update(probe.targets) if self.args.sort: - counts = sorted(counts.items(), key=lambda (_, v): + counts = sorted(counts.items(), key=lambda _, v: -v.get(self.args.sort.upper(), 0)) else: - counts = sorted(counts.items(), key=lambda (k, _): k) + counts = sorted(counts.items(), key=lambda k, _: k) for pid, stats in counts: print("%-6d %-20s %-10d %-6d %-10d %-8d %-6d %-6d" % ( pid, targets[pid][:20], -- 2.7.4