master
mutantmonkey 2011-10-22 21:54:12 -04:00
parent d9a8cb9a12
commit 7b41ea29bd
1 changed files with 96 additions and 94 deletions

View File

@ -70,13 +70,13 @@ def u(phenny, input):
# phenny.msg('#inamidst', '%r' % arg)
if not arg:
return phenny.reply('You gave me zero length input.')
elif not arg.strip(' '):
elif not arg.strip(b' '):
if len(arg) > 1: return phenny.reply('%s SPACEs (U+0020)' % len(arg))
return phenny.reply('1 SPACE (U+0020)')
# @@ space
if set(arg.upper()) - set(
'ABCDEFGHIJKLMNOPQRSTUVWYXYZ0123456789- .?+*{}[]\\/^$'):
b'ABCDEFGHIJKLMNOPQRSTUVWYXYZ0123456789- .?+*{}[]\\/^$'):
printable = False
elif len(arg) > 1:
printable = True
@ -84,7 +84,7 @@ def u(phenny, input):
if printable:
extended = False
for c in '.?+*{}[]\\/^$':
for c in b'.?+*{}[]\\/^$':
if c in arg:
extended = True
break
@ -94,6 +94,8 @@ def u(phenny, input):
except ValueError: pass
else: return phenny.say(about(u))
arg = arg.decode('utf-8')
if extended:
# look up a codepoint with regexp
results = list(islice(codepoint_extended(arg), 4))