Formatting and updating docstring.

This commit is contained in:
Fletcher Boyd 2013-09-04 23:50:57 +08:00
parent 253ffaafda
commit d5a5237fb8

View file

@ -6,7 +6,7 @@ locale = "en_US"
@hook.command @hook.command
def spell(inp): def spell(inp):
"""spell <word> -- Check spelling of <word>.""" """spell <word/sentence> -- Check spelling of a word or sentence."""
words = inp.split(" ") words = inp.split(" ")
if words[0] == "": if words[0] == "":
words = [] words = []
@ -24,7 +24,7 @@ def spell(inp):
if is_correct: if is_correct:
out.append(x) out.append(x)
else: else:
out.append('\x02'+s_string+'\x02') out.append('\x02' + s_string + '\x02')
return " ".join(out) return " ".join(out)
else: else:
is_correct = dictionary.check(words[0]) is_correct = dictionary.check(words[0])
@ -32,8 +32,7 @@ def spell(inp):
s_string = ', '.join(suggestions[:10]) s_string = ', '.join(suggestions[:10])
if is_correct: if is_correct:
return '"{}" appears to be \x02valid\x02! ' \ return '"{}" appears to be \x02valid\x02! ' \
'(suggestions: {})'.format(inp, s_string) '(suggestions: {})'.format(inp, s_string)
else: else:
return '"{}" appears to be \x02invalid\x02! ' \ return '"{}" appears to be \x02invalid\x02! ' \
'(suggestions: {})'.format(inp, s_string) '(suggestions: {})'.format(inp, s_string)