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

Method __init__

Lib/mailbox.py:1567–1584  ·  view source on GitHub ↗

Initialize a Message instance.

(self, message=None)

Source from the content-addressed store, hash-verified

1565 """Message with mailbox-format-specific properties."""
1566
1567 def __init__(self, message=None):
1568 """Initialize a Message instance."""
1569 if isinstance(message, email.message.Message):
1570 self._become_message(copy.deepcopy(message))
1571 if isinstance(message, Message):
1572 message._explain_to(self)
1573 elif isinstance(message, bytes):
1574 self._become_message(email.message_from_bytes(message))
1575 elif isinstance(message, str):
1576 self._become_message(email.message_from_string(message))
1577 elif isinstance(message, io.TextIOWrapper):
1578 self._become_message(email.message_from_file(message))
1579 elif hasattr(message, "read"):
1580 self._become_message(email.message_from_binary_file(message))
1581 elif message is None:
1582 email.message.Message.__init__(self)
1583 else:
1584 raise TypeError('Invalid message type: %s' % type(message))
1585
1586 def _become_message(self, message):
1587 """Assume the non-format-specific state of message."""

Callers

nothing calls this directly

Calls 5

_become_messageMethod · 0.95
isinstanceFunction · 0.85
hasattrFunction · 0.85
_explain_toMethod · 0.45
__init__Method · 0.45

Tested by

no test coverage detected