Replace == and != with is and is not for comparisons with None

This commit is contained in:
dmiller 2014-01-09 16:47:20 +00:00
parent 96141b431e
commit 51b143353b
18 changed files with 61 additions and 64 deletions

View file

@ -398,7 +398,7 @@ class OptionTab(object):
def fill_table(self, table, expand_fill=True):
yopt = (0, gtk.EXPAND | gtk.FILL)[expand_fill]
for y, widget in enumerate(self.widgets_list):
if widget[1] == None:
if widget[1] is None:
table.attach(widget[0], 0, 2, y, y + 1, yoptions=yopt)
else:
table.attach(widget[0], 0, 1, y, y + 1, yoptions=yopt)

View file

@ -439,7 +439,7 @@ class SearchGUI(gtk.VBox, object):
self.search_entry.set_sensitive(True)
def close(self):
if self.expr_window != None:
if self.expr_window is not None:
self.expr_window.close()
def add_criterion(self, caller):
@ -854,11 +854,11 @@ class DateSubcriterion(Subcriterion):
self.fuzzies = argument.count("~")
argument = argument.replace("~", "")
self.minus_notation = False
if re.match("\d\d\d\d-\d\d-\d\d$", argument) != None:
if re.match("\d\d\d\d-\d\d-\d\d$", argument) is not None:
year, month, day = argument.split("-")
self.date = datetime.date(int(year), int(month), int(day))
self.argument = argument
elif re.match("[-|\+]\d+$", argument) != None:
elif re.match("[-|\+]\d+$", argument) is not None:
# Convert the date from the "-n" notation into YYYY-MM-DD
parsed_date = datetime.date.fromordinal(
datetime.date.today().toordinal() + int(argument))

View file

@ -240,17 +240,17 @@ class HIGSpinnerCache:
"""Loads an animated icon by doing a lookup on the icon theme."""
# If user do not choose a icon_name, use the default one
if icon_name == None:
if icon_name is None:
icon_name = self.default_animated_icon_name
# Even the default one (now on icon_name) might not be available
if icon_name == None:
if icon_name is None:
raise AnimatedIconNotFound
# Try to lookup the icon
icon_info = self.icon_theme.lookup_icon(icon_name, -1, 0)
# Even if icon_name exists, it might not be found by lookup
if icon_info == None:
if icon_info is None:
raise AnimatedIconNotFound
# Base size is, according to PyGTK docs:
@ -291,7 +291,7 @@ class HIGSpinnerCache:
def load_static_from_filename(self, filename, key_name=None):
icon_pixbuf = gtk.gdk.pixbuf_new_from_file(filename)
if key_name == None:
if key_name is None:
key_name = filename.split(".")[0]
self.spinner_images.add_static_pixbuf(key_name, icon_pixbuf)
@ -420,7 +420,7 @@ class HIGSpinner(gtk.EventBox):
def do_expose_event(self, event):
#self.chain(event)
if self.cache.spinner_images.rest_pixbuf == None:
if self.cache.spinner_images.rest_pixbuf is None:
raise RestPixbufNotFound
self.__select_pixbuf()
@ -437,7 +437,7 @@ class HIGSpinner(gtk.EventBox):
dest = event.area.intersect(pix_area)
# If a graphic context doesn't not exist yet, create one
if self.gc == None:
if self.gc is None:
self.gc = gtk.gdk.GC(self.window)
#gc = self.gc