From 7e30d5d0a33e42e33fb91850eb7f1361160a3f6b Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Tue, 17 Nov 2009 17:38:48 -0700 Subject: [PATCH] pep8 compliance --- bot.py | 5 +++-- core/irc.py | 1 - core/reload.py | 3 ++- plugins/explain.py | 6 +----- plugins/tell.py | 4 ++-- plugins/twitter.py | 2 +- 6 files changed, 9 insertions(+), 12 deletions(-) diff --git a/bot.py b/bot.py index dfe7f78..12a4c8f 100755 --- a/bot.py +++ b/bot.py @@ -31,13 +31,14 @@ try: if name in bot.conns: print 'ERROR: more than one connection named "%s"' % name raise ValueError - bot.conns[name] = irc(conf['server'], conf['nick'], channels=conf['channels']) + bot.conns[name] = irc(conf['server'], conf['nick'], + channels=conf['channels']) for channel in conf['channels']: bot.conns[name].join(channel) except Exception, e: print 'ERROR: malformed config file', Exception, e sys.exit() - + bot.persist_dir = os.path.abspath('persist') print 'Running main loop' diff --git a/core/irc.py b/core/irc.py index ce9ff7b..f2fea6d 100644 --- a/core/irc.py +++ b/core/irc.py @@ -61,7 +61,6 @@ irc_param_ref = re.compile(r'(?:^|(?<= ))(:.*|[^ ]+)').findall class irc(object): "handles the IRC protocol" #see the docs/ folder for more information on the protocol - def __init__(self, server, nick, port=6667, channels=[]): self.server = server self.conn = crlf_tcp(server, port) diff --git a/core/reload.py b/core/reload.py index 8b21bba..976d639 100644 --- a/core/reload.py +++ b/core/reload.py @@ -59,7 +59,8 @@ def reload(init=False): bot.plugs[type] += [data] if not init: - print '### new plugin (type: %s) loaded:' % type, format_plug(data) + print '### new plugin (type: %s) loaded:' % \ + type, format_plug(data) if type == 'init': # run-once functions try: diff --git a/plugins/explain.py b/plugins/explain.py index ebd07e8..75537ae 100755 --- a/plugins/explain.py +++ b/plugins/explain.py @@ -3,10 +3,7 @@ from pycparser.cdecl import explain_c_declaration @hook.command('explain') def explain(inp): - '''.explain char *(*(**foo[][8])())[]; -- returns : -foo is a array of array[8] of pointer to pointer to function() returning pointer - to array of pointer to char -''' + ".explain -- gives an explanation of x expression" if not inp: return "" @@ -16,4 +13,3 @@ foo is a array of array[8] of pointer to pointer to function() returning pointer result = str(e) return result - diff --git a/plugins/tell.py b/plugins/tell.py index 08c29ca..ed8f28b 100644 --- a/plugins/tell.py +++ b/plugins/tell.py @@ -31,7 +31,7 @@ def tellinput(bot, input): command = "select id, user_from, quote, date from tell " \ "where name = ? and chan = ? limit 1" tell = cursor.execute(command, (input.nick, input.chan)).fetchall()[0] - more = results[0] - 1; + more = results[0] - 1 reltime = timesince.timesince(datetime.fromtimestamp(tell[3])) reply = "%(teller)s said %(reltime)s ago: %(quote)s" % \ @@ -69,7 +69,7 @@ def showtells(bot, input): conn.commit() else: - bot.msg(input.nick, "You have no pending tells.") + bot.msg(input.nick, "You have no pending tells.") conn.close() diff --git a/plugins/twitter.py b/plugins/twitter.py index ba28987..747ec1d 100644 --- a/plugins/twitter.py +++ b/plugins/twitter.py @@ -60,5 +60,5 @@ def twitter(inp): if tweet is None: return 'error: user has no tweets' - return unescape_xml(': '.join(tweet.find(x).text.replace('\n','') for x in + return unescape_xml(': '.join(tweet.find(x).text.replace('\n', '') for x in 'created_at user/screen_name text'.split()))