Commit 369d5a85 authored by Marc Hartmayer's avatar Marc Hartmayer Committed by Paolo Bonzini

tools/kvm_stat: avoid 'is' for equality checks

Use '==' for equality checks and 'is' when comparing identities.

An example where '==' and 'is' behave differently:
>>> a = 4242
>>> a == 4242
True
>>> a is 4242
False
Signed-off-by: default avatarMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 0eb57800
...@@ -1085,7 +1085,7 @@ class Tui(object): ...@@ -1085,7 +1085,7 @@ class Tui(object):
stats = self.stats.get(self._display_guests) stats = self.stats.get(self._display_guests)
total = 0. total = 0.
for key, values in stats.items(): for key, values in stats.items():
if key.find('(') is -1: if key.find('(') == -1:
total += values.value total += values.value
if self._sorting == SORT_DEFAULT: if self._sorting == SORT_DEFAULT:
...@@ -1110,7 +1110,7 @@ class Tui(object): ...@@ -1110,7 +1110,7 @@ class Tui(object):
self.screen.addstr(row, 1, '%-40s %10d%7.1f %8s' % self.screen.addstr(row, 1, '%-40s %10d%7.1f %8s' %
(key, values.value, values.value * 100 / total, (key, values.value, values.value * 100 / total,
cur)) cur))
if cur is not '' and key.find('(') is -1: if cur != '' and key.find('(') == -1:
tavg += cur tavg += cur
row += 1 row += 1
if row == 3: if row == 3:
......
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