Skip to content

Commit f95800a

Browse files
committed
Fix formatting to make travis happy
1 parent 3270794 commit f95800a

12 files changed

Lines changed: 121 additions & 84 deletions

File tree

plugins/bible.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
from cloudbot import hook
44

5+
56
@hook.command("bible", "passage", singlethread=True)
67
def bible(text, reply):
78
"""<passage> - Prints the specified passage from the Bible"""
89
passage = text.strip()
910
params = {
10-
'passage':passage,
11-
'formatting':'plain',
12-
'type':'json'
11+
'passage': passage,
12+
'formatting': 'plain',
13+
'type': 'json'
1314
}
1415
try:
1516
r = requests.get("https://labs.bible.org/api", params=params)

plugins/core/help.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ def help_command(text, chan, conn, bot, notice, message, has_permission):
6262
commands.append(command)
6363

6464
# list of lines to send to the user
65-
lines = formatting.chunk_str("Here's a list of commands you can use: " + ", ". join(commands))
65+
lines = formatting.chunk_str("Here's a list of commands you can use: " + ", ".join(commands))
6666

6767
for line in lines:
6868
if chan[:1] == "#":
6969
notice(line)
7070
else:
71-
#This is an user in this case.
71+
# This is an user in this case.
7272
message(line)
7373
notice("For detailed help, use {}help <command>, without the brackets.".format(conn.config["command_prefix"]))
7474

@@ -118,7 +118,7 @@ def generatehelp(conn, bot, notice, has_permission):
118118
message = "{} Command list\n".format(conn.nick)
119119
message += "------\n"
120120
for plugin in sorted(set(bot.plugin_manager.commands.values()), key=attrgetter("name")):
121-
# use set to remove duplicate commands (from multiple aliases), and sorted to sort by name
121+
# use set to remove duplicate commands (from multiple aliases), and sorted to sort by name
122122
command = plugin.name
123123
aliases = ""
124124
doc = bot.plugin_manager.commands[command].doc
@@ -133,8 +133,8 @@ def generatehelp(conn, bot, notice, has_permission):
133133
aliases += alias + ", "
134134
aliases = aliases[:-2]
135135
if doc:
136-
doc = doc.replace("<","&lt;").replace(">","&gt;") \
137-
.replace("[", "&lt;").replace("]","&gt;")
136+
doc = doc.replace("<", "&lt;").replace(">", "&gt;") \
137+
.replace("[", "&lt;").replace("]", "&gt;")
138138
if aliases:
139139
message += "**{} ({}):** {}\n\n".format(command, aliases, doc)
140140
else:
@@ -146,10 +146,10 @@ def generatehelp(conn, bot, notice, has_permission):
146146
message = message[:-2]
147147
message += " ( *Permission required:* {})\n\n".format(permission)
148148
# toss the markdown text into a paste
149-
#out = web.paste(message.encode('utf-8'), ext="md")
149+
# out = web.paste(message.encode('utf-8'), ext="md")
150150
docs = os.path.join(os.path.abspath(os.path.curdir), "docs")
151151
docs = os.path.join(docs, "user")
152152
f = open(os.path.join(docs, "commands.md"), 'w')
153153
f.write(message)
154154
f.close()
155-
return #out
155+
return # out

plugins/dogpile.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
1-
import requests
21
import random
32
import re
43
from urllib import parse
4+
5+
import requests
56
from bs4 import BeautifulSoup
7+
68
from cloudbot import hook
79

810
search_url = "http://dogpile.com/search"
911

10-
HEADERS = {'User-Agent': 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'}
12+
HEADERS = {
13+
'User-Agent': 'Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19'
14+
}
15+
1116

1217
@hook.command("dpis", "gis")
1318
def dogpileimage(text):
@@ -20,18 +25,21 @@ def dogpileimage(text):
2025
data = soup.find_all("script")[6].string
2126
link_re = re.compile('"url":"(.*?)",')
2227
linklist = link_re.findall(data)
23-
#linklist = soup.find('div', id="webResults").find_all('a', {'class':'resultThumbnailLink'})
28+
# linklist = soup.find('div', id="webResults").find_all('a', {'class':'resultThumbnailLink'})
2429
image = parse.unquote(parse.unquote(random.choice(linklist)).split('ru=')[1].split('&')[0])
2530
return image
2631

32+
2733
@hook.command("dp", "g", "dogpile")
2834
def dogpile(text):
2935
"""<query> - Uses the dogpile search engine to find shit on the web."""
3036
web_url = search_url + "/web"
31-
params = {'q':" ".join(text.split())}
37+
params = {'q': " ".join(text.split())}
3238
r = requests.get(web_url, params=params, headers=HEADERS)
3339
r.raise_for_status()
3440
soup = BeautifulSoup(r.content)
35-
result_url = parse.unquote(parse.unquote(soup.find('div', id="webResults").find_all('a', {'class':'resultDisplayUrl'})[0]['href']).split('ru=')[1].split('&')[0])
36-
result_description = soup.find('div', id="webResults").find_all('div', {'class':'resultDescription'})[0].text
41+
result_url = parse.unquote(
42+
parse.unquote(soup.find('div', id="webResults").find_all('a', {'class': 'resultDisplayUrl'})[0]['href']).split(
43+
'ru=')[1].split('&')[0])
44+
result_description = soup.find('div', id="webResults").find_all('div', {'class': 'resultDescription'})[0].text
3745
return "{} -- \x02{}\x02".format(result_url, result_description)

plugins/dragonvale.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import requests
21
import re
32

3+
import requests
44
from bs4 import BeautifulSoup
55
from requests import HTTPError
66

@@ -11,16 +11,18 @@
1111

1212
egg_calc_url = "http://www.dragonvalebreedingguide.com/dragonvale-calculator"
1313

14+
1415
def striphtml(data):
1516
string = re.compile(r'<.*?>')
1617
return string.sub('', data)
1718

19+
1820
@hook.command("dragon", "ds")
1921
def dragonsearch(text, reply):
2022
"""<query> - Searches the dragonvale wiki for the specified text."""
2123
params = {
2224
"query": text.strip(),
23-
"limit":1
25+
"limit": 1
2426
}
2527

2628
r = requests.get(search_url, params=params)
@@ -35,9 +37,11 @@ def dragonsearch(text, reply):
3537
return "The API returned error code {}.".format(r.status_code)
3638

3739
data = r.json()["items"][0]
38-
out = "\x02{}\x02 -- {}: {}".format(data["title"], striphtml(data["snippet"]).split("&hellip;")[0].strip(), data["url"])
40+
out = "\x02{}\x02 -- {}: {}".format(data["title"], striphtml(data["snippet"]).split("&hellip;")[0].strip(),
41+
data["url"])
3942
return out
4043

44+
4145
@hook.command("eggcalc", "dragoncalc", "dc")
4246
def egg_calculator(text):
4347
"""<time> - Parses dragonvalebreedingguide.com for a list of possible dragons based on the incubation time. Enter the time as 5 hours, 30 minutes. For upgraded incubation times put 'upgrade' at the front of the time length"""
@@ -56,12 +60,12 @@ def egg_calculator(text):
5660
params = {
5761
'time': time,
5862
'time2': time2,
59-
'avail':1
63+
'avail': 1
6064
}
6165
r = requests.get(egg_calc_url, params=params, timeout=5)
6266
soup = BeautifulSoup(r.text)
6367
dragons = []
64-
for line in soup.findAll('td', {'class':'views-field views-field-title'}):
68+
for line in soup.findAll('td', {'class': 'views-field views-field-title'}):
6569
dragons.append(line.text.replace("\n", "").strip())
6670

6771
return ", ".join(dragons)

plugins/fact.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from cloudbot import hook
44
from cloudbot.util import http
55

6-
types=['trivia', 'math', 'date', 'year']
6+
types = ['trivia', 'math', 'date', 'year']
7+
78

89
@hook.command(autohelp=False)
910
def fact(reply):

plugins/flip.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import random
2-
32
from collections import defaultdict
3+
44
from cloudbot import hook
55
from cloudbot.util import formatting
66

@@ -55,19 +55,19 @@
5555
def flip(text, reply, message, chan):
5656
"""<text> - Flips <text> over."""
5757
global table_status
58-
#table_status = defaultdict(False)
58+
# table_status = defaultdict(False)
5959
if USE_FLIPPERS:
60-
if text in ['table','tables']:
61-
message(random.choice([random.choice(flippers) + " ︵ " + "\u253B\u2501\u253B", table_flipper]))
62-
table_status[chan] = True
60+
if text in ['table', 'tables']:
61+
message(random.choice([random.choice(flippers) + " ︵ " + "\u253B\u2501\u253B", table_flipper]))
62+
table_status[chan] = True
6363
elif text == "5318008":
64-
out = "BOOBIES"
65-
message(random.choice(flippers) + " ︵ " + out)
64+
out = "BOOBIES"
65+
message(random.choice(flippers) + " ︵ " + out)
6666
elif text == "BOOBIES":
67-
out = "5318008"
68-
message(random.choice(flippers) + " ︵ " + out)
67+
out = "5318008"
68+
message(random.choice(flippers) + " ︵ " + out)
6969
else:
70-
message(random.choice(flippers) + " ︵ " + formatting.multi_replace(text[::-1], replacements))
70+
message(random.choice(flippers) + " ︵ " + formatting.multi_replace(text[::-1], replacements))
7171
else:
7272
reply(formatting.multi_replace(text[::-1], replacements))
7373

@@ -77,6 +77,7 @@ def table(text, message):
7777
"""<text> - (╯°□°)╯︵ <ʇxǝʇ>"""
7878
message(random.choice(flippers) + " ︵ " + formatting.multi_replace(text[::-1].lower(), replacements))
7979

80+
8081
@hook.command
8182
def fix(text, reply, message, chan):
8283
"""<text> - fixes a flipped over table. ┬─┬ノ(ಠ_ಠノ)"""
@@ -88,4 +89,4 @@ def fix(text, reply, message, chan):
8889
else:
8990
message("no tables have been turned over in {}, thanks for checking!".format(chan))
9091
else:
91-
message(flip(text,reply,message,chan))
92+
message(flip(text, reply, message, chan))

plugins/giphy.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1-
import requests
21
import random
32

3+
import requests
4+
45
from cloudbot import hook
56

67
api_url = 'http://api.giphy.com/v1/gifs'
78

9+
810
@hook.on_start()
911
def load_api(bot):
1012
"""Loads the API key. Check here for the public api key: https://github.com/Giphy/GiphyAPI"""
1113
global api_key
1214
api_key = bot.config.get("api_keys", {}).get("giphy", None)
1315

16+
1417
@hook.command("gif", "giphy")
1518
def giphy(text, chan):
1619
"""<query> - Searches giphy.com for a gif using the provided search term."""
@@ -20,7 +23,7 @@ def giphy(text, chan):
2023
'q': term,
2124
'limit': 10,
2225
'fmt': "json",
23-
'api_key':api_key
26+
'api_key': api_key
2427
}
2528
results = requests.get(search_url, params=params)
2629
results.raise_for_status()

0 commit comments

Comments
 (0)