2929# POSSIBILITY OF SUCH DAMAGE.
3030###
3131
32- from __future__ import unicode_literals
33-
32+ import io
3433import re
35- import sys
3634import codecs
3735import string
3836import random
3937
4038import supybot .conf as conf
4139import supybot .utils as utils
4240from supybot .commands import *
43- import supybot .utils .minisix as minisix
4441import supybot .ircmsgs as ircmsgs
4542import supybot .ircutils as ircutils
4643import supybot .callbacks as callbacks
@@ -152,15 +149,10 @@ def binary(self, irc, msg, args, text):
152149 Returns the binary representation of <text>.
153150 """
154151 L = []
155- if minisix .PY3 :
156- if isinstance (text , str ):
157- bytes_ = text .encode ()
158- else :
159- bytes_ = text
152+ if isinstance (text , str ):
153+ bytes_ = text .encode ()
160154 else :
161- if isinstance (text , unicode ):
162- text = text .encode ()
163- bytes_ = map (ord , text )
155+ bytes_ = text
164156 for i in bytes_ :
165157 LL = []
166158 assert i <= 256
@@ -228,8 +220,6 @@ def rot13(self, irc, msg, args, text):
228220 commonly used for text that simply needs to be hidden from inadvertent
229221 reading by roaming eyes, since it's easily reversible.
230222 """
231- if minisix .PY2 :
232- text = text .decode ('utf8' )
233223 irc .reply (self ._rot13_encoder (text )[0 ])
234224 rot13 = wrap (rot13 , ['text' ])
235225
@@ -395,12 +385,8 @@ def colorize(self, irc, msg, args, text):
395385
396386 Returns <text> with each character randomly colorized.
397387 """
398- if minisix .PY2 :
399- text = text .decode ('utf-8' )
400388 text = ircutils .stripColor (text )
401389 L = [self ._color (c ) for c in text ]
402- if minisix .PY2 :
403- L = [c .encode ('utf-8' ) for c in L ]
404390 irc .reply ('%s%s' % ('' .join (L ), '\x03 ' ))
405391 colorize = wrap (colorize , ['text' ])
406392
@@ -410,14 +396,10 @@ def rainbow(self, irc, msg, args, text):
410396
411397 Returns <text> colorized like a rainbow.
412398 """
413- if minisix .PY2 :
414- text = text .decode ('utf-8' )
415399 text = ircutils .stripColor (text )
416400 colors = utils .iter .cycle (['05' , '04' , '07' , '08' , '09' , '03' , '11' ,
417401 '10' , '12' , '02' , '06' , '13' ])
418402 L = [self ._color (c , fg = next (colors )) for c in text ]
419- if minisix .PY2 :
420- L = [c .encode ('utf-8' ) for c in L ]
421403 irc .reply ('' .join (L ) + '\x03 ' )
422404 rainbow = wrap (rainbow , ['text' ])
423405
@@ -607,7 +589,7 @@ def randomlyLaugh(text, probability=.3):
607589 '~' : _ ('tilde' )
608590 }
609591 _spellNumbers = {
610- '0' : _ ('zero' ), '1' : _ ('one' ), '2' : _ ('two' ), '3' : _ ('three' ),
592+ '0' : _ ('zero' ), '1' : _ ('one' ), '2' : _ ('two' ), '3' : _ ('three' ),
611593 '4' : _ ('four' ), '5' : _ ('five' ), '6' : _ ('six' ), '7' : _ ('seven' ),
612594 '8' : _ ('eight' ), '9' : _ ('nine' )
613595 }
@@ -629,7 +611,7 @@ def spellit(self, irc, msg, args, text):
629611## for (c, v) in d.items():
630612## dd[ord(c)] = unicode(v + ' ')
631613## irc.reply(unicode(text).translate(dd))
632- out = minisix . io .StringIO ()
614+ out = io .StringIO ()
633615 write = out .write
634616 for c in text :
635617 try :
0 commit comments