A C{PMap}, the message contents without Eliot metadata.
343771
def contents(self):
        
        return self._logged_dict.discard(TIMESTAMP_FIELD).discard(
            TASK_UUID_FIELD
        ).discard(TASK_LEVEL_FIELD)
871917
def get_metadata(dist):
    
    if not dist.has_metadata('PKG-INFO'):
        return

    msg = email.message_from_string(dist.get_metadata('PKG-INFO'))
    metadata = {}
    for header in [l for l in msg._headers]:
        metadata[header[0]] = header[1]

    return metadata
492167
public static String bareMIME(final String pMIME) {
        int idx;
        if (pMIME != null && (idx = pMIME.indexOf(';')) >= 0) {
            return pMIME.substring(0, idx);
        }
        return pMIME;
    }
263489
def to_message(base):
    
    ctype, ctparams = base.get_content_type()

    if not ctype:
        if base.parts:
            ctype = 'multipart/mixed'
        else:
            ctype = 'text/plain'

    maintype, subtype = ctype.split('/')
    is_text = maintype == 'text'
    is_multipart = maintype == 'multipart'

    if base.parts and not is_multipart:
        raise RuntimeError(
            'Content type should be multipart, not %r' % ctype
            )

    body = base.get_body()
    ctenc = base.get_transfer_encoding()
    charset = ctparams.get('charset')

    if is_multipart:
        out = MIMEMultipart(subtype, **ctparams)
    else:
        out = MIMENonMultipart(maintype, subtype, **ctparams)
        if ctenc:
            out['Content-Transfer-Encoding'] = ctenc
        if isinstance(body, text_type):
            if not charset:
                if is_text:
                    charset, _ = best_charset(body)
                else:
                    charset = 'utf-8'
            if PY2:
                body = body.encode(charset)
            else: # pragma: no cover
                body = body.encode(charset, 'surrogateescape')
        if body is not None:
            if ctenc:
                body = transfer_encode(ctenc, body)
            if not PY2: # pragma: no cover
                body = body.decode(charset or 'ascii', 'replace')
        out.set_payload(body, charset) 

    for k in base.keys(): # returned sorted
        value = base[k]
        if not value:
            continue
        out[k] = value

    cdisp, cdisp_params = base.get_content_disposition()

    if cdisp:
        out.add_header('Content-Disposition', cdisp, **cdisp_params)

    # go through the children
    for part in base.parts:
        sub = to_message(part)
        out.attach(sub)

    return out
1162759
def _clean_metadata(self):
        
        desc = self.metadata.get_long_description()
        if not isinstance(desc, six.text_type):
            desc = desc.decode('utf-8')
        lines = io.StringIO(desc)

        def trim_eight_spaces(line):
            if line.startswith(' ' * 8):
                line = line[8:]
            return line
        lines = itertools.chain(
            itertools.islice(lines, 1),
            six.moves.map(trim_eight_spaces, lines),
        )
        self.metadata.long_description = ''.join(lines)
1007984
private String getFormContentType(Message message) {
        return message.getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE) != null ? message.getHeader(HttpMessageHeaders.HTTP_CONTENT_TYPE).toString() : null;
    }
1335272
function (message) {
    var objs = [], collector = '', chr, msglen, data;

    this.data += message;
    data = new Buffer(this.data, 'utf8');

    for (var i = 0; i < data.length; i += 1) {
        chr = data[i];
        if (chr > 47 && chr < 58) {
            collector += String.fromCharCode(chr);
        } else if (chr !== 10 && chr !== 13) {
            msglen = parseInt(collector, 10);

            if (msglen + i <= data.length) {
              objs.push(JSON.parse(data.toString('utf8', i, msglen + i)));
              data = data.slice(i + msglen);
              collector = '';
              i = 0;
            } else {
              break;
            }
        }
    }
    this.data = data.toString('utf8');
    return objs;
}
640211
def _parse_metadata(self, message):
        

        metadata = Metadata(source=self.actor_urn).__dict__
        if 'author' in message['d']:
            metadata['source_user'] = message['d']['author']['username']
        else:
            metadata['source_user'] = None
        if 'channel_id' in message['d']:
            metadata['source_channel'] = message['d']['channel_id']
        else:
            metadata['source_channel'] = None
        metadata['user_id'] = metadata['source_user']
        metadata['display_name'] = metadata['source_user']

        metadata['source_connector'] = 'discord'

        return metadata
313742
private void getMessageDigestMD5() throws AttributeNotFoundException {
        if (MBeans.messageDigestMD5 == null) {
            try {
                MBeans.messageDigestMD5 = MessageDigestUtility.createMessageDigest("MD5");
            } catch (NoSuchAlgorithmException e) {
                Tr.error(tc, "DYNA1044E", new Object[] { e.getMessage() });
                throw new AttributeNotFoundException("Message digest for MD5 is not available. " + e.getMessage());
            }
        }
    }
633379
def content(self):
        """"""

        if not self.payload:
            return ''

        if self.payload.is_multipart():
            message_bytes = mime_to_bytes(
                self.payload, 0).replace(b'\n', b'\r\n')
            boundary = b'--' + self.payload.get_boundary().encode('utf-8')
            temp = message_bytes.split(boundary)
            temp.pop(0)
            return boundary + boundary.join(temp)
        else:
            content = self.payload.get_payload()
            if isinstance(content, str_cls):
                content = content.encode('utf-8')
            return content
747336
def message(self):
        """"""
        if self.type == 'cleartext':
            return self.bytes_to_text(self._message)

        if self.type == 'literal':
            return self._message.contents

        if self.type == 'encrypted':
            return self._message
112449
def unwrap(self, message, signature):
        
        plain_text = _Ntlm1Session.decrypt(self, message)
        _Ntlm1Session.verify(self, plain_text, signature)
        return plain_text
619270
def from_mime(cls, message, manager):
        
        text, html, attachments = deconstruct_multipart(message)
        subject = prepare_header(message["Subject"])
        sender = prepare_header(message["From"])
        to = prepare_header(message["To"])
        cc = prepare_header(message["Cc"])
        bcc = prepare_header(message["Bcc"])
        reply_to = prepare_header(message["Reply-To"])
        tag = getattr(message, "tag", None)
        return cls(
            manager=manager,
            From=sender,
            To=to,
            TextBody=text,
            HtmlBody=html,
            Subject=subject,
            Cc=cc,
            Bcc=bcc,
            ReplyTo=reply_to,
            Attachments=attachments,
            Tag=tag,
        )
428252
def sanitize_metadata(self, metadata, replace_hyphen_with="-"):
        """"""
        return {str(k).replace("-", replace_hyphen_with): str(v)
                for k, v in (metadata or {}).items() if v is not None}
250546
def unpack_message(buffer):
    
    hdr_size = Header().get_size()
    hdr_buff, msg_buff = buffer[:hdr_size], buffer[hdr_size:]
    header = Header()
    header.unpack(hdr_buff)
    message = new_message_from_header(header)
    message.unpack(msg_buff)
    return message
1284235
def from_raw_message(cls, rawmessage):
        """"""
        if (rawmessage[5] &
                MESSAGE_FLAG_EXTENDED_0X10) == MESSAGE_FLAG_EXTENDED_0X10:
            if len(rawmessage) >= ExtendedSend.receivedSize:
                msg = ExtendedSend.from_raw_message(rawmessage)
            else:
                msg = None
        else:
            msg = StandardSend(rawmessage[2:5],
                               {'cmd1': rawmessage[6],
                                'cmd2': rawmessage[7]},
                               flags=rawmessage[5],
                               acknak=rawmessage[8:9])
        return msg
1091718
def clean_message(message: Message, topmost: bool = False) -> Message:
    
    if message.is_multipart():
        # Don't recurse in already-deleted attachments
        if message.get_content_type() != 'message/external-body':
            parts = message.get_payload()
            parts[:] = map(clean_message, parts)
    elif message_is_binary(message):
        # Don't gut if this is the topmost message
        if not topmost:
            message = gut_message(message)

    return message