Get the first part from the message and print it raw.
357738
def getrawpart(self, msgid, stream=sys.stdout):
        
        for hdr, part in self._get(msgid):
            pl = part.get_payload(decode=True)
            if pl != None:
                print(pl, file=stream)
                break
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
555761
def print_message(self, message, verbosity_needed=1):
        
        if self.args.verbosity >= verbosity_needed:
            print(message)
867666
static void unescapePrintf(StringBuilder out, String message, int start, int end) {
    int pos = start;
    while (pos < end) {
      if (message.charAt(pos++) != '%') {
        continue;
      }
      if (pos == end) {
        // Ignore unexpected trailing '%'.
        break;
      }
      char chr = message.charAt(pos);
      if (chr == '%') {
        // Append the section up to and including the first '%'.
        out.append(message, start, pos);
      } else if (chr == 'n') {
        // %n encountered, rewind one position to not emit leading '%' and emit newline.
        out.append(message, start, pos - 1);
        out.append(SYSTEM_NEWLINE);
      } else {
        // A single unescaped '%' is ignored and left in the output as-is.
        continue;
      }
      // Increment the position and reset the start point after the last processed character.
      start = ++pos;
    }
    // Append the last section (if it's non empty).
    if (start < end) {
      out.append(message, start, end);
    }
  }
1028597
def from_raw_message(cls, rawmessage):
        """"""
        return ManageAllLinkRecord(rawmessage[2:3],
                                   rawmessage[3:4],
                                   rawmessage[4:7],
                                   rawmessage[7:8],
                                   rawmessage[8:9],
                                   rawmessage[9:10],
                                   rawmessage[10:11])
60420
def pretty_print(self):
        
        msg = "Source: " + str(self._source) + "\n"
        msg += "Destination: " + str(self._destination) + "\n"
        inv_types = {v: k for k, v in defines.Types.items()}
        msg += "Type: " + str(inv_types[self._type]) + "\n"
        msg += "MID: " + str(self._mid) + "\n"
        if self._code is None:
            self._code = 0

        msg += "Code: " + str(defines.Codes.LIST[self._code].name) + "\n"
        msg += "Token: " + str(self._token) + "\n"
        for opt in self._options:
            msg += str(opt)
        msg += "Payload: " + "\n"
        msg += str(self._payload) + "\n"
        return msg
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
537887
def _raw(s):
    """"""

    if isinstance(s, list):
        s = "\n".join(_raw(item) for item in s)

    if s == EOF:
        return "EOF"

    s = repr(s)  # Get raw representation of string
    s = s[1:-1]  # Strip away quotation marks
    if len(s) > 15:
        s = s[:15] + "..."  # Truncate if too long
    return s
1204431
def _read_message(self):
        
        line = self._rfile.readline()

        if not line:
            return None

        content_length = self._content_length(line)

        # Blindly consume all header lines
        while line and line.strip():
            line = self._rfile.readline()

        if not line:
            return None

        # Grab the body
        return self._rfile.read(content_length)
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
1265735
def unwrap_raw(content):
    
    starting_symbol = get_start_symbol(content)
    ending_symbol = ']' if starting_symbol == '[' else '}'
    start = content.find(starting_symbol, 0)
    end = content.rfind(ending_symbol)
    return content[start:end+1]
1176994
def FromTextFormat(cls, text):
    """"""
    tmp = cls.protobuf()  # pylint: disable=not-callable
    text_format.Merge(text, tmp)

    return cls.FromSerializedString(tmp.SerializeToString())
784343
def from_raw_message(cls, rawmessage):
        """"""
        userdata_dict = Userdata(rawmessage[8:22])
        return ExtendedSend(rawmessage[2:5],
                            {'cmd1': rawmessage[6],
                             'cmd2': rawmessage[7]},
                            userdata_dict,
                            flags=rawmessage[5],
                            acknak=rawmessage[22:23])
646759
def batch_message_from_parts(cls, messages):
        '''
        '''
        # Comma-separate the messages and wrap the lot in square brackets
        middle = b', '.join(messages)
        if not middle:
            raise ProtocolError.empty_batch()
        return b''.join([b'[', middle, b']'])
371238
def PrintMessage(self, message):
    
    if (message.DESCRIPTOR.full_name == _ANY_FULL_TYPE_NAME and
        self.descriptor_pool and self._TryPrintAsAnyMessage(message)):
      return
    fields = message.ListFields()
    if self.use_index_order:
      fields.sort(key=lambda x: x[0].index)
    for field, value in fields:
      if _IsMapEntry(field):
        for key in sorted(value):
          # This is slow for maps with submessage entires because it copies the
          # entire tree.  Unfortunately this would take significant refactoring
          # of this file to work around.
          #
          # TODO(haberman): refactor and optimize if this becomes an issue.
          entry_submsg = value.GetEntryClass()(key=key, value=value[key])
          self.PrintField(field, entry_submsg)
      elif field.label == descriptor.FieldDescriptor.LABEL_REPEATED:
        for element in value:
          self.PrintField(field, element)
      else:
        self.PrintField(field, value)
568762
def print(self, indent=2):
        """"""
        status = {
            ResultCode.NOT_IMPLEMENTED: '{}not implemented{}'.format(
                Fore.YELLOW, Style.RESET_ALL),
            ResultCode.IGNORED: '{}failed (ignored){}'.format(
                Fore.YELLOW, Style.RESET_ALL),
            ResultCode.FAILED: '{}failed{}'.format(
                Fore.RED, Style.RESET_ALL),
            ResultCode.PASSED: '{}passed{}'.format(
                Fore.GREEN, Style.RESET_ALL),
        }.get(self.code)
        print('{bold}{group}{provider}{checker}: {none}{status}{none}'.format(
            bold=Style.BRIGHT,
            group=(self.group.name + ' – ') if self.group.name else '',
            provider=(self.provider.name + ' – ') if self.provider else '',
            checker=self.checker.name,
            none=Style.RESET_ALL,
            status=status))
        if self.messages:
            for message in self.messages.split('\n'):
                print(pretty_description(message, indent=indent))
            if self.checker.hint:
                print(pretty_description(
                    'Hint: ' + self.checker.hint, indent=indent))
503489
public String getContentString(Message message)
    {
        try {
            String strContentType = message.getContentType();
            Object content = message.getContent();
            if (content instanceof MimeMultipart)
            {
                for (int index = 0; ; index++)
                {
                    BodyPart bodyPart = ((javax.mail.internet.MimeMultipart)content).getBodyPart(index);
                    Object contents = bodyPart.getContent();
                    if (contents != null)
                        return contents.toString();
                }
            }
            return message.getContent().toString();     // pend(don) FIX THIS!
        } catch (IOException ex)    {
            ex.printStackTrace();
        } catch (MessagingException ex)    {
            ex.printStackTrace();
        }
        return null;
    }