Get raw MP3 of a message.
974716
def mp3(self, sha, **kwargs):
        """"""
        return self._queue_msg({'cmd': cmd.CMD_MESSAGE_MP3,
                                'sha': _get_bytes(sha)}, **kwargs)
182708
def get_string(self, prompt, default_str=None) -> str:
        """"""
        accept_event = threading.Event()
        value_ref = [None]

        def perform():
            def accepted(text):
                value_ref[0] = text
                accept_event.set()

            def rejected():
                accept_event.set()

            self.__message_column.remove_all()
            pose_get_string_message_box(self.ui, self.__message_column, prompt, str(default_str), accepted, rejected)
            #self.__message_column.add(self.__make_cancel_row())

        with self.__lock:
            self.__q.append(perform)
            self.document_controller.add_task("ui_" + str(id(self)), self.__handle_output_and_q)
        accept_event.wait()
        def update_message_column():
            self.__message_column.remove_all()
            self.__message_column.add(self.__make_cancel_row())
        self.document_controller.add_task("ui_" + str(id(self)), update_message_column)
        if value_ref[0] is None:
            raise Exception("Cancel")
        return value_ref[0]
280991
def to_string(self, metadata=False):
        """"""
        return "\n".join(rec.get_message(metadata=metadata) for rec in self)
221149
def from_string(cls, id, format, raw_content, compressed=False,
                    encoded=False):
        """"""
        content = cls(id, format, compressed, encoded)
        content._raw_content = raw_content
        return content
209335
def _raw_recv(self):
        
        with self.lock:
            if self._index >= len(self._buffer):
                self._mcon()
            if self._index >= 199:
                self._resetbuffer()
                self._mcon()
            msg = self._buffer[self._index]
            while self.find(msg, 'PING :'):
                self._index += 1
                try:
                    msg = self._buffer[self._index]
                except IndexError:
                    self._mcon()
                    self.stepback(append=False)

            self._index += 1
            return msg
724973
def bytes_to_string(raw):
    """"""
    ret = bytes()
    for byte in raw:
        if byte == 0x00:
            return ret.decode("utf-8")
        ret += bytes([byte])
    return ret.decode("utf-8")
1052232
def convert_message_to_string(self, message):
        """"""
        final_message = ''
        for submessage in message:
            final_message += '* {submessage}\n'.format(submessage=submessage)
        return final_message
1265991
def from_raw_message(cls, rawmessage):
        """"""
        return StandardReceive(rawmessage[2:5],
                               rawmessage[5:8],
                               {'cmd1': rawmessage[9],
                                'cmd2': rawmessage[10]},
                               flags=rawmessage[8])
1281931
def msg(self, target, message, formatted=True, tags=None):
        """"""
        if formatted:
            message = unescape(message)

        self.send('PRIVMSG', params=[target, message], source=self.nick, tags=tags)
93987
def to_adb_message(self, data):
    """"""
    message = AdbMessage(AdbMessage.WIRE_TO_CMD.get(self.cmd),
                         self.arg0, self.arg1, data)
    if (len(data) != self.data_length or
        message.data_crc32 != self.data_checksum):
      raise usb_exceptions.AdbDataIntegrityError(
          '%s (%s) received invalid data: %s', message, self, repr(data))
    return message
825306
def get_message_data(msg, key):
    ''''''
    data = msg
    paths = key.split('.')
    for i in paths:
        data = getattr(data, i)
    return data
1277272
def raw_messages(self):
        ''''''
        if self.data:
            # offset for first message, at end of Mail data file header
            last_offset = 24
            self.skipped_chunks = 0

            for msginfo in self.index.messages:
                msg = self.data.get_message(msginfo.offset, msginfo.size)
                # Index file seems to references messages in order by
                # offset; check for data skipped between messages.
                if msginfo.offset > last_offset:
                    logger.debug('Skipped %d bytes between %s (%s) and %s (%s)',
                           msginfo.offset - last_offset,
                           last_offset, hex(last_offset),
                           msginfo.offset, hex(msginfo.offset))

                    self.skipped_chunks += 1
                last_offset = msginfo.offset + msginfo.size

                yield msg
615312
def get_text(self):
        """"""
        self._load_raw_content()
        if self._text is None:
            assert self._raw_content is not None
            ret_cont = self._raw_content
            if self.compressed:
                ret_cont = zlib.decompress(ret_cont, zlib.MAX_WBITS+16)
            if self.encoded:
                ret_cont = ret_cont.decode('utf-8')
            self._text = ret_cont
        assert self._text is not None
        return self._text
8391
def _audio_item(self, stream_url=None, offset=0, push_buffer=True, opaque_token=None):
        """"""
        audio_item = {'stream': {}}
        stream = audio_item['stream']

        # existing stream
        if not stream_url:
            # stream.update(current_stream.__dict__)
            stream['url'] = current_stream.url
            stream['token'] = current_stream.token
            stream['offsetInMilliseconds'] = current_stream.offsetInMilliseconds

        # new stream
        else:
            stream['url'] = stream_url
            stream['token'] = opaque_token or str(uuid.uuid4())
            stream['offsetInMilliseconds'] = offset

        if push_buffer:  # prevents enqueued streams from becoming current_stream
            push_stream(stream_cache, context['System']['user']['userId'], stream)
        return audio_item
735076
def get_message(self, dummy0, dummy1, use_cmd=False):
        """"""

        ns = _UJOIN % (self.db, self.coll)

        if use_cmd:
            ns = _UJOIN % (self.db, "$cmd")
            spec = self.as_command()[0]

            return query(0, ns, 0, -1, spec, None, self.codec_options)

        return get_more(ns, self.ntoreturn, self.cursor_id)
1216760
def _get_raw(source, bitarray):
        '''  '''
        offset = int(source['offset'])
        size = int(source['size'])
        return int(''.join(['1' if digit else '0' for digit in bitarray[offset:offset + size]]), 2)
812664
def dump(self, raw=False):
        '''  '''
        raw_out = self.ser.read(self.ser.in_waiting)
        if raw:
            return raw_out
        return raw_out.decode(OUTPUT_ENCODING)