examples: avoid "x == None" checks in python examples
lgmt.com says "Testing for None should use the is operator".
This commit is contained in:
@@ -41,7 +41,7 @@ devList = []
|
|||||||
|
|
||||||
for arg in sys.argv[2:]:
|
for arg in sys.argv[2:]:
|
||||||
path = GetDevicePath(arg)
|
path = GetDevicePath(arg)
|
||||||
if path == None:
|
if path is None:
|
||||||
raise Exception("NetworkManager knows nothing about %s" % arg)
|
raise Exception("NetworkManager knows nothing about %s" % arg)
|
||||||
else:
|
else:
|
||||||
devList.append(path)
|
devList.append(path)
|
||||||
|
@@ -57,7 +57,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# deactivate the connections
|
# deactivate the connections
|
||||||
for ac in connections:
|
for ac in connections:
|
||||||
if ctype == None or ctype == ac.get_connection_type():
|
if ctype is None or ctype == ac.get_connection_type():
|
||||||
sys.stdout.write("Deactivating %s (%s)" % (ac.get_id(), ac.get_uuid()))
|
sys.stdout.write("Deactivating %s (%s)" % (ac.get_id(), ac.get_uuid()))
|
||||||
try:
|
try:
|
||||||
client.deactivate_connection(ac, None)
|
client.deactivate_connection(ac, None)
|
||||||
|
Reference in New Issue
Block a user