From 9e6913231d307590fd6a9bc024be549aaa2d8c5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Tue, 5 Mar 2019 10:31:42 +0100 Subject: [PATCH 099/124] Fix checking for None values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In python, 'is None' should be used instead of '== None' to check if something is None. Signed-off-by: Ondřej Lysoněk --- experiments/kwin-stop/xlib-example.py | 2 +- tuned/plugins/plugin_systemd.py | 2 +- tuned/profiles/merger.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/experiments/kwin-stop/xlib-example.py b/experiments/kwin-stop/xlib-example.py index b8477a5..a0d6206 100644 --- a/experiments/kwin-stop/xlib-example.py +++ b/experiments/kwin-stop/xlib-example.py @@ -32,7 +32,7 @@ def loop(): root = dpy.screen(num).root for win in root.get_full_property(dpy.get_atom('_NET_CLIENT_LIST'), 0).value.tolist(): window = dpy.create_resource_object('window', win) - if window.get_full_property(dpy.get_atom('_NET_WM_STATE'), Xatom.WINDOW) == None: + if window.get_full_property(dpy.get_atom('_NET_WM_STATE'), Xatom.WINDOW) is None: continue if dpy.get_atom("_NET_WM_STATE_HIDDEN") in window.get_full_property(dpy.get_atom('_NET_WM_STATE'), 0).value.tolist(): if not win in hidden: diff --git a/tuned/plugins/plugin_systemd.py b/tuned/plugins/plugin_systemd.py index f6857c5..8f6bbc8 100644 --- a/tuned/plugins/plugin_systemd.py +++ b/tuned/plugins/plugin_systemd.py @@ -61,7 +61,7 @@ class SystemdPlugin(base.Plugin): def _read_systemd_system_conf(self): systemd_system_conf = self._cmd.read_file(consts.SYSTEMD_SYSTEM_CONF_FILE, err_ret = None) - if systemd_system_conf == None: + if systemd_system_conf is None: log.error("error reading systemd configuration file") return None return systemd_system_conf diff --git a/tuned/profiles/merger.py b/tuned/profiles/merger.py index 7a3e05c..2364543 100644 --- a/tuned/profiles/merger.py +++ b/tuned/profiles/merger.py @@ -33,7 +33,7 @@ class Merger(object): profile_a.units[unit_name].type = unit.type profile_a.units[unit_name].enabled = unit.enabled profile_a.units[unit_name].devices = unit.devices - if unit.devices_udev_regex != None: + if unit.devices_udev_regex is not None: profile_a.units[unit_name].devices_udev_regex = unit.devices_udev_regex if unit.script_pre is not None: profile_a.units[unit_name].script_pre = unit.script_pre -- 1.8.3.1