From 2671a8cd502053dfa77dd880d762e6a35ece3ab0 Mon Sep 17 00:00:00 2001 From: Gerald Britton Date: Mon, 23 Feb 2009 19:11:46 +0000 Subject: [PATCH] Replace "== None" and "!= None" with "is None" and "is not None", respectively svn: r12098 --- src/Editors/_EditMediaRef.py | 18 +++++++++--------- src/PluginUtils/_GuiOptions.py | 2 +- src/QuickReports.py | 2 +- src/plugins/gramplet/AgeStats.py | 4 ++-- src/plugins/gramplet/DataEntryGramplet.py | 22 +++++++++++----------- src/plugins/gramplet/DescendGramplet.py | 2 +- src/plugins/gramplet/FanChartGramplet.py | 10 +++++----- src/plugins/gramplet/WhatsNext.py | 2 +- src/plugins/mapservices/eniroswedenmap.py | 2 +- test/GrampsDb/GrampsDbBase_Test.py | 2 +- test/GrampsDb/GrampsDbTestBase.py | 2 +- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/Editors/_EditMediaRef.py b/src/Editors/_EditMediaRef.py index d6a9de7ff..96a51fd3c 100644 --- a/src/Editors/_EditMediaRef.py +++ b/src/Editors/_EditMediaRef.py @@ -225,7 +225,7 @@ class EditMediaRef(EditReference): @param value: the first corner x coordinate of the subsection in int """ - if self.rectangle == None: + if self.rectangle is None: self.rectangle = (0,0,100,100) self.rectangle = (value, self.rectangle[1], @@ -242,7 +242,7 @@ class EditMediaRef(EditReference): @param value: the first corner y coordinate of the subsection in int """ - if self.rectangle == None: + if self.rectangle is None: self.rectangle = (0,0,100,100) self.rectangle = (self.rectangle[0], value, @@ -259,7 +259,7 @@ class EditMediaRef(EditReference): @param value: the second corner x coordinate of the subsection in int """ - if self.rectangle == None: + if self.rectangle is None: self.rectangle = (0,0,100,100) self.rectangle = (self.rectangle[0], self.rectangle[1], @@ -276,7 +276,7 @@ class EditMediaRef(EditReference): @param value: the second corner y coordinate of the subsection in int """ - if self.rectangle == None: + if self.rectangle is None: self.rectangle = (0,0,100,100) self.rectangle = (self.rectangle[0], self.rectangle[1], @@ -293,7 +293,7 @@ class EditMediaRef(EditReference): there is no selection """ - if self.rectangle != None: + if self.rectangle is not None: return self.rectangle[0] else: return 0 @@ -307,7 +307,7 @@ class EditMediaRef(EditReference): there is no selection """ - if self.rectangle != None: + if self.rectangle is not None: return self.rectangle[1] else: return 0 @@ -321,7 +321,7 @@ class EditMediaRef(EditReference): there is no selection """ - if self.rectangle != None: + if self.rectangle is not None: return self.rectangle[2] else: return 100 @@ -335,7 +335,7 @@ class EditMediaRef(EditReference): there is no selection """ - if self.rectangle != None: + if self.rectangle is not None: return self.rectangle[3] else: return 100 @@ -346,7 +346,7 @@ class EditMediaRef(EditReference): """ path = self.source.get_path() - if path == None: + if path is None: self.subpixmap.hide() else: try: diff --git a/src/PluginUtils/_GuiOptions.py b/src/PluginUtils/_GuiOptions.py index 1a74e0b3a..39c9d5fd5 100644 --- a/src/PluginUtils/_GuiOptions.py +++ b/src/PluginUtils/_GuiOptions.py @@ -1417,7 +1417,7 @@ def make_gui_option(option, tooltips, dbstate, uistate, track): label = True pmgr = gen.plug.PluginManager.get_instance() external_options = pmgr.get_external_opt_dict() - if tooltips == None: + if tooltips is None: tooltips = gtk.Tooltips() elif type(tooltips) == type(""): msg = tooltips diff --git a/src/QuickReports.py b/src/QuickReports.py index 6e75aa65f..fee903277 100644 --- a/src/QuickReports.py +++ b/src/QuickReports.py @@ -118,7 +118,7 @@ def get_quick_report_list(qv_category=None): names = [] pmgr = PluginManager.get_instance() for item in pmgr.get_quick_report_list(): - if qv_category == item[2] or qv_category == None: + if qv_category == item[2] or qv_category is None: names.append(item[1:]) # (see below for item struct) return names diff --git a/src/plugins/gramplet/AgeStats.py b/src/plugins/gramplet/AgeStats.py index 1d046fcfe..99145c6c9 100644 --- a/src/plugins/gramplet/AgeStats.py +++ b/src/plugins/gramplet/AgeStats.py @@ -192,9 +192,9 @@ class AgeStatsGramplet(Gramplet): text = (text + (fill * width))[:width] elif align == "right": text = ((fill * width) + text)[-width:] - if borders[0] != None: + if borders[0] is not None: text = borders[0] + text - if borders[1] != None: + if borders[1] is not None: text = text + borders[1] return text diff --git a/src/plugins/gramplet/DataEntryGramplet.py b/src/plugins/gramplet/DataEntryGramplet.py index 0919a05b7..6d1c66fa0 100644 --- a/src/plugins/gramplet/DataEntryGramplet.py +++ b/src/plugins/gramplet/DataEntryGramplet.py @@ -193,7 +193,7 @@ class DataEntryGramplet(Gramplet): label.set_text("%s: " % text) label.set_width_chars(self.de_column_width) label.set_alignment(1.0, 0.5) - if choices == None: + if choices is None: self.de_widgets[pos] = gtk.Entry() if mark_dirty: self.de_widgets[pos].connect("changed", self.mark_dirty) @@ -294,7 +294,7 @@ class DataEntryGramplet(Gramplet): def get_or_create_event(self, object, type, date, place): """ Add or find a type event on object """ - if date == place == None: return (-1, None) + if date is place is None: return (-1, None) # first, see if it exists ref_list = object.get_event_ref_list() # look for a match, and possible correction @@ -321,7 +321,7 @@ class DataEntryGramplet(Gramplet): return (1, event) def make_event(self, type, date, place): - if date == place == None: return None + if date is place is None: return None event = gen.lib.Event() event.set_type(gen.lib.EventType(type)) if date: @@ -408,7 +408,7 @@ class DataEntryGramplet(Gramplet): pass elif self.de_widgets["NPRelation"].get_active() == self.AS_PARENT: # "Add as a Parent" - if current_person == None: + if current_person is None: ErrorDialog(_("Please set an active person."), _("Can't add new person as a parent.")) return elif gender == gen.lib.Person.UNKNOWN: # unknown @@ -416,7 +416,7 @@ class DataEntryGramplet(Gramplet): return elif self.de_widgets["NPRelation"].get_active() == self.AS_SPOUSE: # "Add as a Spouse" - if current_person == None: + if current_person is None: ErrorDialog(_("Please set an active person."), _("Can't add new person as a spouse.")) return elif (gender == gen.lib.Person.UNKNOWN and @@ -425,12 +425,12 @@ class DataEntryGramplet(Gramplet): return elif self.de_widgets["NPRelation"].get_active() == self.AS_SIBLING: # "Add as a Sibling" - if current_person == None: + if current_person is None: ErrorDialog(_("Please set an active person."), _("Can't add new person as a sibling.")) return elif self.de_widgets["NPRelation"].get_active() == self.AS_CHILD: # "Add as a Child" - if current_person == None: + if current_person is None: ErrorDialog(_("Please set an active person."), _("Can't add new person as a child.")) return # Start the transaction: ------------------------------------------------------------ @@ -470,14 +470,14 @@ class DataEntryGramplet(Gramplet): fam_husband_handle = family.get_father_handle() fam_wife_handle = family.get_mother_handle() # can we add person as wife? - if fam_wife_handle == None and person.get_gender() == gen.lib.Person.FEMALE: + if fam_wife_handle is None and person.get_gender() == gen.lib.Person.FEMALE: # add the person family.set_mother_handle(person.get_handle()) family.set_relationship(gen.lib.FamilyRelType.MARRIED) person.add_family_handle(family.get_handle()) added = True break - elif fam_husband_handle == None and person.get_gender() == gen.lib.Person.MALE: + elif fam_husband_handle is None and person.get_gender() == gen.lib.Person.MALE: # add the person family.set_father_handle(person.get_handle()) family.set_relationship(gen.lib.FamilyRelType.MARRIED) @@ -513,7 +513,7 @@ class DataEntryGramplet(Gramplet): fam_wife_handle = family.get_mother_handle() if current_person.get_handle() == fam_husband_handle: # can we add person as wife? - if fam_wife_handle == None: + if fam_wife_handle is None: if person.get_gender() == gen.lib.Person.FEMALE: # add the person family.set_mother_handle(person.get_handle()) @@ -531,7 +531,7 @@ class DataEntryGramplet(Gramplet): break elif current_person.get_handle() == fam_wife_handle: # can we add person as husband? - if fam_husband_handle == None: + if fam_husband_handle is None: if person.get_gender() == gen.lib.Person.MALE: # add the person family.set_father_handle(person.get_handle()) diff --git a/src/plugins/gramplet/DescendGramplet.py b/src/plugins/gramplet/DescendGramplet.py index c6b3797e6..ae8651b3a 100644 --- a/src/plugins/gramplet/DescendGramplet.py +++ b/src/plugins/gramplet/DescendGramplet.py @@ -56,7 +56,7 @@ class DescendantGramplet(Gramplet): self.update() def main(self): - if self.dbstate.get_active_person() == None: + if self.dbstate.get_active_person() is None: self.set_text(_("No Active Person selected.")) return self.set_text("") diff --git a/src/plugins/gramplet/FanChartGramplet.py b/src/plugins/gramplet/FanChartGramplet.py index 7bdee3385..e612a11a3 100644 --- a/src/plugins/gramplet/FanChartGramplet.py +++ b/src/plugins/gramplet/FanChartGramplet.py @@ -297,7 +297,7 @@ class FanChartWidget(gtk.Widget): cr.set_line_width(3) cr.stroke() cr.set_line_width(1) - if self.last_x == None or self.last_y == None: + if self.last_x is None or self.last_y is None: self.draw_text(cr, name, radius - self.pixels_per_generation/2, start, stop) @@ -452,13 +452,13 @@ class FanChartWidget(gtk.Widget): def on_mouse_up(self, widget, event): # Done with mouse movement - if self.last_x == None or self.last_y == None: return True + if self.last_x is None or self.last_y is None: return True self.queue_draw() self.last_x, self.last_y = None, None return True def on_mouse_move(self, widget, event): - if self.last_x == None or self.last_y == None: return False + if self.last_x is None or self.last_y is None: return False x, y, w, h = self.allocation cx = w/2 cy = h/2 @@ -502,7 +502,7 @@ class FanChartWidget(gtk.Widget): selected = p break # Handle the click: - if selected == None: # clicked in open area, or center + if selected is None: # clicked in open area, or center if radius < self.center: # right mouse if event.button == 3 and self.context_popup_callback: @@ -556,7 +556,7 @@ class FanChartGramplet(Gramplet): if person: m = self.get_parent(person, "female") f = self.get_parent(person, "male") - return m != None or f != None + return not m is f is None return False def have_children(self, person): diff --git a/src/plugins/gramplet/WhatsNext.py b/src/plugins/gramplet/WhatsNext.py index caa79fd25..013157a36 100644 --- a/src/plugins/gramplet/WhatsNext.py +++ b/src/plugins/gramplet/WhatsNext.py @@ -75,7 +75,7 @@ class WhatNextGramplet(Gramplet): def main(self): default_person = self.dbstate.db.get_default_person() - if default_person == None: + if default_person is None: self.set_text(_("No Home Person set.")) return diff --git a/src/plugins/mapservices/eniroswedenmap.py b/src/plugins/mapservices/eniroswedenmap.py index e392bf185..465aa0b84 100644 --- a/src/plugins/mapservices/eniroswedenmap.py +++ b/src/plugins/mapservices/eniroswedenmap.py @@ -125,7 +125,7 @@ class EniroSVMapService(MapService): # 54 33' 0" < lat < 66 9' 0", 54.55 and 69.05 # 8 3' 0" < long < 24 9' 0", 8.05 and 24.15 latitude, longitude = self._lat_lon(place) - if latitude == None or longitude == None: + if latitude is None or longitude is None: coord_ok = False else: latitude = float(latitude) diff --git a/test/GrampsDb/GrampsDbBase_Test.py b/test/GrampsDb/GrampsDbBase_Test.py index 4aae361fb..6c355d35f 100644 --- a/test/GrampsDb/GrampsDbBase_Test.py +++ b/test/GrampsDb/GrampsDbBase_Test.py @@ -115,7 +115,7 @@ class ReferenceMapTest (GrampsDbBaseTest): self._db.remove_person(person.get_handle(),tran) self._db.transaction_commit(tran, "Del Person") - assert self._db.get_person_from_handle(person.get_handle()) == None + assert self._db.get_person_from_handle(person.get_handle()) is None references = [ ref for ref in self._db.find_backlink_handles(source.get_handle()) ] diff --git a/test/GrampsDb/GrampsDbTestBase.py b/test/GrampsDb/GrampsDbTestBase.py index 37d58e902..427909f14 100644 --- a/test/GrampsDb/GrampsDbTestBase.py +++ b/test/GrampsDb/GrampsDbTestBase.py @@ -85,7 +85,7 @@ class GrampsDbBaseTest(unittest.TestCase): tran = self._db.transaction_begin() source = RelLib.Source() - if repos != None: + if repos is not None: repo_ref = RelLib.RepoRef() repo_ref.set_reference_handle(repos.get_handle()) source.add_repo_reference(repo_ref)