MCPcopy Index your code
hub / github.com/python/cpython / add

Method add

Lib/mailbox.py:662–670  ·  view source on GitHub ↗

Add message and return assigned key.

(self, message)

Source from the content-addressed store, hash-verified

660 self._file_length = None # Used to record mailbox size
661
662 def add(self, message):
663 """Add message and return assigned key."""
664 self._lookup()
665 self._toc[self._next_key] = self._append_message(message)
666 self._next_key += 1
667 # _append_message appends the message to the mailbox file. We
668 # don't need a full rewrite + rename, sync is enough.
669 self._pending_sync = True
670 return self._next_key - 1
671
672 def remove(self, key):
673 """Remove the keyed message; raise KeyError if it doesn't exist."""

Callers

nothing calls this directly

Calls 2

_lookupMethod · 0.95
_append_messageMethod · 0.95

Tested by

no test coverage detected