mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-12-02 12:23:47 +03:00
examples/nodestat: Fix None comparison
"is" compares for "points to the same object", which for strings is the same as comparing the byte sequence itself as Python hashes each strings to only stores a unique copy of each string. > examples/nodestats.py:86:43: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple) > examples/nodestats.py:91:12: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple) > examples/nodestats.py:94:40: F632 use ==/!= to compare constant literals (str, bytes, int, float, tuple) Use "==" and "!=" for string comparsion. Signed-off-by: Philipp Hahn <hahn@univention.de>
This commit is contained in:
committed by
Philipp Hahn
parent
900676d3c4
commit
c588ba982e
@@ -74,14 +74,14 @@ for dom, v in domsStrictCfg.items():
|
||||
print("Domain '%s':\t" % dom.name())
|
||||
|
||||
toPrint = "\tOverall memory: %d MiB" % (v["memory"]["size"] // 1024)
|
||||
if v["memory"]["pin"] is not None and v["memory"]["pin"] is not "":
|
||||
if v["memory"]["pin"] is not None and v["memory"]["pin"] != "":
|
||||
toPrint = toPrint + " nodes %s" % v["memory"]["pin"]
|
||||
print(toPrint)
|
||||
|
||||
for k, node in sorted(v.items()):
|
||||
if k is "memory":
|
||||
if k == "memory":
|
||||
continue
|
||||
toPrint = "\tNode %s:\t%d MiB" % (k, node["size"] // 1024)
|
||||
if node["pin"] is not None and node["pin"] is not "":
|
||||
if node["pin"] is not None and node["pin"] == "":
|
||||
toPrint = toPrint + " nodes %s" % node["pin"]
|
||||
print(toPrint)
|
||||
|
||||
Reference in New Issue
Block a user