<s> import re <EOL> class OneBoxMixIn ( object ) : <EOL> url_regex = [ <EOL> re . compile ( "<STR_LIT>" ) , <EOL> re . compile ( "<STR_LIT>" ) , <EOL> re . compile ( "<STR_LIT>" ) , <EOL> re . compile ( "<STR_LIT>" ) , <EOL> ] <EOL> def onebox ( self , message ) : <EOL> if any ( i . match ( message . strip ( ) ) for i in self . url_regex ) : <EOL> if any ( message . lower ( ) . endswith ( i ) for i in ( "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) : <EOL> return "<STR_LIT>" % ( message , message , message ) <EOL> return "<STR_LIT>" % ( message , message ) <EOL> return message <EOL> def onebox_html ( self , message ) : <EOL> if message . startswith ( "<STR_LIT>" ) : <EOL> m = message [ <NUM_LIT:9> : ] <EOL> if "<STR_LIT>" in message and m . endswith ( "<STR_LIT>" ) : <EOL> m = message [ : - <NUM_LIT:8> ] . split ( "<STR_LIT>" ) [ <NUM_LIT:1> ] <EOL> if any ( i . match ( m . strip ( ) ) for i in self . url_regex ) : <EOL> if any ( m . lower ( ) . endswith ( i ) for i in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) : <EOL> return """<STR_LIT>""" % ( m , m , m , m ) <EOL> if any ( m . endswith ( i ) for i in ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" ) ) : <EOL> return """<STR_LIT>""" % ( m , m , m , m ) <EOL> if "<STR_LIT>" in message : <EOL> m = message . split ( "<STR_LIT>" ) [ <NUM_LIT:1> ] . split ( "<STR_LIT:&>" ) [ <NUM_LIT:0> ] <EOL> return """<STR_LIT>""" % m <EOL> return message </s>
