Skip to content

Commit

Permalink
ustat: fix lambda syntax on python3.
Browse files Browse the repository at this point in the history
$ ./ustat
  File "./ustat", line 242
    counts = sorted(counts.items(), key=lambda (_, v):
                                               ^
SyntaxError: invalid syntax
  • Loading branch information
r4f4 committed Feb 10, 2017
1 parent 058c46f commit 573a5d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/ustat.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ def _loop_iter(self):
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],
Expand Down

0 comments on commit 573a5d4

Please sign in to comment.