pep8 much?

This commit is contained in:
neersighted 2012-02-29 00:29:53 -08:00
parent e77e45d8b8
commit ed50bc746c
33 changed files with 92 additions and 99 deletions

View file

@ -22,6 +22,7 @@ def urban(inp):
return out return out
# define plugin by GhettoWizard & Scaevolus # define plugin by GhettoWizard & Scaevolus
@hook.command('dictionary') @hook.command('dictionary')
@hook.command @hook.command

View file

@ -25,4 +25,3 @@ def drama(inp):
return '%s :: \x02%s\x02' % (summary, url) return '%s :: \x02%s\x02' % (summary, url)
return "error" return "error"

View file

@ -15,8 +15,6 @@ def fact(inp, say=False, nick=False):
return u"%s [ %s ]" % (fact, link) return u"%s [ %s ]" % (fact, link)
def get_fact(): def get_fact():
page = http.get('http://www.omg-facts.com/random') page = http.get('http://www.omg-facts.com/random')
soup = BeautifulSoup(page) soup = BeautifulSoup(page)

View file

@ -37,6 +37,7 @@ def multiwordReplace(text, wordDic):
the associated value, return the changed text the associated value, return the changed text
""" """
rc = re.compile('|'.join(map(re.escape, wordDic))) rc = re.compile('|'.join(map(re.escape, wordDic)))
def translate(match): def translate(match):
return wordDic[match.group(0)] return wordDic[match.group(0)]
return rc.sub(translate, text) return rc.sub(translate, text)
@ -50,7 +51,6 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
return return
db_init(db) db_init(db)
append = False append = False
try: try:
@ -87,6 +87,7 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
notice('Remembered!') notice('Remembered!')
return return
@hook.command("f") @hook.command("f")
def forget(inp, db=None, input=None, notice=None): def forget(inp, db=None, input=None, notice=None):
".forget <word> -- Forgets a remembered <word>." ".forget <word> -- Forgets a remembered <word>."
@ -107,6 +108,7 @@ def forget(inp, db=None, input=None, notice=None):
notice("I don't know about that.") notice("I don't know about that.")
return return
@hook.command("info") @hook.command("info")
@hook.regex(r'^\? ?(.+)') @hook.regex(r'^\? ?(.+)')
def question(inp, say=None, db=None): def question(inp, say=None, db=None):

View file

@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from util import hook from util import hook
import random import random

View file

@ -53,5 +53,3 @@ def flirt(inp, nick=None, me=None, input=None):
if inp == input.conn.nick.lower() or inp == "itself": if inp == input.conn.nick.lower() or inp == "itself":
msg = "flirts with itself... \"" + random.choice(flirts) + "\"" msg = "flirts with itself... \"" + random.choice(flirts) + "\""
me(msg) me(msg)

View file

@ -14,7 +14,7 @@ base_url = 'http://www.fmylife.com/'
def fml(inp): def fml(inp):
".fml [id] -- Gets a random quote from fmyfife.com. Optionally gets [id]." ".fml [id] -- Gets a random quote from fmyfife.com. Optionally gets [id]."
inp = inp.replace("#","") # this lets people use .fml #123456 inp = inp.replace("#", "")
if inp: if inp:
if not inp.isdigit(): if not inp.isdigit():

View file

@ -63,4 +63,3 @@ def fortune(inp, nick=None, say=None, input=None):
msg = "(@" + inp + ") " + random.choice(fortunes) msg = "(@" + inp + ") " + random.choice(fortunes)
say(msg) say(msg)

View file

@ -19,6 +19,7 @@ def timezone(ip):
time = time.replace(".00", "") time = time.replace(".00", "")
return int(time) return int(time)
@hook.command @hook.command
@hook.command("location") @hook.command("location")
def geoip(inp, say=None, bot=None): def geoip(inp, say=None, bot=None):
@ -37,4 +38,3 @@ def geoip(inp, say = None, bot = None):
else: else:
say("Either that wasn't an IP or I cannot locate it in my database. :(") say("Either that wasn't an IP or I cannot locate it in my database. :(")
return return

View file

@ -13,10 +13,12 @@ def gitio(inp):
except: except:
code = None code = None
# if the first 8 chars of "url" are not "https://" then append "https://" to the url # if the first 8 chars of "url" are not "https://" then append "https://" to the url, also convert "http://" to "https://"
if url[:8] != "https://": if url[:8] != "https://":
if url[:7] != "http://":
url = "https://" + url url = "https://" + url
else:
url = "https://" + url[7:]
url='url='+str(url) url='url='+str(url)
if code: if code:
url = url + '&code=' + str(code) url = url + '&code=' + str(code)

View file

@ -31,4 +31,3 @@ def clock(inp, say=None):
output = output.decode('utf-8', 'ignore') output = output.decode('utf-8', 'ignore')
return output return output

View file

@ -47,4 +47,3 @@ def insult(inp, nick=None, say=None, input=None):
msg = "*stares at " + nick + "*" msg = "*stares at " + nick + "*"
say(msg) say(msg)

View file

@ -40,4 +40,3 @@ def kill(inp, me = None, nick = None, input=None, notice=None):
msg = re.sub ('<body>', random.choice(body), kill) msg = re.sub ('<body>', random.choice(body), kill)
me(msg) me(msg)

View file

@ -116,4 +116,3 @@ def lart(inp, me = None, nick = None, input=None, notice=None):
msg = re.sub ('<who>', inp, random.choice(larts)) msg = re.sub ('<who>', inp, random.choice(larts))
me(msg) me(msg)

View file

@ -67,4 +67,3 @@ def lastfm(inp, nick='', say=None, db=None, bot=None):
ret += " on \x02%s\x0f" % album ret += " on \x02%s\x0f" % album
say(ret) say(ret)

View file

@ -36,4 +36,3 @@ def mcpaid(inp):
return "The account \'" + inp + "\' is a premium Minecraft account!" return "The account \'" + inp + "\' is a premium Minecraft account!"
else: else:
return "The account \'" + inp + "\' is not a premium Minecraft account!" return "The account \'" + inp + "\' is not a premium Minecraft account!"

View file

@ -8,6 +8,8 @@ from util import hook, http
socket.setdefaulttimeout(10) socket.setdefaulttimeout(10)
# Auto-join on Invite (Configurable, defaults to True) # Auto-join on Invite (Configurable, defaults to True)
@hook.event('INVITE') @hook.event('INVITE')
def invite(paraml, conn=None): def invite(paraml, conn=None):
invitejoin = conn.conf.get('invitejoin', True) invitejoin = conn.conf.get('invitejoin', True)
@ -17,6 +19,8 @@ def invite(paraml, conn=None):
return None return None
# Rejoin on kick (Configuragble, defaults to False) # Rejoin on kick (Configuragble, defaults to False)
@hook.event('KICK') @hook.event('KICK')
def rejoin(paraml, conn=None): def rejoin(paraml, conn=None):
autorejoin = conn.conf.get('autorejoin', False) autorejoin = conn.conf.get('autorejoin', False)
@ -25,6 +29,8 @@ def rejoin(paraml, conn=None):
else: else:
return None return None
# Identify to NickServ (or other service) # Identify to NickServ (or other service)
@hook.event('004') @hook.event('004')
def onjoin(paraml, conn=None, bot=None): def onjoin(paraml, conn=None, bot=None):
nickserv_password = conn.conf.get('nickserv_password', '') nickserv_password = conn.conf.get('nickserv_password', '')
@ -36,8 +42,8 @@ def onjoin(paraml, conn=None, bot=None):
conn.msg(nickserv_name, nickserv_command % nickserv_password) conn.msg(nickserv_name, nickserv_command % nickserv_password)
bot.config['censored_strings'].append(nickserv_password) bot.config['censored_strings'].append(nickserv_password)
time.sleep(1) time.sleep(1)
mode = conn.conf.get('mode')
# Set bot modes # Set bot modes
mode = conn.conf.get('mode')
if mode: if mode:
conn.cmd('MODE', [conn.nick, mode]) conn.cmd('MODE', [conn.nick, mode])

View file

@ -18,4 +18,3 @@ def potato(inp, me = None, input=None):
method = random.choice(['bakes', 'fries', 'boils', 'microwaves']) method = random.choice(['bakes', 'fries', 'boils', 'microwaves'])
me("%s a %s %s %s potato for %s!" % (method, flavor, size, potato_type, inp)) me("%s a %s %s %s potato for %s!" % (method, flavor, size, potato_type, inp))

View file

@ -14,7 +14,6 @@ def python(inp):
res = http.get("http://eval.appspot.com/eval", statement=inp).splitlines() res = http.get("http://eval.appspot.com/eval", statement=inp).splitlines()
if len(res) == 0: if len(res) == 0:
return return
res[0] = re_lineends.split(res[0])[0] res[0] = re_lineends.split(res[0])[0]

View file

@ -146,7 +146,6 @@ def repaste(inp, input=None, db=None, isManual=True):
if parts[0] == 'list': if parts[0] == 'list':
return " ".join(pasters.keys()) return " ".join(pasters.keys())
paster = paste_gist paster = paste_gist
args = {} args = {}

View file

@ -9,6 +9,7 @@ from urllib import urlencode
class ShortenError(Exception): class ShortenError(Exception):
def __init__(self, value): def __init__(self, value):
self.value = value self.value = value
def __str__(self): def __str__(self):
return repr(self.value) return repr(self.value)

View file

@ -48,4 +48,3 @@ def slap(inp, me = None, nick = None, input=None, notice=None):
msg = re.sub ('<item>', random.choice(items), slap) msg = re.sub ('<item>', random.choice(items), slap)
me(msg) me(msg)

View file

@ -20,4 +20,3 @@ def spell(inp):
return "That word appears to be valid! (suggestions: " + s_string + ")" return "That word appears to be valid! (suggestions: " + s_string + ")"
else: else:
return "That word appears to be invalid! (suggestions: " + s_string + ")" return "That word appears to be invalid! (suggestions: " + s_string + ")"

View file

@ -31,7 +31,6 @@ def tellinput(paraml, input=None, db=None, bot=None):
db_init(db) db_init(db)
tells = get_tells(db, input.nick) tells = get_tells(db, input.nick)
if tells: if tells:

View file

@ -1,6 +1,8 @@
# MyGengo translation plugin by lukeroge and neersighted # MyGengo translation plugin by lukeroge and neersighted
from util import hook, http from util import hook
import re, htmlentitydefs from util import http
import re
import htmlentitydefs
import mygengo import mygengo
gengo = mygengo.MyGengo( gengo = mygengo.MyGengo(
@ -111,4 +113,3 @@ lang_pairs = [
("cy", "Welsh"), ("cy", "Welsh"),
("yi", "Yiddish") ("yi", "Yiddish")
] ]