From f46671a85f3c064b9b9fa0dca275bcf047ac2ef9 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 4 Jun 2018 14:50:51 +0200 Subject: [PATCH 1/3] Use 'is None' instead of '== None' --- bumblebee/engine.py | 2 +- bumblebee/modules/cmus.py | 2 +- bumblebee/modules/indicator.py | 2 +- bumblebee/modules/mpd.py | 2 +- bumblebee/modules/xrandr.py | 2 +- bumblebee/theme.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bumblebee/engine.py b/bumblebee/engine.py index e940039..85dc90f 100644 --- a/bumblebee/engine.py +++ b/bumblebee/engine.py @@ -288,7 +288,7 @@ class Engine(object): for module in self._modules: self._current_module = module module.update_wrapper(module.widgets()) - if module.error == None: + if module.error is None: if module.minimized(): widget = module.minimizedWidget() widget.link_module(module) diff --git a/bumblebee/modules/cmus.py b/bumblebee/modules/cmus.py index de638e4..ab01220 100644 --- a/bumblebee/modules/cmus.py +++ b/bumblebee/modules/cmus.py @@ -49,7 +49,7 @@ class Module(bumblebee.engine.Module): self._tags = defaultdict(lambda: '') def hidden(self): - return self._status == None + return self._status is None @scrollable def description(self, widget): diff --git a/bumblebee/modules/indicator.py b/bumblebee/modules/indicator.py index a4d1712..3b57e33 100644 --- a/bumblebee/modules/indicator.py +++ b/bumblebee/modules/indicator.py @@ -18,7 +18,7 @@ class Module(bumblebee.engine.Module): self.status = False super(Module,self).__init__(engine, config, widgets) self._include = tuple(filter(len, self.parameter("include", "NumLock,CapsLock").split(","))) - self._signalType = self.parameter("signaltype") if not self.parameter("signaltype") == None else "warning" + self._signalType = self.parameter("signaltype") if not self.parameter("signaltype") is None else "warning" def update(self, widgets): self._update_widgets(widgets) diff --git a/bumblebee/modules/mpd.py b/bumblebee/modules/mpd.py index ff8ecd5..939f6e0 100644 --- a/bumblebee/modules/mpd.py +++ b/bumblebee/modules/mpd.py @@ -56,7 +56,7 @@ class Module(bumblebee.engine.Module): self._tags = defaultdict(lambda: '') def hidden(self): - return self._status == None + return self._status is None @scrollable def description(self, widget): diff --git a/bumblebee/modules/xrandr.py b/bumblebee/modules/xrandr.py index 4f9236c..b01d6b6 100644 --- a/bumblebee/modules/xrandr.py +++ b/bumblebee/modules/xrandr.py @@ -64,7 +64,7 @@ class Module(bumblebee.engine.Module): neighbor = first_neighbor if event["button"] == bumblebee.input.LEFT_MOUSE else last_neighbor - if neighbor == None: + if neighbor is None: bumblebee.util.execute("{} --output {} --auto".format(toggle_cmd, widget.name)) else: bumblebee.util.execute("{} --output {} --auto --{}-of {}".format(toggle_cmd, widget.name, diff --git a/bumblebee/theme.py b/bumblebee/theme.py index a75bada..08bb5ea 100644 --- a/bumblebee/theme.py +++ b/bumblebee/theme.py @@ -102,7 +102,7 @@ class Theme(object): def icon(self, widget): icon = self._get(widget, "icon", None) - if icon == None: + if icon is None: return self._get(widget, "prefix", None) def padding(self, widget): From 62f79beb903ac5054cc90fc1aef1b7fa24bb9205 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 4 Jun 2018 14:53:01 +0200 Subject: [PATCH 2/3] Use 'is False' instead of '== False' --- bumblebee/modules/nic.py | 2 +- bumblebee/modules/pulseaudio.py | 4 ++-- bumblebee/modules/zpool.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bumblebee/modules/nic.py b/bumblebee/modules/nic.py index 98b089c..ca47409 100644 --- a/bumblebee/modules/nic.py +++ b/bumblebee/modules/nic.py @@ -100,7 +100,7 @@ class Module(bumblebee.engine.Module): widget.set("visited", True) for widget in widgets: - if widget.get("visited") == False: + if widget.get("visited") is False: widgets.remove(widget) def get_ssid(self, intf): diff --git a/bumblebee/modules/pulseaudio.py b/bumblebee/modules/pulseaudio.py index 2312545..2a393a4 100644 --- a/bumblebee/modules/pulseaudio.py +++ b/bumblebee/modules/pulseaudio.py @@ -105,12 +105,12 @@ class Module(bumblebee.engine.Module): if "<"+device+">" in line: found = True continue - if found == False: + if found is False: continue for pattern in self._patterns: if not pattern["expr"] in line: continue - if pattern["callback"](line) == False and found == True: + if pattern["callback"](line) is False and found == True: return except Exception: self._failed = True diff --git a/bumblebee/modules/zpool.py b/bumblebee/modules/zpool.py index 9c43a67..701c1c1 100644 --- a/bumblebee/modules/zpool.py +++ b/bumblebee/modules/zpool.py @@ -150,7 +150,7 @@ class Module(bumblebee.engine.Module): band=bytefmt(nread))) for widget in widgets: - if widget.get("visited") == False: + if widget.get("visited") is False: widgets.remove(widget) @staticmethod From 841f6e131dbe9fa12a2bea0ad565d00a0df2664e Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 4 Jun 2018 15:03:39 +0200 Subject: [PATCH 3/3] Remove unnecessary parens --- bumblebee/modules/shortcut.py | 2 +- bumblebee/modules/title.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/shortcut.py b/bumblebee/modules/shortcut.py index 2ec6ab3..5c25cfb 100644 --- a/bumblebee/modules/shortcut.py +++ b/bumblebee/modules/shortcut.py @@ -49,7 +49,7 @@ class Module(bumblebee.engine.Module): num_shortcuts = min(len(cmds), len(labels)) # report possible problem as a warning - if (len(cmds) is not len(labels)): + if len(cmds) is not len(labels): logging.warning("shortcut: the number of commands does not match "\ "the number of provided labels.") logging.warning("cmds : %s, labels : %s", cmds, labels) diff --git a/bumblebee/modules/title.py b/bumblebee/modules/title.py index 65a3277..efa529f 100644 --- a/bumblebee/modules/title.py +++ b/bumblebee/modules/title.py @@ -66,7 +66,7 @@ class Module(bumblebee.engine.Module): except Exception: self._full_title = no_title - if(self._full_title is None): + if self._full_title is None: self._full_title = no_title # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4