Эх сурвалжийг харах

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>
Cole Robinson 7 жил өмнө
parent
commit
6ade1ae84c

+ 4 - 2
tools/kvm/kvm_stat/kvm_stat

@@ -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 = []