#NEWLINE# def _colorize( self , pyval , state ) : #NEWLINE# #INDENT# pyval_type = type ( pyval ) #NEWLINE# state . score += 1 #NEWLINE# if ( ( pyval is None ) or ( pyval is True ) or ( pyval is False ) ) : #NEWLINE# #INDENT# self . _output ( unicode ( pyval ) , self . CONST_TAG , state ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type in ( int , float , long , types . ComplexType ) ) : #NEWLINE# #INDENT# self . _output ( unicode ( pyval ) , self . NUMBER_TAG , state ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type is str ) : #NEWLINE# #INDENT# self . _colorize_str ( pyval , state , '' , 'string-escape' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type is unicode ) : #NEWLINE# #INDENT# if self . ESCAPE_UNICODE : #NEWLINE# #INDENT# self . _colorize_str ( pyval , state , 'u' , 'unicode-escape' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _colorize_str ( pyval , state , 'u' , None ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type is list ) : #NEWLINE# #INDENT# self . _multiline ( self . _colorize_iter , pyval , state , '[' , ']' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type is tuple ) : #NEWLINE# #INDENT# self . _multiline ( self . _colorize_iter , pyval , state , '(' , ')' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type is set ) : #NEWLINE# #INDENT# self . _multiline ( self . _colorize_iter , self . _sort ( pyval ) , state , 'set([' , '])' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type is frozenset ) : #NEWLINE# #INDENT# self . _multiline ( self . _colorize_iter , self . _sort ( pyval ) , state , 'frozenset([' , '])' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyval_type is dict ) : #NEWLINE# #INDENT# self . _multiline ( self . _colorize_dict , self . _sort ( pyval . items ( ) ) , state , '{' , '}' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if is_re_pattern ( pyval ) : #NEWLINE# #INDENT# self . _colorize_re ( pyval , state ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# pyval_repr = repr ( self ) #NEWLINE# if ( not isinstance ( pyval_repr , ( str , unicode ) ) ) : #NEWLINE# #INDENT# pyval_repr = unicode ( pyval_repr ) #NEWLINE# #UNINDENT# pyval_repr_ok = True #NEWLINE# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pyval_repr_ok = False #NEWLINE# state . score -= 100 #NEWLINE# #UNINDENT# if pyval_repr_ok : #NEWLINE# #INDENT# if self . GENERIC_OBJECT_RE . match ( pyval_repr ) : #NEWLINE# #INDENT# state . score -= 5 #NEWLINE# #UNINDENT# self . _output ( pyval_repr , None , state ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# state . result . append ( self . UNKNOWN_REPR )