Merge pull request #106 from ibrokemypie/pep8

[WIP] Pep8 Linting
This commit is contained in:
tobi-wan-kenobi 2017-06-05 10:57:15 +02:00 committed by GitHub
commit c31015c296
3 changed files with 19 additions and 22 deletions

View file

@ -19,19 +19,18 @@ import bumblebee.engine
class Module(bumblebee.engine.Module): class Module(bumblebee.engine.Module):
def __init__(self, engine, config): def __init__(self, engine, config):
super(Module, self).__init__(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) self._utilization = psutil.cpu_percent(percpu=False)
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, 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) return "{:6.01f}%".format(self._utilization)
def update(self, widgets): def update(self, widgets):
self._utilization = psutil.cpu_percent(percpu=False) self._utilization = psutil.cpu_percent(percpu=False)
def state(self, widget): def state(self, _):
return self.threshold_state(self._utilization, 70, 80) return self.threshold_state(self._utilization, 70, 80)
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4

View file

@ -10,16 +10,14 @@ Parameters:
* github.interval: Interval in minutes * github.interval: Interval in minutes
""" """
import time
import json
import bumblebee.input import bumblebee.input
import bumblebee.output import bumblebee.output
import bumblebee.engine import bumblebee.engine
import re
import time
import json
try: try:
import requests import requests
from requests.exceptions import RequestException
except ImportError: except ImportError:
pass pass
@ -32,7 +30,7 @@ class Module(bumblebee.engine.Module):
self._interval = int(self.parameter("interval", "5")) self._interval = int(self.parameter("interval", "5"))
self._nextcheck = 0 self._nextcheck = 0
def github(self, widget): def github(self, _):
return str(self._count) return str(self._count)
def update(self, widgets): def update(self, widgets):
@ -44,10 +42,10 @@ class Module(bumblebee.engine.Module):
self._count = 0 self._count = 0
return return
notifications = requests.get("https://api.github.com/notifications", headers={"Authorization":"token "+format(token)}).text notifications = requests.get("https://api.github.com/notifications", headers={"Authorization":"token {}".format(token)}).text
unread = 0 unread = 0
for notification in json.loads(notifications): for notification in json.loads(notifications):
if "unread" in notification and notification["unread"] == True: if "unread" in notification and notification["unread"]:
unread += 1 unread += 1
self._count = unread self._count = unread

View file

@ -1,14 +1,15 @@
# pylint: disable=C0111,R0903
"""Displays sensor temperature """Displays sensor temperature
Requires the following executable: Requires the following executable:
* sensors * sensors
Parameters: 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). * sensors.match_number: which of the matches you want (default -1: last match).
""" """
import os
import re import re
import bumblebee.input import bumblebee.input
@ -18,8 +19,7 @@ import bumblebee.engine
class Module(bumblebee.engine.Module): class Module(bumblebee.engine.Module):
def __init__(self, engine, config): def __init__(self, engine, config):
super(Module, self).__init__(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" self._temperature = "unknown"
pattern = self.parameter("match", "temp1_input") pattern = self.parameter("match", "temp1_input")
pattern_string = r"^\s*{}:\s*([\d.]+)$".format(pattern) pattern_string = r"^\s*{}:\s*([\d.]+)$".format(pattern)
@ -36,7 +36,7 @@ class Module(bumblebee.engine.Module):
return temperature return temperature
def temperature(self, widget): def temperature(self, _):
return self._temperature return self._temperature
def update(self, widgets): def update(self, widgets):