pymap.fetch
¶
- class pymap.fetch.LoadedMessageProvider(*args, **kwargs)[source]¶
Generic protocol that provides access to a message’s loaded contents when they are available.
- abstract property loaded_msg: LoadedMessageInterface | None¶
The loaded message, if available.
- class pymap.fetch.DynamicFetchValue(attribute, *, message, selected)[source]¶
Base class for fetch values that are dynamically read from a message.
- Parameters:
attribute (FetchAttribute) – The fetch attribute.
message (MessageInterface) – The message object.
selected (SelectedMailbox) – The selected mailbox.
- class pymap.fetch.DynamicLoadedFetchValue(attribute, *, message, get_loaded)[source]¶
Base class for fetch values that are dynamically read from a message and require loading its contents.
- Parameters:
attribute (FetchAttribute) – The fetch attribute.
message (MessageInterface) – The message object.
selected – The selected mailbox.
get_loaded (LoadedMessageProvider) – The provider of the loaded message contents, if available.
- abstract get_value(loaded_msg)[source]¶
Computes the value of the fetch attribute for the message.
- Parameters:
loaded_msg (LoadedMessageInterface) – The loaded message object.
- Return type:
- class pymap.fetch.MessageAttributes(message, selected, attributes)[source]¶
Defines the logic for how fetch attributes are resolved on a message to produce a fetch value.
- Parameters:
message (MessageInterface) – The message object.
selected (SelectedMailbox) – The selected mailbox.
attributes (Sequence[FetchAttribute])
- placeholder: ClassVar[bytes] = b'...'¶
Placeholder value for fetch values requiring loaded message contents.
- load_hook()[source]¶
An async context manager that loads the message content on entry, and releases it on exit. Fetch values that require loaded message content will write
placeholder
if written outside of this context manager, for console or log output.- Return type:
AsyncIterator[None]