Skip to content

Commit

Permalink
Fix some flake8 issues with plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmaguire committed Feb 11, 2021
1 parent 12d373f commit fd8e051
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions plugins/github/plugin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
import json
import logging
import requests

Expand Down Expand Up @@ -160,7 +159,8 @@ def _form_request(self, endpoint, params=None):
if params is None:
params = {}

r = yield deferToThread(requests.get, "https://api.github.com/" + endpoint,
r = yield deferToThread(requests.get,
"https://api.github.com/" + endpoint,
params=params)
r.raise_for_status()

Expand Down
8 changes: 4 additions & 4 deletions plugins/help/plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime, timedelta
from datetime import datetime
from cardinal.decorators import command, help


Expand All @@ -24,11 +24,11 @@ def _get_commands(self, cardinal):

# Loop through commands registered in Cardinal
for plugin in cardinal.plugin_manager:
for command in plugin['commands']:
for cmd in plugin['commands']:
if hasattr(command, 'commands'):
commands.append(command.commands[0])
commands.append(cmd.commands[0])
elif hasattr(command, 'name'):
commands.append(command.name)
commands.append(cmd.name)

return commands

Expand Down
9 changes: 6 additions & 3 deletions plugins/ticker/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

from cardinal import util
from cardinal.bot import user_info
from cardinal.decorators import command, regex
from cardinal.decorators import regex
from cardinal.util import F

# IEX API Endpoint
IEX_QUOTE_API_URL = "https://cloud.iexapis.com/stable/stock/{symbol}/quote?token={token}"
IEX_QUOTE_API_URL = "https://cloud.iexapis.com/stable/stock/{symbol}/quote?token={token}" # noqa: E501

# This is actually max tries, not max retries (for AV API requests)
MAX_RETRIES = 3
Expand Down Expand Up @@ -480,7 +480,10 @@ def get_daily(self, symbol):

@defer.inlineCallbacks
def make_iex_request(self, symbol):
url = IEX_QUOTE_API_URL.format(symbol=symbol, token=self.config["api_key"])
url = IEX_QUOTE_API_URL.format(
symbol=symbol,
token=self.config["api_key"],
)
r = yield deferToThread(requests.get, url)
data = r.json()

Expand Down
3 changes: 2 additions & 1 deletion plugins/urbandict/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ def get_ud(self, cardinal, user, channel, msg):
cardinal.sendMsg(channel, response)
except Exception:
self.logger.exception("Error with definition: %s", word)
cardinal.sendMsg(channel, "Could not retrieve definition for %s" % word)
cardinal.sendMsg(channel,
"Could not retrieve definition for %s" % word)


entrypoint = UrbanDictPlugin

0 comments on commit fd8e051

Please sign in to comment.