diff options
| author | Philipp Hahn <hahn@univention.de> | 2018-11-21 09:10:27 +0100 |
|---|---|---|
| committer | Philipp Hahn <pmhahn+github@pmhahn.de> | 2020-08-05 07:43:01 +0000 |
| commit | a19f08683144964cc44d99c98b414f78a8a1f233 (patch) | |
| tree | 013ead354d1cd31b16cdf27e4d986952de9bf40d /examples | |
| parent | 6aa02b32922d9d47c57e4c77400b66165677cb44 (diff) | |
| download | libvirt-python-a19f08683144964cc44d99c98b414f78a8a1f233.tar.gz | |
examples/dhcp*: Fix None comparison
None should be compared with "is None" instead of "== None", as the
later would invoke a "__cmp__()" method.
Signed-off-by: Philipp Hahn <hahn@univention.de>
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/dhcpleases.py | 2 | ||||
| -rwxr-xr-x | examples/domipaddrs.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/examples/dhcpleases.py b/examples/dhcpleases.py index 020da39..531f880 100755 --- a/examples/dhcpleases.py +++ b/examples/dhcpleases.py @@ -35,7 +35,7 @@ except libvirt.libvirtError: sys.exit(0) leases = net.DHCPLeases() -if (leases == None): +if not leases: print("Failed to get leases for %s" % net.name()) sys.exit(0) diff --git a/examples/domipaddrs.py b/examples/domipaddrs.py index be30fd6..b0c752e 100755 --- a/examples/domipaddrs.py +++ b/examples/domipaddrs.py @@ -12,7 +12,7 @@ IPTYPE = { def print_dom_ifaces(dom): ifaces = dom.interfaceAddresses(libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE) - if (ifaces == None): + if ifaces is None: print("Failed to get domain interfaces") sys.exit(0) |
