Skip to content

Commit

Permalink
replace equality None check with identity None check
Browse files Browse the repository at this point in the history
  • Loading branch information
hduelme authored and mtwebster committed Nov 1, 2022
1 parent 18d2377 commit dd334a6
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 65 deletions.
30 changes: 15 additions & 15 deletions calendar-server/cinnamon-calendar-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ def destroy(self):

self.disconnect(self.owner_color_signal_id)

if self.view_cancellable != None:
if self.view_cancellable is not None:
self.view_cancellable.cancel()

if self.view != None:
if self.view is not None:
self.view.stop()
self.view = None

Expand Down Expand Up @@ -111,7 +111,7 @@ def __init__(self, hold=False):
def update_timezone(self):
location = ECal.system_timezone_get_location()

if location == None:
if location is None:
self.zone = ICalGLib.Timezone.get_utc_timezone().copy()
else:
self.zone = ICalGLib.Timezone.get_builtin_timezone(location).copy()
Expand Down Expand Up @@ -243,11 +243,11 @@ def handle_exit(self, iface, inv):
def create_view_for_calendar(self, calendar):
self.hold()

if calendar.view_cancellable != None:
if calendar.view_cancellable is not None:
calendar.view_cancellable.cancel()
calendar.view_cancellable = Gio.Cancellable()

if calendar.view != None:
if calendar.view is not None:
calendar.view.stop()
calendar.view = None

Expand Down Expand Up @@ -302,7 +302,7 @@ def handle_new_or_modified_objects(self, view, objects, calendar):

for ical_comp in objects:

if ical_comp.get_uid() == None:
if ical_comp.get_uid() is None:
continue

if (not ECal.util_component_is_instance (ical_comp)) and \
Expand All @@ -318,7 +318,7 @@ def handle_new_or_modified_objects(self, view, objects, calendar):
else:
comp = ECal.Component.new_from_icalcomponent(ical_comp)
comptext = comp.get_summary()
if comptext != None:
if comptext is not None:
summary = comptext.get_value()
else:
summary = ""
Expand All @@ -330,7 +330,7 @@ def handle_new_or_modified_objects(self, view, objects, calendar):

dte_prop = ical_comp.get_first_property(ICalGLib.PropertyKind.DTEND_PROPERTY)

if dte_prop != None:
if dte_prop is not None:
ical_time_end = dte_prop.get_dtend()
end_timet = self.ical_time_get_timet(calendar.client, ical_time_end, dte_prop)
else:
Expand Down Expand Up @@ -362,19 +362,19 @@ def recurrence_generated(self, ical_comp, instance_start, instance_end, calendar
all_objects = GLib.VariantBuilder(GLib.VariantType.new("a(sssbxx)"))

comptext = comp.get_summary()
if comptext != None:
if comptext is not None:
summary = comptext.get_value()
else:
summary = ""

default_zone = calendar.client.get_default_timezone()

dts_timezone = instance_start.get_timezone()
if dts_timezone == None:
if dts_timezone is None:
dts_timezone = default_zone

dte_timezone = instance_end.get_timezone()
if dte_timezone == None:
if dte_timezone is None:
dte_timezone = default_zone

all_day = instance_start.is_date()
Expand Down Expand Up @@ -429,12 +429,12 @@ def get_mod_timet(self, ical_comp):
mod_timet = 0

mod_prop = ical_comp.get_first_property(ICalGLib.PropertyKind.LASTMODIFIED_PROPERTY)
if mod_prop != None:
if mod_prop is not None:
ical_time_modified = mod_prop.get_lastmodified()
mod_timet = ical_time_modified.as_timet()
else:
created_prop = ical_comp.get_first_property(ICalGLib.PropertyKind.CREATED_PROPERTY)
if created_prop != None:
if created_prop is not None:
ical_time_created = created_prop.get_created()
mod_timet = ical_time_created.as_timet()

Expand All @@ -460,7 +460,7 @@ def create_uid(self, calendar, ecal_comp):
return self.get_id_from_comp_id(comp_id, source_id)

def get_id_from_comp_id(self, comp_id, source_id):
if comp_id.get_rid() != None:
if comp_id.get_rid() is not None:
return "%s:%s:%s" % (source_id, comp_id.get_uid(), comp_id.get_rid())
else:
return "%s:%s" % (source_id, comp_id.get_uid())
Expand All @@ -482,7 +482,7 @@ def handle_removed_objects(self, view, component_ids, calendar):
self.interface.emit_events_removed(uids_string)

def exit(self):
if self.registry_watcher != None:
if self.registry_watcher is not None:
self.registry_watcher.disconnect(self.client_appeared_id)
self.registry_watcher.disconnect(self.client_disappeared_id)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
#If we have no defined file type or no file url, skip
continue
result_types = cursor.get_string(7)[0].split(",")
while len(result_types) > 0 and defined_type == None:
while len(result_types) > 0 and defined_type is None:
t = result_types.pop()
if t in CONVERT_TYPES:
defined_type = CONVERT_TYPES[t]
if defined_type == None:
if defined_type is None:
defined_type = "files"
if len(results.setdefault(defined_type, [])) < 10:
results.setdefault(defined_type, []).append({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def __init__ (self):
def add_labels(self, texts):
row = 0
for text in texts:
if text != None:
if text is not None:
label = Gtk.Label(text)
label.set_alignment(1, 0.5)
label.get_style_context().add_class("dim-label")
Expand Down Expand Up @@ -611,14 +611,14 @@ def __init__(self):

def _on_password_button_clicked(self, widget):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
dialog = PasswordDialog(user, self.password_mask, self.groups_label, self.window)
response = dialog.run()

def _on_groups_button_clicked(self, widget):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
dialog = GroupsDialog(user.get_user_name(), self.window)
response = dialog.run()
Expand All @@ -631,7 +631,7 @@ def _on_groups_button_clicked(self, widget):

def _on_accounttype_changed(self, combobox):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
if self.account_type_combo.get_active() == 1:
user.set_account_type(AccountsService.UserAccountType.ADMINISTRATOR)
Expand All @@ -647,15 +647,15 @@ def _on_accounttype_changed(self, combobox):

def _on_realname_changed(self, widget, text):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
user.set_real_name(text)
description = "<b>%s</b>\n%s" % (text, user.get_user_name())
model.set_value(treeiter, INDEX_USER_DESCRIPTION, description)

def _on_face_browse_menuitem_activated(self, menuitem):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
dialog = Gtk.FileChooserDialog(None, None, Gtk.FileChooserAction.OPEN, (_("Cancel"), Gtk.ResponseType.CANCEL, _("Open"), Gtk.ResponseType.OK))
filter = Gtk.FileFilter()
Expand Down Expand Up @@ -722,7 +722,7 @@ def update_preview_cb (self, dialog, preview):
def _on_face_menuitem_activated(self, menuitem, path):
if os.path.exists(path):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
user.set_icon_file(path)
self.face_image.set_from_file(path)
Expand Down Expand Up @@ -796,7 +796,7 @@ def on_user_selection(self, selection):
self.password_button.set_tooltip_text("")

model, treeiter = selection.get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
self.builder.get_object("button_delete_user").set_sensitive(True)
self.realname_entry.set_text(user.get_real_name())
Expand Down Expand Up @@ -824,7 +824,7 @@ def on_user_selection(self, selection):
message = "Could not load pixbuf from '%s': %s" % (path, e.message)
error = True

if pixbuf != None:
if pixbuf is not None:
if pixbuf.get_height() > 96 or pixbuf.get_width() > 96:
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(path, 96, 96)
Expand Down Expand Up @@ -866,7 +866,7 @@ def on_user_selection(self, selection):

def on_user_deletion(self, event):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
user = model[treeiter][INDEX_USER_OBJECT]
message = _("Are you sure you want to permanently delete %s and all the files associated with this user?") % user.get_user_name()
d = Gtk.MessageDialog(self.window,
Expand Down Expand Up @@ -909,14 +909,14 @@ def on_user_addition(self, event):

def on_user_edition(self, event):
model, treeiter = self.users_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
print("Editing user %s" % model[treeiter][INDEX_USER_OBJECT].get_user_name())

# GROUPS CALLBACKS

def on_group_selection(self, selection):
model, treeiter = selection.get_selected()
if treeiter != None:
if treeiter is not None:
self.builder.get_object("button_edit_group").set_sensitive(True)
self.builder.get_object("button_delete_group").set_sensitive(True)
self.builder.get_object("button_delete_group").set_tooltip_text("")
Expand All @@ -936,7 +936,7 @@ def on_group_selection(self, selection):

def on_group_deletion(self, event):
model, treeiter = self.groups_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
group = model[treeiter][INDEX_GROUPNAME]
message = _("Are you sure you want to permanently delete %s?") % group
d = Gtk.MessageDialog(self.window,
Expand All @@ -962,7 +962,7 @@ def on_group_addition(self, event):

def on_group_edition(self, event):
model, treeiter = self.groups_treeview.get_selection().get_selected()
if treeiter != None:
if treeiter is not None:
group = model[treeiter][INDEX_GROUPNAME]
dialog = GroupDialog(_("Group Name"), group, self.window)
response = dialog.run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def set_picture_from_file (self, path):
message = "Could not load pixbuf from '%s': %s" % (path, e.message)
error = True

if pixbuf != None:
if pixbuf is not None:
h = pixbuf.get_height()
w = pixbuf.get_width()

Expand Down Expand Up @@ -176,7 +176,7 @@ def add_picture(self, path, callback, title=None, id=None):
message = "Could not load pixbuf from '%s': %s" % (path, e.message)
error = True

if pixbuf != None:
if pixbuf is not None:
h = pixbuf.get_height()
w = pixbuf.get_width()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ def refresh(self, *args):

def build_list(self, *args):
spices_data = self.spices.get_cache()
if spices_data == None:
if spices_data is None:
return

if len(self.extension_rows) > 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def object_value_changed(self, obj, value, key):
for info in self.bindings[key]:
if obj == info["obj"]:
value = info["obj"].get_property(info["prop"])
if "map_set" in info and info["map_set"] != None:
if "map_set" in info and info["map_set"] is not None:
value = info["map_set"](value)

for info in self.bindings[key]:
Expand All @@ -126,7 +126,7 @@ def set_object_value(self, info, value):
return

with info["obj"].freeze_notify():
if "map_get" in info and info["map_get"] != None:
if "map_get" in info and info["map_get"] is not None:
value = info["map_get"](value)
if value != info["obj"].get_property(info["prop"]) and value is not None:
info["obj"].set_property(info["prop"], value)
Expand Down Expand Up @@ -279,7 +279,7 @@ def attach(self):
bind_object = self.bind_object
else:
bind_object = self.content_widget
if self.bind_dir != None:
if self.bind_dir is not None:
self.settings.bind(self.key, bind_object, self.bind_prop, self.bind_dir,
self.map_get if hasattr(self, "map_get") else None,
self.map_set if hasattr(self, "map_set") else None)
Expand Down Expand Up @@ -309,7 +309,7 @@ def on_setting_changed(self, *args):
raise NotImplementedError("SettingsWidget class must implement on_setting_changed().")

def connect_widget_handlers(self, *args):
if self.bind_dir == None:
if self.bind_dir is None:
raise NotImplementedError("SettingsWidget classes with no .bind_dir must implement connect_widget_handlers().")

def json_settings_factory(subclass):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(self):

env = GLib.getenv("PATH")

if env == None:
if env is None:
env = "/bin:/usr/bin:."

self.paths = env.split(":")
Expand Down Expand Up @@ -58,7 +58,7 @@ def queue_emit_changed(self, file, other, event_type, data=None):
def get_file_monitor():
global file_monitor

if file_monitor == None:
if file_monitor is None:
file_monitor = BinFileMonitor()

return file_monitor
Expand Down Expand Up @@ -196,7 +196,7 @@ def __init__(self, name, icon, keywords, content_box = None, size = None, is_c_m
self.topWindow = None
self.builder = None
self.stack = None
if self.module != None:
if self.module is not None:
self.module.loaded = False

def add_widget(self, widget):
Expand Down
4 changes: 2 additions & 2 deletions files/usr/share/cinnamon/cinnamon-settings/bin/imtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ def put_palette(image_to, image_from, palette=None):
:param palette: image palette
:type palette: sequence of (r, g, b) tuples or None
"""
if palette == None:
if palette is None:
palette = get_palette(image_from)
image_to.putpalette(flatten(palette))
if 'transparency' in image_from.info:
Expand Down Expand Up @@ -853,7 +853,7 @@ def paste(destination, source, box=(0, 0), mask=None, force=False):
source_without_alpha = remove_alpha(source)
# paste on top of the opaque destination pixels
destination.paste(source_without_alpha, box, source)
if invert_alpha != None:
if invert_alpha is not None:
# the alpha channel is ok now, so save it
destination_alpha = get_alpha(destination)
# paste on top of the transparant destination pixels
Expand Down
6 changes: 3 additions & 3 deletions files/usr/share/cinnamon/cinnamon-settings/bin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ def strip_syspath_locals():

def _get_gsound_context():
global gsound_context
if (gsound_context == None):
if gsound_context is None:
gsound_context = GSound.Context()
gsound_context.init()
return gsound_context

def play_sound_name(name, channel = None):
params = {GSound.ATTR_EVENT_ID: name, GSound.ATTR_MEDIA_ROLE: "test"}
if channel != None:
if channel is not None:
params[GSound.ATTR_CANBERRA_FORCE_CHANNEL] = channel
_get_gsound_context().play_simple(params)

def play_sound_file(path, channel = None):
params = {GSound.ATTR_MEDIA_FILENAME: path, GSound.ATTR_MEDIA_ROLE: "test"}
if channel != None:
if channel is not None:
params[GSound.ATTR_CANBERRA_FORCE_CHANNEL] = channel
_get_gsound_context().play_simple(params)
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def get_label_min_width(self, model):
min_width_pixels = 0
icon_view = Gtk.IconView()
iter = model.get_iter_first()
while iter != None:
while iter is not None:
string = model.get_value(iter, 0)
split_by_word = string.split(" ")
for word in split_by_word:
Expand Down
Loading

0 comments on commit dd334a6

Please sign in to comment.