[module/github] Linting

Removed some unused imports, fixed indentations, removed unused variables.
This commit is contained in:
ibrokemypie 2017-06-05 12:50:22 +10:00
parent 0bfb725ae0
commit 3317b6d2d8
No known key found for this signature in database
GPG key ID: 972E990922570890

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,11 @@ class Module(bumblebee.engine.Module):
self._count = 0 self._count = 0
return 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 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