def _deserialize(self, data_bytes) -> Message: message_state = json.loads(data_bytes.decode(encoding=ENCODING)) self._get_logger().debug( 'Parsing message: {}...'.format(message_state)) message_class = TYPE_TO_CLASS[MessageType((message_state['type'], ))] return create_object(message_class, message_state)
def _deserialize(self, data_bytes) -> Message: message_state = json.loads(data_bytes.decode(encoding=ENCODING)) self._get_logger().debug('Parsing message: {}...'.format(message_state)) message_class = TYPE_TO_CLASS[MessageType((message_state['type'],))] return create_object(message_class, message_state)
def __setstate__(self, state): super(MessageWithToken, self).__setstate__(state) self._token = create_object(Token, state['token'])
def deserialize_message(data_bytes, encoding='utf-8') -> Message: message_state = json.loads(data_bytes.decode(encoding=encoding)) message_class = TYPE_TO_CLASS[MessageType((message_state['type'],))] return create_object(message_class, message_state)