Merge pull request #112 from sam-m888/fixNonecomparisons

Don't use equality to check None
This commit is contained in:
Doug Blank 2016-04-12 20:04:06 -04:00
commit dc486bc79f
7 changed files with 10 additions and 10 deletions

View File

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

View File

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

View File

@ -104,7 +104,7 @@ class Node(object):
""" """
Assign the handle of a Gramps object to this node. 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.handle = handle
self.secondary = secondary self.secondary = secondary
else: else:

View File

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

View File

@ -1819,7 +1819,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
txn.delete(sname) txn.delete(sname)
if group is not None: if group is not None:
txn.put(sname, group) txn.put(sname, group)
if group == None: if group is None:
grouppar = '' grouppar = ''
else: else:
grouppar = group grouppar = group
@ -2649,7 +2649,7 @@ def write_lock_file(name):
if win(): if win():
user = get_env_var('USERNAME') user = get_env_var('USERNAME')
host = get_env_var('USERDOMAIN') host = get_env_var('USERDOMAIN')
if host == None: if host is None:
host = "" host = ""
else: else:
host = os.uname()[1] host = os.uname()[1]

View File

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

View File

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