#NEWLINE# def unserialize( self , payload , isBinary = None ) : #NEWLINE# #INDENT# '\n        Implements :func:`autobahn.wamp.interfaces.ISerializer.unserialize`\n        ' #NEWLINE# if ( isBinary is not None ) : #NEWLINE# #INDENT# if ( isBinary != raw_msgs . _serializer . BINARY ) : #NEWLINE# #INDENT# raise ProtocolError ( 'invalid serialization of WAMP message (binary {0}, but expected {1})' . format ( isBinary , self . _serializer . BINARY ) ) #NEWLINE# #UNINDENT# #UNINDENT# try : #NEWLINE# #INDENT# raw_msgs = self . _serializer . unserialize ( payload ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# raise ProtocolError ( 'invalid serialization of WAMP message ({0})' . format ( e ) ) #NEWLINE# #UNINDENT# msgs = [ ] #NEWLINE# for raw_msg in raw_msgs : #NEWLINE# #INDENT# if ( type ( raw_msg ) != list ) : #NEWLINE# #INDENT# raise ProtocolError ( 'invalid type {0} for WAMP message' . format ( type ( raw_msg ) ) ) #NEWLINE# #UNINDENT# if ( len ( raw_msg ) == 0 ) : #NEWLINE# #INDENT# raise ProtocolError ( 'missing message type in WAMP message' ) #NEWLINE# #UNINDENT# message_type = raw_msg [ 0 ] #NEWLINE# if ( type ( message_type ) not in six . integer_types ) : #NEWLINE# #INDENT# raise ProtocolError ( 'invalid type {0} for WAMP message type' . format ( type ( message_type ) ) ) #NEWLINE# #UNINDENT# Klass = self . MESSAGE_TYPE_MAP . get ( message_type ) #NEWLINE# if ( Klass is None ) : #NEWLINE# #INDENT# raise ProtocolError ( 'invalid WAMP message type {0}' . format ( message_type ) ) #NEWLINE# #UNINDENT# msg = Klass . parse ( raw_msg ) #NEWLINE# msgs . append ( msg ) #NEWLINE# #UNINDENT# return msgs