Don't use equality to check None

This commit is contained in:
Sam Manzi 2016-04-13 09:51:30 +10:00
parent 5842a0e10b
commit 31b10acf97
7 changed files with 9 additions and 9 deletions

View File

@ -644,7 +644,7 @@ def model_to_text(model, cols=None, treeiter=None, indent="",
text = ""
if treeiter is None:
treeiter = model.get_iter_first()
while treeiter != None:
while treeiter is not None:
if cols is None:
items = sep.join([str(item) for item in model[treeiter][:]])
else:

View File

@ -854,7 +854,7 @@ class FlatBaseModel(GObject.GObject, Gtk.TreeModel, BaseModel):
See Gtk.TreeModel
"""
#print 'do_iter_nth_child', iter, nth
if iter == None:
if iter is None:
return True, self.node_map.get_iter(nth)
return False, None

View File

@ -104,7 +104,7 @@ class Node(object):
"""
Assign the handle of a Gramps object to this node.
"""
if not self.handle or handle == None:
if not self.handle or handle is None:
self.handle = handle
self.secondary = secondary
else:

View File

@ -162,7 +162,7 @@ def make_requested_gramplet(gui_class, pane, opts, dbstate, uistate):
"""
Make a GUI gramplet given its name.
"""
if opts == None:
if opts is None:
return None
if "name" in opts:

View File

@ -1819,7 +1819,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
txn.delete(sname)
if group is not None:
txn.put(sname, group)
if group == None:
if group is None:
grouppar = ''
else:
grouppar = group

View File

@ -1395,7 +1395,7 @@ if __name__ == '__main__':
print("#None are known")
tmp = main_level_test(consume_str, NameFormat, name_to_test)
print(tmp)
print("Good" if tmp == None else "!! bad !!")
print("Good" if tmp is None else "!! bad !!")
print()

View File

@ -963,9 +963,9 @@ class WebCalReport(Report):
continue
for day in vals:
event_date = "%04d%02d%02d" % (year, month, day)
if evdte == None:
if evdte is None:
evdte = event_date
elif nxt == None:
elif nxt is None:
nxt = event_date
self.event_list.append((evdte, prv, nxt))
else:
@ -1254,7 +1254,7 @@ class WebCalReport(Report):
prefix = self.narweb_prefix)))
else:
text = short_name
if age_at_death == None:
if age_at_death is None:
self.add_day_item(text, year, month, day, 'Birthday', age_at_death, birth_date)
else:
self.add_day_item(text, year, month, day, 'Birthday', age_at_death, person_death)