#NEWLINE# def _parse_message( message_text ) : #NEWLINE# #INDENT# '\n        Parse out some semantics for teh lulz.\n        \n        ' #NEWLINE# links = list ( ) #NEWLINE# tags = '' #NEWLINE# message_text = message_text . replace ( '\n' , '' ) #NEWLINE# links = [ link for link in URL_RE . findall ( message_text ) ] #NEWLINE# link_ctr = 1 #NEWLINE# link_dict = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for link in URL_RE . finditer ( message_text ) : #NEWLINE# #INDENT# link_dict [ link . group ( 0 ) ] = link_ctr #NEWLINE# link_ctr += 1 #NEWLINE# #UNINDENT# generate_link_num = ( lambda obj : ( '[%d]' % link_dict [ obj . group ( 0 ) ] ) ) #NEWLINE# if ( ( not hasattr ( settings , 'TWITTER_REMOVE_LINKS' ) ) or ( settings . TWITTER_REMOVE_LINKS == True ) ) : #NEWLINE# #INDENT# message_text = URL_RE . sub ( generate_link_num , message_text ) #NEWLINE# #UNINDENT# message_text = USERNAME_RE . sub ( '' , message_text ) #NEWLINE# message_text = RT_RE . sub ( _transform_retweet , message_text ) #NEWLINE# message_text = USER_RE . sub ( _transform_user_ref_to_link , message_text ) #NEWLINE# tags = ' ' . join ( [ tag [ 1 : ] for tag in TAG_RE . findall ( message_text ) ] ) #NEWLINE# if ( ( not hasattr ( settings , 'TWITTER_REMOVE_TAGS' ) ) or ( settings . TWITTER_REMOVE_TAGS == True ) ) : #NEWLINE# #INDENT# message_text = TAG_RE . sub ( '' , message_text ) #NEWLINE# #UNINDENT# return ( message_text . strip ( ) , links , tags )