#NEWLINE# def __init__( self , xml ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# result = ET . fromstring ( xml ) #NEWLINE# #UNINDENT# except ParseError as e : #NEWLINE# #INDENT# raise ParserException ( e ) #NEWLINE# #UNINDENT# self . get_status ( result , xml ) #NEWLINE# def xfind( haystack , needle ) : #NEWLINE# #INDENT# return ( haystack . find ( needle ) is not None ) #NEWLINE# #UNINDENT# if xfind ( result , 'entities' ) : #NEWLINE# #INDENT# self . _parse_collection ( result ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if xfind ( result , 'entity' ) : #NEWLINE# #INDENT# self . entity_count = 1 #NEWLINE# self . entities = self . _parse_entities ( result ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if any ( ( xfind ( result , x ) for x in [ 'include, exclude' , 'enabled' ] ) ) : #NEWLINE# #INDENT# self . _parse_target_dimensions ( result ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if xfind ( result , 'permissions' ) : #NEWLINE# #INDENT# self . _parse_permissions ( result ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if xfind ( result , 'log_entries' ) : #NEWLINE# #INDENT# self . entity_count = 1 #NEWLINE# self . entities = map ( self . dictify_history_entry , result . iterfind ( 'log_entries/entry' ) )