Skip to content

Commit dd334a6

Browse files
hduelmemtwebster
authored andcommitted
replace equality None check with identity None check
1 parent 18d2377 commit dd334a6

21 files changed

+65
-65
lines changed

Diff for: calendar-server/cinnamon-calendar-server.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ def destroy(self):
5353

5454
self.disconnect(self.owner_color_signal_id)
5555

56-
if self.view_cancellable != None:
56+
if self.view_cancellable is not None:
5757
self.view_cancellable.cancel()
5858

59-
if self.view != None:
59+
if self.view is not None:
6060
self.view.stop()
6161
self.view = None
6262

@@ -111,7 +111,7 @@ def __init__(self, hold=False):
111111
def update_timezone(self):
112112
location = ECal.system_timezone_get_location()
113113

114-
if location == None:
114+
if location is None:
115115
self.zone = ICalGLib.Timezone.get_utc_timezone().copy()
116116
else:
117117
self.zone = ICalGLib.Timezone.get_builtin_timezone(location).copy()
@@ -243,11 +243,11 @@ def handle_exit(self, iface, inv):
243243
def create_view_for_calendar(self, calendar):
244244
self.hold()
245245

246-
if calendar.view_cancellable != None:
246+
if calendar.view_cancellable is not None:
247247
calendar.view_cancellable.cancel()
248248
calendar.view_cancellable = Gio.Cancellable()
249249

250-
if calendar.view != None:
250+
if calendar.view is not None:
251251
calendar.view.stop()
252252
calendar.view = None
253253

@@ -302,7 +302,7 @@ def handle_new_or_modified_objects(self, view, objects, calendar):
302302

303303
for ical_comp in objects:
304304

305-
if ical_comp.get_uid() == None:
305+
if ical_comp.get_uid() is None:
306306
continue
307307

308308
if (not ECal.util_component_is_instance (ical_comp)) and \
@@ -318,7 +318,7 @@ def handle_new_or_modified_objects(self, view, objects, calendar):
318318
else:
319319
comp = ECal.Component.new_from_icalcomponent(ical_comp)
320320
comptext = comp.get_summary()
321-
if comptext != None:
321+
if comptext is not None:
322322
summary = comptext.get_value()
323323
else:
324324
summary = ""
@@ -330,7 +330,7 @@ def handle_new_or_modified_objects(self, view, objects, calendar):
330330

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

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

364364
comptext = comp.get_summary()
365-
if comptext != None:
365+
if comptext is not None:
366366
summary = comptext.get_value()
367367
else:
368368
summary = ""
369369

370370
default_zone = calendar.client.get_default_timezone()
371371

372372
dts_timezone = instance_start.get_timezone()
373-
if dts_timezone == None:
373+
if dts_timezone is None:
374374
dts_timezone = default_zone
375375

376376
dte_timezone = instance_end.get_timezone()
377-
if dte_timezone == None:
377+
if dte_timezone is None:
378378
dte_timezone = default_zone
379379

380380
all_day = instance_start.is_date()
@@ -429,12 +429,12 @@ def get_mod_timet(self, ical_comp):
429429
mod_timet = 0
430430

431431
mod_prop = ical_comp.get_first_property(ICalGLib.PropertyKind.LASTMODIFIED_PROPERTY)
432-
if mod_prop != None:
432+
if mod_prop is not None:
433433
ical_time_modified = mod_prop.get_lastmodified()
434434
mod_timet = ical_time_modified.as_timet()
435435
else:
436436
created_prop = ical_comp.get_first_property(ICalGLib.PropertyKind.CREATED_PROPERTY)
437-
if created_prop != None:
437+
if created_prop is not None:
438438
ical_time_created = created_prop.get_created()
439439
mod_timet = ical_time_created.as_timet()
440440

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

462462
def get_id_from_comp_id(self, comp_id, source_id):
463-
if comp_id.get_rid() != None:
463+
if comp_id.get_rid() is not None:
464464
return "%s:%s:%s" % (source_id, comp_id.get_uid(), comp_id.get_rid())
465465
else:
466466
return "%s:%s" % (source_id, comp_id.get_uid())
@@ -482,7 +482,7 @@ def handle_removed_objects(self, view, component_ids, calendar):
482482
self.interface.emit_events_removed(uids_string)
483483

484484
def exit(self):
485-
if self.registry_watcher != None:
485+
if self.registry_watcher is not None:
486486
self.registry_watcher.disconnect(self.client_appeared_id)
487487
self.registry_watcher.disconnect(self.client_disappeared_id)
488488

Diff for: docs/search-providers-examples/[email protected]/search_provider.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@
3838
#If we have no defined file type or no file url, skip
3939
continue
4040
result_types = cursor.get_string(7)[0].split(",")
41-
while len(result_types) > 0 and defined_type == None:
41+
while len(result_types) > 0 and defined_type is None:
4242
t = result_types.pop()
4343
if t in CONVERT_TYPES:
4444
defined_type = CONVERT_TYPES[t]
45-
if defined_type == None:
45+
if defined_type is None:
4646
defined_type = "files"
4747
if len(results.setdefault(defined_type, [])) < 10:
4848
results.setdefault(defined_type, []).append({

Diff for: files/usr/share/cinnamon/cinnamon-settings-users/cinnamon-settings-users.py

+14-14
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def __init__ (self):
104104
def add_labels(self, texts):
105105
row = 0
106106
for text in texts:
107-
if text != None:
107+
if text is not None:
108108
label = Gtk.Label(text)
109109
label.set_alignment(1, 0.5)
110110
label.get_style_context().add_class("dim-label")
@@ -611,14 +611,14 @@ def __init__(self):
611611

612612
def _on_password_button_clicked(self, widget):
613613
model, treeiter = self.users_treeview.get_selection().get_selected()
614-
if treeiter != None:
614+
if treeiter is not None:
615615
user = model[treeiter][INDEX_USER_OBJECT]
616616
dialog = PasswordDialog(user, self.password_mask, self.groups_label, self.window)
617617
response = dialog.run()
618618

619619
def _on_groups_button_clicked(self, widget):
620620
model, treeiter = self.users_treeview.get_selection().get_selected()
621-
if treeiter != None:
621+
if treeiter is not None:
622622
user = model[treeiter][INDEX_USER_OBJECT]
623623
dialog = GroupsDialog(user.get_user_name(), self.window)
624624
response = dialog.run()
@@ -631,7 +631,7 @@ def _on_groups_button_clicked(self, widget):
631631

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

648648
def _on_realname_changed(self, widget, text):
649649
model, treeiter = self.users_treeview.get_selection().get_selected()
650-
if treeiter != None:
650+
if treeiter is not None:
651651
user = model[treeiter][INDEX_USER_OBJECT]
652652
user.set_real_name(text)
653653
description = "<b>%s</b>\n%s" % (text, user.get_user_name())
654654
model.set_value(treeiter, INDEX_USER_DESCRIPTION, description)
655655

656656
def _on_face_browse_menuitem_activated(self, menuitem):
657657
model, treeiter = self.users_treeview.get_selection().get_selected()
658-
if treeiter != None:
658+
if treeiter is not None:
659659
user = model[treeiter][INDEX_USER_OBJECT]
660660
dialog = Gtk.FileChooserDialog(None, None, Gtk.FileChooserAction.OPEN, (_("Cancel"), Gtk.ResponseType.CANCEL, _("Open"), Gtk.ResponseType.OK))
661661
filter = Gtk.FileFilter()
@@ -722,7 +722,7 @@ def update_preview_cb (self, dialog, preview):
722722
def _on_face_menuitem_activated(self, menuitem, path):
723723
if os.path.exists(path):
724724
model, treeiter = self.users_treeview.get_selection().get_selected()
725-
if treeiter != None:
725+
if treeiter is not None:
726726
user = model[treeiter][INDEX_USER_OBJECT]
727727
user.set_icon_file(path)
728728
self.face_image.set_from_file(path)
@@ -796,7 +796,7 @@ def on_user_selection(self, selection):
796796
self.password_button.set_tooltip_text("")
797797

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

827-
if pixbuf != None:
827+
if pixbuf is not None:
828828
if pixbuf.get_height() > 96 or pixbuf.get_width() > 96:
829829
try:
830830
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(path, 96, 96)
@@ -866,7 +866,7 @@ def on_user_selection(self, selection):
866866

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

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

915915
# GROUPS CALLBACKS
916916

917917
def on_group_selection(self, selection):
918918
model, treeiter = selection.get_selected()
919-
if treeiter != None:
919+
if treeiter is not None:
920920
self.builder.get_object("button_edit_group").set_sensitive(True)
921921
self.builder.get_object("button_delete_group").set_sensitive(True)
922922
self.builder.get_object("button_delete_group").set_tooltip_text("")
@@ -936,7 +936,7 @@ def on_group_selection(self, selection):
936936

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

963963
def on_group_edition(self, event):
964964
model, treeiter = self.groups_treeview.get_selection().get_selected()
965-
if treeiter != None:
965+
if treeiter is not None:
966966
group = model[treeiter][INDEX_GROUPNAME]
967967
dialog = GroupDialog(_("Group Name"), group, self.window)
968968
response = dialog.run()

Diff for: files/usr/share/cinnamon/cinnamon-settings/bin/ChooserButtonWidgets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def set_picture_from_file (self, path):
124124
message = "Could not load pixbuf from '%s': %s" % (path, e.message)
125125
error = True
126126

127-
if pixbuf != None:
127+
if pixbuf is not None:
128128
h = pixbuf.get_height()
129129
w = pixbuf.get_width()
130130

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

179-
if pixbuf != None:
179+
if pixbuf is not None:
180180
h = pixbuf.get_height()
181181
w = pixbuf.get_width()
182182

Diff for: files/usr/share/cinnamon/cinnamon-settings/bin/ExtensionCore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ def refresh(self, *args):
995995

996996
def build_list(self, *args):
997997
spices_data = self.spices.get_cache()
998-
if spices_data == None:
998+
if spices_data is None:
999999
return
10001000

10011001
if len(self.extension_rows) > 0:

Diff for: files/usr/share/cinnamon/cinnamon-settings/bin/JsonSettingsWidgets.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def object_value_changed(self, obj, value, key):
109109
for info in self.bindings[key]:
110110
if obj == info["obj"]:
111111
value = info["obj"].get_property(info["prop"])
112-
if "map_set" in info and info["map_set"] != None:
112+
if "map_set" in info and info["map_set"] is not None:
113113
value = info["map_set"](value)
114114

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

128128
with info["obj"].freeze_notify():
129-
if "map_get" in info and info["map_get"] != None:
129+
if "map_get" in info and info["map_get"] is not None:
130130
value = info["map_get"](value)
131131
if value != info["obj"].get_property(info["prop"]) and value is not None:
132132
info["obj"].set_property(info["prop"], value)
@@ -279,7 +279,7 @@ def attach(self):
279279
bind_object = self.bind_object
280280
else:
281281
bind_object = self.content_widget
282-
if self.bind_dir != None:
282+
if self.bind_dir is not None:
283283
self.settings.bind(self.key, bind_object, self.bind_prop, self.bind_dir,
284284
self.map_get if hasattr(self, "map_get") else None,
285285
self.map_set if hasattr(self, "map_set") else None)
@@ -309,7 +309,7 @@ def on_setting_changed(self, *args):
309309
raise NotImplementedError("SettingsWidget class must implement on_setting_changed().")
310310

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

315315
def json_settings_factory(subclass):

Diff for: files/usr/share/cinnamon/cinnamon-settings/bin/SettingsWidgets.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self):
2828

2929
env = GLib.getenv("PATH")
3030

31-
if env == None:
31+
if env is None:
3232
env = "/bin:/usr/bin:."
3333

3434
self.paths = env.split(":")
@@ -58,7 +58,7 @@ def queue_emit_changed(self, file, other, event_type, data=None):
5858
def get_file_monitor():
5959
global file_monitor
6060

61-
if file_monitor == None:
61+
if file_monitor is None:
6262
file_monitor = BinFileMonitor()
6363

6464
return file_monitor
@@ -196,7 +196,7 @@ def __init__(self, name, icon, keywords, content_box = None, size = None, is_c_m
196196
self.topWindow = None
197197
self.builder = None
198198
self.stack = None
199-
if self.module != None:
199+
if self.module is not None:
200200
self.module.loaded = False
201201

202202
def add_widget(self, widget):

Diff for: files/usr/share/cinnamon/cinnamon-settings/bin/imtools.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ def put_palette(image_to, image_from, palette=None):
755755
:param palette: image palette
756756
:type palette: sequence of (r, g, b) tuples or None
757757
"""
758-
if palette == None:
758+
if palette is None:
759759
palette = get_palette(image_from)
760760
image_to.putpalette(flatten(palette))
761761
if 'transparency' in image_from.info:
@@ -853,7 +853,7 @@ def paste(destination, source, box=(0, 0), mask=None, force=False):
853853
source_without_alpha = remove_alpha(source)
854854
# paste on top of the opaque destination pixels
855855
destination.paste(source_without_alpha, box, source)
856-
if invert_alpha != None:
856+
if invert_alpha is not None:
857857
# the alpha channel is ok now, so save it
858858
destination_alpha = get_alpha(destination)
859859
# paste on top of the transparant destination pixels

Diff for: files/usr/share/cinnamon/cinnamon-settings/bin/util.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ def strip_syspath_locals():
2020

2121
def _get_gsound_context():
2222
global gsound_context
23-
if (gsound_context == None):
23+
if gsound_context is None:
2424
gsound_context = GSound.Context()
2525
gsound_context.init()
2626
return gsound_context
2727

2828
def play_sound_name(name, channel = None):
2929
params = {GSound.ATTR_EVENT_ID: name, GSound.ATTR_MEDIA_ROLE: "test"}
30-
if channel != None:
30+
if channel is not None:
3131
params[GSound.ATTR_CANBERRA_FORCE_CHANNEL] = channel
3232
_get_gsound_context().play_simple(params)
3333

3434
def play_sound_file(path, channel = None):
3535
params = {GSound.ATTR_MEDIA_FILENAME: path, GSound.ATTR_MEDIA_ROLE: "test"}
36-
if channel != None:
36+
if channel is not None:
3737
params[GSound.ATTR_CANBERRA_FORCE_CHANNEL] = channel
3838
_get_gsound_context().play_simple(params)

Diff for: files/usr/share/cinnamon/cinnamon-settings/cinnamon-settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ def get_label_min_width(self, model):
566566
min_width_pixels = 0
567567
icon_view = Gtk.IconView()
568568
iter = model.get_iter_first()
569-
while iter != None:
569+
while iter is not None:
570570
string = model.get_value(iter, 0)
571571
split_by_word = string.split(" ")
572572
for word in split_by_word:

0 commit comments

Comments
 (0)