提交 6ade1ae8 编写于 作者: C Cole Robinson 提交者: Radim Krčmář

tools/kvm_stat: Fix python3 syntax

$ python3 tools/kvm/kvm_stat/kvm_stat
  File "tools/kvm/kvm_stat/kvm_stat", line 1137
    def sortkey((_k, v)):
                ^
SyntaxError: invalid syntax

Fix it in a way that's compatible with python2 and python3
Signed-off-by: NCole Robinson <crobinso@redhat.com>
Tested-by: NStefan Raspl <stefan.raspl@linux.vnet.ibm.com>
Signed-off-by: NRadim Krčmář <rkrcmar@redhat.com>
上级 8566ac8b
......@@ -1134,12 +1134,14 @@ class Tui(object):
def get_sorted_events(self, stats):
""" separate parent and child events """
if self._sorting == SORT_DEFAULT:
def sortkey((_k, v)):
def sortkey(pair):
# sort by (delta value, overall value)
v = pair[1]
return (v.delta, v.value)
else:
def sortkey((_k, v)):
def sortkey(pair):
# sort by overall value
v = pair[1]
return v.value
childs = []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册