From f61895fdc378b8f004e6fe399686d276abced5d3 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Thu, 22 Apr 2010 21:50:56 -0600 Subject: [PATCH] pep8 --- core/main.py | 4 ++-- plugins/religion.py | 5 ++--- plugins/tell.py | 6 +++--- plugins/tf.py | 10 +++++----- plugins/util/http.py | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/core/main.py b/core/main.py index e532333..c0ede36 100644 --- a/core/main.py +++ b/core/main.py @@ -24,14 +24,14 @@ class Input(dict): def pm(msg): conn.msg(nick, msg) - + def notice(msg): conn.cmd('NOTICE', [nick, msg]) dict.__init__(self, conn=conn, raw=raw, prefix=prefix, command=command, params=params, nick=nick, user=user, host=host, paraml=paraml, msg=msg, server=conn.server, chan=chan, - notice=notice, say=say, reply=reply, pm=pm, bot=bot, + notice=notice, say=say, reply=reply, pm=pm, bot=bot, lastparam=paraml[-1]) # make dict keys accessible as attributes diff --git a/plugins/religion.py b/plugins/religion.py index a627381..e7455a5 100644 --- a/plugins/religion.py +++ b/plugins/religion.py @@ -25,11 +25,10 @@ def bible(inp): return text -## Koran look-up plugin by Ghetto Wizard @hook.command('allah') @hook.command -def koran(inp): +def koran(inp): # Koran look-up plugin by Ghetto Wizard ".koran -- gets from the Koran" if not inp: @@ -38,7 +37,7 @@ def koran(inp): url = 'http://quod.lib.umich.edu/cgi/k/koran/koran-idx?type=simple' results = http.get_html(url, q1=inp).xpath('//li') - + if not results: return 'No results for ' + inp diff --git a/plugins/tell.py b/plugins/tell.py index 996b5ed..08ac6c0 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -36,7 +36,7 @@ def tellinput(paraml, input=None, db=None, bot=None): user_from, message, time, chan = tells[0] reltime = timesince.timesince(time) - reply = "%s said %s ago in %s: %s" % (user_from, reltime, chan, + reply = "%s said %s ago in %s: %s" % (user_from, reltime, chan, message) if len(tells) > 1: reply += " (+%d more, .showtells to view)" % (len(tells) - 1) @@ -61,8 +61,8 @@ def showtells(inp, nick='', chan='', notice=None, db=None): for tell in tells: user_from, message, time, chan = tell - reltime = timesince.timesince(time) - notice("%s said %s ago in %s: %s" % (user_from, reltime, chan, message)) + past = timesince.timesince(time) + notice("%s said %s ago in %s: %s" % (user_from, past, chan, message)) db.execute("delete from tell where user_to=lower(?)", (nick,)) diff --git a/plugins/tf.py b/plugins/tf.py index 04dc778..1aa9929 100644 --- a/plugins/tf.py +++ b/plugins/tf.py @@ -1,6 +1,6 @@ # tf.py: written by ipsum # -# This skybot plugin retreives the number of items +# This skybot plugin retreives the number of items # a given user has waiting from idling in Team Fortress 2. from util import hook, http @@ -13,10 +13,10 @@ def tf(inp): if not inp: return tf.__doc__ - - if inp.isdigit(): + + if inp.isdigit(): link = 'profiles' - else: + else: link = 'id' url = 'http://steamcommunity.com/%s/%s/tfitems?json=1' % \ @@ -27,7 +27,7 @@ def tf(inp): except ValueError: return '%s is not a valid profile' % inp - dropped,dhats,hats = 0,0,0 + dropped, dhats, hats = 0, 0, 0 for item, data in inv.iteritems(): ind = int(data['defindex']) if data['inventory'] == 0: diff --git a/plugins/util/http.py b/plugins/util/http.py index 4baf039..7bcde18 100644 --- a/plugins/util/http.py +++ b/plugins/util/http.py @@ -33,7 +33,7 @@ def get_json(*args, **kwargs): return json.loads(get(*args, **kwargs)) -def open(url, query_params={}, user_agent=user_agent, post_data=None, +def open(url, query_params={}, user_agent=user_agent, post_data=None, get_method=None, **kwargs): query_params.update(kwargs) @@ -47,7 +47,7 @@ def open(url, query_params={}, user_agent=user_agent, post_data=None, request.add_header('User-Agent', user_agent) return urllib2.build_opener().open(request) - + def prepare_url(url, queries): if queries: scheme, netloc, path, query, fragment = urlparse.urlsplit(url)