Commit graph

132 commits

Author SHA1 Message Date
Stephen Gildea 38035fed9b
gh-90890: New methods to access mailbox.Maildir message info and flags (#103905)
New methods to access mailbox.Maildir message info and flags:
get_info, set_info, get_flags, set_flags, add_flag, remove_flag.

These methods speed up accessing a message's info and/or flags and are
useful when it is not necessary to access the message's contents,
as when iterating over a Maildir to find messages with specific flags.

---------

* Add more str type checking
* modernize to f-strings instead of %

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2023-11-11 17:41:33 +00:00
Nick Drozd 024ac542d7
bpo-45975: Simplify some while-loops with walrus operator (GH-29347) 2022-11-26 14:33:25 -08:00
Ethan Smith d01628e411
bpo-39481: PEP 585 for dataclasses, mailbox, contextvars (GH-19425) 2020-04-14 16:14:15 -07:00
Cheryl Sabella d16f012f84 bpo-31522: mailbox.get_string: pass from_ parameter to get_bytes (#9857)
This allows *from_* to be successfully set to a non-default value when calling mbox.get_string.
2018-10-18 20:21:47 -04:00
Serhiy Storchaka 5affd23e6f bpo-29762: More use "raise from None". (#569)
This hides unwanted implementation details from tracebacks.
2017-04-05 09:37:24 +03:00
Xavier de Gaye 452b3a6a3e Issue #28764: Fix a test_mailbox failure on Android API 24 when run as a non-root user. 2016-12-12 09:55:57 +01:00
Martin Panter ed84ab3335 Issue #27107: Add exception classes to mailbox.__all__, by Jacek Kołodziej 2016-06-06 01:56:09 +00:00
Serhiy Storchaka 6a7b3a77b4 Issue #26778: Fixed "a/an/and" typos in code comment and documentation. 2016-04-17 08:32:47 +03:00
Serhiy Storchaka 2116b12da5 Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:29:28 +03:00
Serhiy Storchaka 7e7a3dba5f Issue #23865: close() methods in multiple modules now are idempotent and more
robust at shutdown. If needs to release multiple resources, they are released
even if errors are occured.
2015-04-10 13:24:41 +03:00
Raymond Hettinger bb6c0aaebf PEP 479: Use the return-keyword instead of raising StopIteration inside a generators. 2014-11-22 22:14:41 -08:00
Raymond Hettinger df1b699447 Issue #22823: Use set literals instead of creating a set from a list 2014-11-09 15:56:33 -08:00
Serhiy Storchaka 148679982f Issue #22369: Change "context manager protocol" to "context management protocol". 2014-09-10 23:43:41 +03:00
Serhiy Storchaka cd3aacf525 Issue #20729: Restored the use of lazy iterkeys()/itervalues()/iteritems()
in the mailbox module.  This is partial rollback of changeset f340cb045bf9.
2014-08-13 09:35:21 +03:00
Victor Stinner 7fa767e517 Issue #20976: pyflakes: Remove unused imports 2014-03-20 09:16:38 +01:00
Serhiy Storchaka 8f8ec92de8 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang lines in the unittestgui and checkpip scripts.
2014-01-16 17:33:23 +02:00
Serhiy Storchaka b992a0e102 Issue #19936: Added executable bits or shebang lines to Python scripts which
requires them.  Disable executable bits and shebang lines in test and
benchmark files in order to prevent using a random system python, and in
source files of modules which don't provide command line interface.  Fixed
shebang line to use python3 executable in the unittestgui script.
2014-01-16 17:15:49 +02:00
R David Murray cf6d0e77ea Merge #19037: adjust file times *before* moving maildir files into place. 2013-09-18 08:36:36 -04:00
R David Murray 41a22f1a77 #19037: adjust file times *before* moving maildir files into place.
This avoids race conditions when other programs are monitoring
the maildir directory.  Patch by janzert.
2013-09-18 08:34:40 -04:00
Brett Cannon cd171c8e92 Issue #18200: Back out usage of ModuleNotFoundError (8d28d44f3a9a) 2013-07-04 17:43:24 -04:00
Brett Cannon 0a140668fa Issue #18200: Update the stdlib (except tests) to use
ModuleNotFoundError.
2013-06-13 20:57:26 -04:00
Giampaolo Rodola' 0166a283f6 modernize some modules' code by replacing OSError->ENOENT/ENOTDIR/EPERM/EEXIST occurrences with the corresponding pep-3151 exceptions (FileNotFoundError, NotADirectoryError, etc.) 2013-02-12 15:14:17 +01:00
Giampaolo Rodola' 2f50aaf2ff modernize some modules' code by using with statement around open() 2013-02-12 02:04:27 +01:00
Andrew Svetlov f7a17b48d7 Replace IOError with OSError (#16715) 2012-12-25 16:47:37 +02:00
Jesus Cea 4791a24268 #16135: Removal of OS/2 support (Python code partial cleanup) 2012-10-05 03:15:39 +02:00
Jesus Cea f1af705720 #16135: Removal of OS/2 support (Remove OS2 and OS/2 references) 2012-10-05 02:48:46 +02:00
Philip Jenvey 4993cc0a5b utilize yield from 2012-10-01 12:53:43 -07:00
Petri Lehtinen f6b30385cc #15222: Merge 3.2 2012-09-25 22:06:07 +03:00
Petri Lehtinen f39884bb5a #15222: Insert blank line after each message in mbox mailboxes 2012-09-25 22:02:06 +03:00
Petri Lehtinen 69a06dd59d #11062: Fix universal newline support in Babyl._install_message() 2012-08-16 07:27:53 +03:00
Petri Lehtinen 88614948c0 #11062: Fix universal newline support in Babyl._install_message()
When adding a message from a binary file, \r\n was translated to
\r\r\n in the message body.
2012-08-16 07:27:01 +03:00
Petri Lehtinen aae61b8cd0 #11062: Fix adding a message from file to Babyl mailbox 2012-08-15 14:36:14 +03:00
Petri Lehtinen 3d12c4317c #11062: Fix adding a message from file to Babyl mailbox 2012-08-15 14:26:27 +03:00
Petri Lehtinen 25652884b4 #5346: Preserve permissions of mbox, MMDF and Babyl mailbox files on flush() 2012-06-29 15:12:54 +03:00
Petri Lehtinen 5b5619f717 #5346: Preserve permissions of mbox, MMDF and Babyl mailbox files on flush() 2012-06-29 15:10:41 +03:00
Petri Lehtinen 31a78c3d65 #9559: Don't call _pre_mailbox_hook more than once 2012-06-29 13:51:50 +03:00
Petri Lehtinen b6ee3d6b7a #9559: Don't call _pre_mailbox_hook more than once 2012-06-29 13:50:21 +03:00
Petri Lehtinen dde8cb0899 #9559: Append data to single-file mailbox files if messages are only added
If messages were only added, a new file is no longer created and
renamed over the old file when flush() is called on an mbox, MMDF or
Babyl mailbox.
2012-06-28 13:56:14 +03:00
Petri Lehtinen f29435f9f0 #9559: Append data to single-file mailbox files if messages are only added
If messages were only added, a new file is no longer created and
renamed over the old file when flush() is called on an mbox, MMDF or
Babyl mailbox.
2012-06-28 13:53:23 +03:00
Petri Lehtinen a717d563d0 #15036: Make a repeated changes and flushes work with single-file mailboxes 2012-06-15 21:01:56 +03:00
Petri Lehtinen 02653f1b11 #15036: Make a repeated changes and flushes work with single-file mailboxes 2012-06-15 20:59:31 +03:00
R David Murray b019ee752a #12537: in mailbox avoid depending on knowledge of email package internals
Previously mailbox was copying a list of attributes from one message object to
another in order to "copy the message data".  This means that any time new
attributes were added to email.message.Message, mailbox broke.  Now instead it
copies all attributes from the source object to the target object, skipping
any mailbox-object-specific attributes to produce the same clean initial
state it was previously getting by copying only the "known" attributes.

David Lam assisted in the development of this patch.
2012-04-08 22:36:07 -04:00
Petri Lehtinen 8c481b6212 Fix Maildir initialization so that maildir contents are read correctly.
Closes #13254.
2011-11-05 09:46:10 +02:00
Petri Lehtinen 8c482ee955 Fix Maildir initialization so that maildir contents are read correctly.
Closes #13254.
2011-11-05 09:44:59 +02:00
Victor Stinner 5c267e2d22 Close #12454: The mailbox module is now using ASCII, instead of the locale
encoding, to read and write MH mailboxes (.mh_sequences files).
2011-10-17 20:44:22 +02:00
R David Murray c88bce1580 #11700: proxy object close methods can now be called multiple times
This makes them work like the close provided by regular file objects.
2011-06-17 22:24:05 -04:00
R David Murray 05ff990401 #11767: use context manager to close file in __getitem__ to prevent FD leak
All of the other methods in mailbox that create message objects take care to
close the file descriptors they use, so it seems to make sense to have
__getitem__ do so as well.

Patch by Filip Gruszczyński.
2011-06-17 12:54:56 -04:00
R David Murray 94b8ee3bff #11999: sync based on comparing mtimes, not mtime to system clock 2011-05-06 22:20:34 -04:00
R David Murray caed7fe0ff #11999: sync based on comparing mtimes, not mtime to system clock 2011-05-06 22:07:19 -04:00
R. David Murray 752b950e6b Merged revisions 88730 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88730 | r.david.murray | 2011-03-03 13:03:36 -0500 (Thu, 03 Mar 2011) | 2 lines

  #11306: Treat EROFS like EACCES when making a 'file is read-only' decision
........
2011-03-03 18:12:34 +00:00