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

Method _append_message

Lib/mailbox.py:805–824  ·  view source on GitHub ↗

Append message to mailbox and return (start, stop) offsets.

(self, message)

Source from the content-addressed store, hash-verified

803 raise KeyError('No message with key: %s' % key) from None
804
805 def _append_message(self, message):
806 """Append message to mailbox and return (start, stop) offsets."""
807 self._file.seek(0, 2)
808 before = self._file.tell()
809 if len(self._toc) == 0 and not self._pending:
810 # This is the first message, and the _pre_mailbox_hook
811 # hasn't yet been called. If self._pending is True,
812 # messages have been removed, so _pre_mailbox_hook must
813 # have been called already.
814 self._pre_mailbox_hook(self._file)
815 try:
816 self._pre_message_hook(self._file)
817 offsets = self._install_message(message)
818 self._post_message_hook(self._file)
819 except BaseException:
820 self._file.truncate(before)
821 raise
822 self._file.flush()
823 self._file_length = self._file.tell() # Record current length of mailbox
824 return offsets
825
826
827

Callers 2

addMethod · 0.95
__setitem__Method · 0.95

Calls 9

_pre_mailbox_hookMethod · 0.95
_pre_message_hookMethod · 0.95
_post_message_hookMethod · 0.95
lenFunction · 0.85
seekMethod · 0.45
tellMethod · 0.45
_install_messageMethod · 0.45
truncateMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected