MCPcopy Index your code
hub / github.com/RustPython/RustPython / __init__

Method __init__

Lib/email/mime/message.py:16–33  ·  view source on GitHub ↗

Create a message/* type MIME document. _msg is a message object and must be an instance of Message, or a derived class of Message, otherwise a TypeError is raised. Optional _subtype defines the subtype of the contained message. The default is "rfc822" (this is defi

(self, _msg, _subtype='rfc822', *, policy=None)

Source from the content-addressed store, hash-verified

14 """Class representing message/* MIME documents."""
15
16 def __init__(self, _msg, _subtype='rfc822', *, policy=None):
17 """Create a message/* type MIME document.
18
19 _msg is a message object and must be an instance of Message, or a
20 derived class of Message, otherwise a TypeError is raised.
21
22 Optional _subtype defines the subtype of the contained message. The
23 default is "rfc822" (this is defined by the MIME standard, even though
24 the term "rfc822" is technically outdated by RFC 2822).
25 """
26 MIMENonMultipart.__init__(self, 'message', _subtype, policy=policy)
27 if not isinstance(_msg, message.Message):
28 raise TypeError('Argument is not an instance of Message')
29 # It's convenient to use this base class method. We need to do it
30 # this way or we'll get an exception
31 message.Message.attach(self, _msg)
32 # And be sure our default type is set correctly
33 self.set_default_type('message/rfc822')

Callers

nothing calls this directly

Calls 3

isinstanceFunction · 0.85
set_default_typeMethod · 0.80
attachMethod · 0.45

Tested by

no test coverage detected