Commit 573a5d4e authored by Rafael Fonseca's avatar Rafael Fonseca

ustat: fix lambda syntax on python3.

$ ./ustat
  File "./ustat", line 242
    counts = sorted(counts.items(), key=lambda (_, v):
                                               ^
SyntaxError: invalid syntax
parent 058c46fa
...@@ -239,10 +239,10 @@ class Tool(object): ...@@ -239,10 +239,10 @@ class Tool(object):
counts.update(probe.get_counts(self.bpf)) counts.update(probe.get_counts(self.bpf))
targets.update(probe.targets) targets.update(probe.targets)
if self.args.sort: 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)) -v.get(self.args.sort.upper(), 0))
else: else:
counts = sorted(counts.items(), key=lambda (k, _): k) counts = sorted(counts.items(), key=lambda k, _: k)
for pid, stats in counts: for pid, stats in counts:
print("%-6d %-20s %-10d %-6d %-10d %-8d %-6d %-6d" % ( print("%-6d %-20s %-10d %-6d %-10d %-8d %-6d %-6d" % (
pid, targets[pid][:20], pid, targets[pid][:20],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment