pep8 compliance

This commit is contained in:
Ryan Hitchman 2009-11-17 17:38:48 -07:00
parent bce01e4112
commit 7e30d5d0a3
6 changed files with 9 additions and 12 deletions

5
bot.py
View File

@ -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'

View File

@ -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)

View File

@ -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:

View File

@ -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 <c expression> -- 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

View File

@ -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()

View File

@ -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()))