#NEWLINE# def __init__( self , handler_map , error_mode = ERR_MODE_RAISE ) : #NEWLINE# #INDENT# self . _tag_stack = [ ] #NEWLINE# self . _start_handlers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . _end_handlers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . _char_handlers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( tag , fns ) in handler_map . items ( ) : #NEWLINE# #INDENT# if ( fns is None ) : #NEWLINE# #INDENT# fns = ( None , None , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if callable ( fns ) : #NEWLINE# #INDENT# fns = ( fns , None , None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( fns ) == 2 ) : #NEWLINE# #INDENT# fns = ( fns [ 0 ] , fns [ 1 ] , None ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# fns = [ ( self . _ignore if ( fn is None ) else fn ) for fn in fns ] #NEWLINE# ( start , end , char ) = fns #NEWLINE# self . _start_handlers [ tag ] = start #NEWLINE# self . _end_handlers [ tag ] = end #NEWLINE# self . _char_handlers [ tag ] = char #NEWLINE# #UNINDENT# self . _error_mode = error_mode