From 3317b6d2d834dd75a08a9272954e039aef72bbbd Mon Sep 17 00:00:00 2001 From: ibrokemypie Date: Mon, 5 Jun 2017 12:50:22 +1000 Subject: [PATCH 1/3] [module/github] Linting Removed some unused imports, fixed indentations, removed unused variables. --- bumblebee/modules/github.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/bumblebee/modules/github.py b/bumblebee/modules/github.py index 187d266..7cafcd4 100644 --- a/bumblebee/modules/github.py +++ b/bumblebee/modules/github.py @@ -10,29 +10,27 @@ Parameters: * github.interval: Interval in minutes """ +import time +import json import bumblebee.input import bumblebee.output import bumblebee.engine -import re -import time -import json try: import requests - from requests.exceptions import RequestException except ImportError: pass class Module(bumblebee.engine.Module): def __init__(self, engine, config): super(Module, self).__init__(engine, config, - bumblebee.output.Widget(full_text=self.github) - ) + bumblebee.output.Widget(full_text=self.github) + ) self._count = 0 self._interval = int(self.parameter("interval", "5")) self._nextcheck = 0 - def github(self, widget): + def github(self, _): return str(self._count) def update(self, widgets): @@ -41,13 +39,14 @@ class Module(bumblebee.engine.Module): token = self.parameter("token", "") if not token: - self._count = 0 - return + self._count = 0 + return - notifications = requests.get("https://api.github.com/notifications?access_token={}".format(token)).text + notifications = requests.get("https://api.github.com/notifications?access_token={}" + .format(token)).text unread = 0 for notification in json.loads(notifications): - if "unread" in notification and notification["unread"] == True: + if "unread" in notification and notification["unread"]: unread += 1 self._count = unread From 644c55292d899a57d64422f3b07386f45ff13ca6 Mon Sep 17 00:00:00 2001 From: ibrokemypie Date: Mon, 5 Jun 2017 12:54:23 +1000 Subject: [PATCH 2/3] [modules/sensors] Linting Un-import os, fix indentation --- bumblebee/modules/sensors.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bumblebee/modules/sensors.py b/bumblebee/modules/sensors.py index 36dabbd..d76d10e 100644 --- a/bumblebee/modules/sensors.py +++ b/bumblebee/modules/sensors.py @@ -1,14 +1,15 @@ +# pylint: disable=C0111,R0903 + """Displays sensor temperature Requires the following executable: * sensors Parameters: - * sensors.match: What line in the output of `sensors -u` should be matched against (default: temp1_input) + * sensors.match: Line to match against output of 'sensors -u' (default: temp1_input) * sensors.match_number: which of the matches you want (default -1: last match). """ -import os import re import bumblebee.input @@ -18,8 +19,7 @@ import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): super(Module, self).__init__(engine, config, - bumblebee.output.Widget(full_text=self.temperature) - ) + bumblebee.output.Widget(full_text=self.temperature)) self._temperature = "unknown" pattern = self.parameter("match", "temp1_input") pattern_string = r"^\s*{}:\s*([\d.]+)$".format(pattern) @@ -36,7 +36,7 @@ class Module(bumblebee.engine.Module): return temperature - def temperature(self, widget): + def temperature(self, _): return self._temperature def update(self, widgets): From b21a62e82396f45d4aae43e1a56c453e6b3deb88 Mon Sep 17 00:00:00 2001 From: ibrokemypie Date: Mon, 5 Jun 2017 18:27:51 +1000 Subject: [PATCH 3/3] [modules/cpu] Linting --- bumblebee/modules/cpu.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bumblebee/modules/cpu.py b/bumblebee/modules/cpu.py index 10a2559..1a9a97d 100644 --- a/bumblebee/modules/cpu.py +++ b/bumblebee/modules/cpu.py @@ -19,19 +19,18 @@ import bumblebee.engine class Module(bumblebee.engine.Module): def __init__(self, engine, config): super(Module, self).__init__(engine, config, - bumblebee.output.Widget(full_text=self.utilization) - ) + bumblebee.output.Widget(full_text=self.utilization)) self._utilization = psutil.cpu_percent(percpu=False) engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, - cmd="gnome-system-monitor") + cmd="gnome-system-monitor") - def utilization(self, widget): + def utilization(self, _): return "{:6.01f}%".format(self._utilization) def update(self, widgets): self._utilization = psutil.cpu_percent(percpu=False) - def state(self, widget): + def state(self, _): return self.threshold_state(self._utilization, 70, 80) # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4