[issue46734] Add Maildir.get_flags() to access message flags without opening the file

2022-02-12 Thread Stephen Gildea


Change by Stephen Gildea :


--
keywords: +patch
pull_requests: +29463
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/31302

___
Python tracker 
<https://bugs.python.org/issue46734>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue46734] Add Maildir.get_flags() to access message flags without opening the file

2022-02-12 Thread Stephen Gildea


New submission from Stephen Gildea :

A message's flags are stored in its filename by Maildir, so the flags
are available without reading the message file itself.  The structured
message file name makes it efficient to scan a large mailbox to select
only messages that are, for example, not Trashed.

The mailbox.Maildir interface does not expose these flags, however.  The
only way to access the flags through the mailbox library is to create a
mailbox.MaildirMessage object, which has a get_flags() method.  But
creating a MaildirMessage requires opening the message file, which is slow.

I propose adding a parallel get_flags(key) method to mailbox.Maildir,
so that the flags are available without having to create a
MaildirMessage object.

In iterating through a mailbox with thousands of messages, I find that
this proposed Maildir.get_flags() method is 50 times faster than
MaildirMessage.get_flags().

--
components: Library (Lib)
messages: 413145
nosy: gildea
priority: normal
severity: normal
status: open
title: Add Maildir.get_flags() to access message flags without opening the file
type: enhancement
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46734>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com