FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-55454: Add IMAP4 IDLE support to imaplib by foresto · Pull Request #122542 · python/cpython · GitHub

/ cpython Public
Merged
Changes from 1 commit
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
572d1e5
gh-55454: Add IMAP4 IDLE support to imaplib
Jul 31, 2024
dc71241
gh-55454: Clarify imaplib idle() docs
Sep 11, 2024
f41f2bb
docs: words instead of <=
gpshead Sep 21, 2024
8077f2e
docs: improve style in an example
gpshead Sep 21, 2024
24fcdbb
docs: grammatical edit
gpshead Sep 21, 2024
2c76b2f
docs consistency
gpshead Sep 21, 2024
5ef5bb2
comment -> docstring
gpshead Sep 21, 2024
91266e0
docs: refer to imaplib as "this module"
foresto Sep 22, 2024
19c98dc
imaplib: simplify & clarify idle debug message
foresto Sep 22, 2024
882bf2c
imaplib: elaborate in idle context manager comment
Sep 22, 2024
f648fec
imaplib: re-raise BaseException instead of bare except
foresto Sep 22, 2024
48f6f76
imaplib: convert private doc string to comment
Sep 22, 2024
013bbf1
docs: correct mistake in imaplib example
Sep 22, 2024
acbc4a1
imaplib: simplify example code in doc string
Sep 23, 2024
94c02e8
imaplib: rename _Idler to Idler, update its docs
Sep 23, 2024
0c6c9a4
imaplib: add comment in Idler._pop()
foresto Sep 23, 2024
223c2fa
imaplib: remove unnecessary blank line
foresto Sep 23, 2024
e64546c
imaplib: comment on use of unbuffered pipes
Sep 23, 2024
f385e44
docs: imaplib: use the reStructuredText :class: role
foresto Sep 24, 2024
3aceaec
Revert "docs: imaplib: use the reStructuredText :class: role"
Sep 24, 2024
c8d4d6d
docs: imaplib: use the reST :class: role, escaped
Sep 26, 2024
75fbe8e
Merge branch 'main' into imaplib-idle
gvanrossum Dec 1, 2024
c7ed3c5
docs: refer to IMAP4 IDLE instead of just IDLE
foresto Dec 1, 2024
b01de95
imaplib: IDLE -> IMAP4 IDLE in exception message
foresto Dec 1, 2024
a3f21cd
docs: imaplib idle() phrasing and linking tweaks
Dec 1, 2024
247e6b5
docs: imaplib: avoid linking to an invalid target
Dec 2, 2024
79e3d83
imaplib: update test after recent exception change
Dec 2, 2024
14dfd21
imaplib: rename idle() dur argument to duration
Dec 2, 2024
19253d1
imaplib: bytes.index() -> bytes.find()
Dec 2, 2024
b65074e
imaplib: remove no-longer-necessary statement
foresto Dec 2, 2024
5d8a40b
docs: imaplib: concise & valid method links
Dec 3, 2024
fc13f75
imaplib: note data types present in IDLE responses
Dec 3, 2024
3221dbc
docs: imaplib: add comma to reST changes header
foresto Dec 4, 2024
564c722
imaplib: sync doc strings with reST docs
Dec 7, 2024
c9e8034
docs: imaplib: minor Idler clarifications
Dec 7, 2024
9c4af2c
imaplib: idle: emit (type, [data, ...]) tuples
Dec 7, 2024
59e0c6a
imaplib: while/yield instead of yield from iter()
Dec 8, 2024
2e3e956
imaplib: idle: use deadline idiom when iterating
Dec 9, 2024
bdde943
docs: imaplib: state duration/interval arg types
Dec 9, 2024
b64c7a5
docs: imaplib: minor rephrasing of a sentence
Dec 9, 2024
b73a365
docs: imaplib: reposition a paragraph
Dec 9, 2024
ae74499
docs: imaplib: wrap long lines in idle() section
Dec 9, 2024
92d7ce7
docs: imaplib: note: Idler objects require 'with'
Dec 9, 2024
171ebf1
docs: imaplib: say that 29 minutes is 1740 seconds
Dec 9, 2024
5682ef4
docs: imaplib: mark a paragraph as a 'tip'
Dec 10, 2024
656e9f5
docs: imaplib: rephrase reference to MS Windows
Dec 10, 2024
3b70534
imaplib: end doc string titles with a period
Dec 10, 2024
60e2b6f
imaplib: idle: socket timeouts instead of select()
Dec 15, 2024
def6ab5
imaplib: Idler: rename private state attributes
Dec 15, 2024
8e0b6b0
imaplib: rephrase a comment in example code
Dec 15, 2024
08a4536
docs: imaplib: idle: use Sphinx code-block:: pycon
Dec 15, 2024
c881c8b
docs: whatsnew: imaplib: reformat IMAP4.idle entry
Dec 15, 2024
266a292
imaplib: idle: make doc strings brief
Dec 16, 2024
055a9bd
imaplib: Idler: split assert into two statements
Dec 16, 2024
4d3f020
imaplib: Idler: move assignment out of try: block
Dec 16, 2024
80aaf8d
imaplib: Idler: move __exit__() for readability
Dec 16, 2024
03b5205
imaplib: Idler: move __next__() for readability
Dec 16, 2024
83c8946
imaplib: test: make IdleCmdHandler a global class
Dec 16, 2024
be2d2b0
docs: imaplib: idle: collapse double-spaces
Dec 16, 2024
de62a3e
imaplib: warn on use of undocumented 'file' attr
Dec 17, 2024
7fc8a24
imaplib: revert import reformatting
Dec 17, 2024
33a1fed
imaplib: restore original exception msg formatting
Dec 17, 2024
40e607a
docs: imaplib: idle: versionadded:: next
Dec 17, 2024
9a07f3b
imaplib: move import statement to where it's used
Dec 17, 2024
f47de53
imaplib test: RuntimeWarning on IMAP4.file access
Dec 17, 2024
66d32a0
imaplib: use stacklevel=2 in warnings.warn()
Dec 17, 2024
d619580
imaplib test: simplify IMAP4.file warning test
Dec 17, 2024
fc8b6f4
imaplib test: pre-idle-continuation response
Dec 21, 2024
b767ab6
imaplib test: post-done untagged response
Dec 21, 2024
dcd0161
imaplib: downgrade idle-denied exception to error
Dec 22, 2024
53c7a19
imaplib: simplify check for socket object
Jan 9, 2025
fcaf355
imaplib: narrow the scope of IDLE socket timeouts
Jan 9, 2025
a47bcb4
imaplib: preserve partial reads on exception
Jan 10, 2025
7fc4b78
imaplib: read/readline: save multipart buffer tail
Jan 10, 2025
be34141
imaplib: use TimeoutError subclass only if needed
Jan 20, 2025
e8a8509
doc: imaplib: elaborate on IDLE response delivery
Jan 20, 2025
8d78010
doc: imaplib: elaborate in note re: IMAP4.response
Jan 20, 2025
e8f0532
Merge branch 'main' into imaplib-idle
Feb 4, 2025
f650dfa
imaplib: comment on benefit of reading in chunks
Feb 4, 2025
3512858
imaplib: readline(): treat ConnectionError as EOF
Feb 5, 2025
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
Prev Previous commit
Next Next commit
imaplib: sync doc strings with reST docs
  • Loading branch information
Forest committed Dec 7, 2024
commit 564c722abac35331bb6fe414be93101e4eac6dbb
32 changes: 17 additions & 15 deletions Lib/imaplib.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -651,9 +651,9 @@ def idle(self, duration=None):
"""Return an Idler: an iterable context manager for the IDLE command
Comment thread
foresto marked this conversation as resolved.
Outdated

:param duration: Maximum duration (in seconds) to keep idling,
or None for no time limit.
To avoid inactivity timeouts on servers that impose
them, callers are advised to keep this <= 29 minutes.
or None for no time limit. To avoid inactivity
timeouts on servers that impose them, callers are
advised to keep this at most 29 minutes.
See the note below regarding IMAP4_stream on Windows.
:type duration: int|float|None

Expand All @@ -673,7 +673,7 @@ def idle(self, duration=None):
Responses produced by the iterator are not added to the internal
cache for retrieval by response().
Comment thread
foresto marked this conversation as resolved.
Outdated

Note: Windows IMAP4_stream connections have no way to accurately
Warning: Windows IMAP4_stream connections have no way to accurately
respect 'duration', since Windows select() only works on sockets.
However, if the server regularly sends status messages during IDLE,
they will wake our selector and keep iteration from blocking for long.
Expand All @@ -682,7 +682,7 @@ def idle(self, duration=None):
minutes needed to avoid server inactivity timeouts would make 27
minutes a sensible value for 'duration' in this situation.

Note: The Idler class name and structure are internal interfaces,
Note: The Idler class name and structure are internal interfaces,
subject to change. Calling code can rely on its context management,
iteration, and public method to remain stable, but should not
subclass, instantiate, or otherwise directly reference the class.
Comment thread
foresto marked this conversation as resolved.
Outdated
Expand Down Expand Up @@ -1402,7 +1402,7 @@ class Idler:
tuple is a single datum, rather than a list of them, because only one
untagged response is produced at a time.
Comment thread
foresto marked this conversation as resolved.
Outdated

Note: The name and structure of this class are internal interfaces,
Note: The name and structure of this class are internal interfaces,
Comment thread
gvanrossum marked this conversation as resolved.
Outdated
subject to change. Calling code can rely on its context management,
iteration, and public method to remain stable, but should not
subclass, instantiate, or otherwise directly reference the class.
Expand Down Expand Up @@ -1553,15 +1553,17 @@ def burst(self, interval=0.1):
batch = list(idler.burst())
print(f'processing {len(batch)} responses...')

Produces no responses and returns immediately if the IDLE
context's maximum duration (the 'duration' argument) has elapsed.
Callers should plan accordingly if using this method in a loop.

Note: Windows IMAP4_stream connections will ignore the interval
argument, yielding endless responses and blocking indefinitely
for each one, because Windows select() only works on sockets.
It is therefore advised not to use this method with an IMAP4_stream
connection on Windows.
The IDLE context's maximum duration, as passed to IMAP4.idle(),
is respected when waiting for the first response in a burst.
Therefore, an expired IDLE context will cause this generator
to return immediately without producing anything. Callers should
consider this if using it in a loop.

Warning: Windows IMAP4_stream connections have no way to accurately
respect the 'interval' argument, since Windows select() only works
on sockets. This will cause the generator to yield endless responses
and block indefinitely for each one. It is therefore advised not to
use burst() with an IMAP4_stream connection on Windows.
"""
try:
yield next(self)
Expand Down

Back | FazBrowse Home | New Git URL