@@ -649,7 +649,7 @@ def getquotaroot(self, mailbox):
649649
650650
651651 def idle (self , dur = None ):
652- """Return an iterable context manager implementing the IDLE command
652+ """Return an Idler: an iterable context manager for the IDLE command
653653
654654 :param dur: Maximum duration (in seconds) to keep idling,
655655 or None for no time limit.
@@ -681,8 +681,13 @@ def idle(self, dur=None):
681681 Assuming that's typical of IMAP servers, subtracting it from the 29
682682 minutes needed to avoid server inactivity timeouts would make 27
683683 minutes a sensible value for 'dur' in this situation.
684+
685+ Note: The Idler class name and structure are internal interfaces,
686+ subject to change. Calling code can rely on its context management,
687+ iteration, and public method to remain stable, but should not
688+ subclass, instantiate, or otherwise directly reference the class.
684689 """
685- return _Idler (self , dur )
690+ return Idler (self , dur )
686691
687692
688693 def list (self , directory = '""' , pattern = '*' ):
@@ -1384,13 +1389,24 @@ def print_log(self):
13841389 n -= 1
13851390
13861391
1387- class _Idler :
1388- # Iterable context manager: start IDLE & produce untagged responses
1389- #
1390- # This iterator produces (type, datum) tuples. They slightly differ
1391- # from the tuples returned by IMAP4.response(): The second item in the
1392- # tuple is a single datum, rather than a list of them, because only one
1393- # untagged response is produced at a time.
1392+ class Idler :
1393+ """Iterable context manager: start IDLE & produce untagged responses
1394+
1395+ An object of this type is returned by the IMAP4.idle() method.
1396+ It sends the IDLE command when activated by the 'with' statement, produces
1397+ IMAP untagged responses via the iterator protocol, and sends DONE upon
1398+ context exit.
1399+
1400+ Iteration produces (type, datum) tuples. They slightly differ
1401+ from the tuples returned by IMAP4.response(): The second item in the
1402+ tuple is a single datum, rather than a list of them, because only one
1403+ untagged response is produced at a time.
1404+
1405+ Note: The name and structure of this class are internal interfaces,
1406+ subject to change. Calling code can rely on its context management,
1407+ iteration, and public method to remain stable, but should not
1408+ subclass, instantiate, or otherwise directly reference the class.
1409+ """
13941410
13951411 def __init__ (self , imap , dur = None ):
13961412 if 'IDLE' not in imap .capabilities :
0 commit comments