mailbox.Mailbox¶
-
class
mailbox.Mailbox(path, factory=None, create=True)[source]¶ A group of messages in a particular place.
Methods¶
__contains__(key) |
|
__delitem__(key) |
|
__getitem__(key) |
Return the keyed message; raise KeyError if it doesn’t exist. |
__init__(path[, factory, create]) |
Initialize a Mailbox instance. |
__iter__() |
|
__len__() |
Return a count of messages in the mailbox. |
__setitem__(key, message) |
Replace the keyed message; raise KeyError if it doesn’t exist. |
_dump_message(message, target[, mangle_from_]) |
Dump message contents to target file. |
add(message) |
Add message and return assigned key. |
clear() |
Delete all messages. |
close() |
Flush and close the mailbox. |
discard(key) |
If the keyed message exists, remove it. |
flush() |
Write any pending changes to the disk. |
get(key[, default]) |
Return the keyed message, or default if it doesn’t exist. |
get_file(key) |
Return a file-like representation or raise a KeyError. |
get_message(key) |
Return a Message representation or raise a KeyError. |
get_string(key) |
Return a string representation or raise a KeyError. |
has_key(key) |
Return True if the keyed message exists, False otherwise. |
items() |
Return a list of (key, message) tuples. |
iteritems() |
Return an iterator over (key, message) tuples. |
iterkeys() |
Return an iterator over keys. |
itervalues() |
Return an iterator over all messages. |
keys() |
Return a list of keys. |
lock() |
Lock the mailbox. |
pop(key[, default]) |
Delete the keyed message and return it, or default. |
popitem() |
Delete an arbitrary (key, message) pair and return it. |
remove(key) |
Remove the keyed message; raise KeyError if it doesn’t exist. |
unlock() |
Unlock the mailbox if it is locked. |
update([arg]) |
Change the messages that correspond to certain keys. |
values() |
Return a list of messages. |