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: Cole Robinson <crobinso@redhat.com>
Tested-by: Stefan Raspl <stefan.raspl@linux.vnet.ibm.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
This commit is contained in:
Cole Robinson 2018-03-23 18:07:16 -04:00 committed by Radim Krčmář
parent 8566ac8b8e
commit 6ade1ae84c

View File

@ -1134,12 +1134,14 @@ class Tui(object):
def get_sorted_events(self, stats): def get_sorted_events(self, stats):
""" separate parent and child events """ """ separate parent and child events """
if self._sorting == SORT_DEFAULT: if self._sorting == SORT_DEFAULT:
def sortkey((_k, v)): def sortkey(pair):
# sort by (delta value, overall value) # sort by (delta value, overall value)
v = pair[1]
return (v.delta, v.value) return (v.delta, v.value)
else: else:
def sortkey((_k, v)): def sortkey(pair):
# sort by overall value # sort by overall value
v = pair[1]
return v.value return v.value
childs = [] childs = []