fix .u
parent
6e69bc1ba3
commit
2b034e7a41
|
@ -70,13 +70,13 @@ def u(phenny, input):
|
||||||
# phenny.msg('#inamidst', '%r' % arg)
|
# phenny.msg('#inamidst', '%r' % arg)
|
||||||
if not arg:
|
if not arg:
|
||||||
return phenny.reply('You gave me zero length input.')
|
return phenny.reply('You gave me zero length input.')
|
||||||
elif not arg.strip(b' '):
|
elif not arg.strip(' '):
|
||||||
if len(arg) > 1: return phenny.reply('%s SPACEs (U+0020)' % len(arg))
|
if len(arg) > 1: return phenny.reply('%s SPACEs (U+0020)' % len(arg))
|
||||||
return phenny.reply('1 SPACE (U+0020)')
|
return phenny.reply('1 SPACE (U+0020)')
|
||||||
|
|
||||||
# @@ space
|
# @@ space
|
||||||
if set(arg.upper()) - set(
|
if set(arg.upper()) - set(
|
||||||
b'ABCDEFGHIJKLMNOPQRSTUVWYXYZ0123456789- .?+*{}[]\\/^$'):
|
'ABCDEFGHIJKLMNOPQRSTUVWYXYZ0123456789- .?+*{}[]\\/^$'):
|
||||||
printable = False
|
printable = False
|
||||||
elif len(arg) > 1:
|
elif len(arg) > 1:
|
||||||
printable = True
|
printable = True
|
||||||
|
@ -84,7 +84,7 @@ def u(phenny, input):
|
||||||
|
|
||||||
if printable:
|
if printable:
|
||||||
extended = False
|
extended = False
|
||||||
for c in b'.?+*{}[]\\/^$':
|
for c in '.?+*{}[]\\/^$':
|
||||||
if c in arg:
|
if c in arg:
|
||||||
extended = True
|
extended = True
|
||||||
break
|
break
|
||||||
|
@ -94,8 +94,6 @@ def u(phenny, input):
|
||||||
except ValueError: pass
|
except ValueError: pass
|
||||||
else: return phenny.say(about(u))
|
else: return phenny.say(about(u))
|
||||||
|
|
||||||
arg = arg.decode('utf-8')
|
|
||||||
|
|
||||||
if extended:
|
if extended:
|
||||||
# look up a codepoint with regexp
|
# look up a codepoint with regexp
|
||||||
results = list(islice(codepoint_extended(arg), 4))
|
results = list(islice(codepoint_extended(arg), 4))
|
||||||
|
@ -113,7 +111,7 @@ def u(phenny, input):
|
||||||
phenny.say(result)
|
phenny.say(result)
|
||||||
else: phenny.reply("Sorry, no results for %r." % arg)
|
else: phenny.reply("Sorry, no results for %r." % arg)
|
||||||
else:
|
else:
|
||||||
text = arg.decode('utf-8')
|
text = arg
|
||||||
# look up less than three podecoints
|
# look up less than three podecoints
|
||||||
if len(text) <= 3:
|
if len(text) <= 3:
|
||||||
for u in text:
|
for u in text:
|
||||||
|
|
Loading…
Reference in New Issue