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

@ -30,13 +30,14 @@ def get_memory(db, word):
else:
return None
def multiwordReplace(text, wordDic):
"""
take a text and replace words that match a key in a dictionary with
the associated value, return the changed text
"""
rc = re.compile('|'.join(map(re.escape, wordDic)))
def translate(match):
return wordDic[match.group(0)]
return rc.sub(translate, text)
@ -50,7 +51,6 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
return
db_init(db)
append = False
try:
@ -87,6 +87,7 @@ def remember(inp, nick='', db=None, say=None, input=None, notice=None):
notice('Remembered!')
return
@hook.command("f")
def forget(inp, db=None, input=None, notice=None):
".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.")
return
@hook.command("info")
@hook.regex(r'^\? ?(.+)')
def question(inp, say=None, db=None):