11import subprocess
22import sys
33import time
4- from _typeshed import ReadableBuffer , SizedBuffer
4+ from _typeshed import ReadableBuffer , SizedBuffer , Unused
55from builtins import list as _list # conflicts with a method named "list"
6- from collections .abc import Callable
6+ from collections .abc import Callable , Generator
77from datetime import datetime
88from re import Pattern
99from socket import socket as _socket
1010from ssl import SSLContext , SSLSocket
1111from types import TracebackType
1212from typing import IO , Any , Literal , SupportsAbs , SupportsInt
13- from typing_extensions import Self , TypeAlias
13+ from typing_extensions import Self , TypeAlias , deprecated
1414
1515__all__ = ["IMAP4" , "IMAP4_stream" , "Internaldate2tuple" , "Int2AP" , "ParseFlags" , "Time2Internaldate" , "IMAP4_SSL" ]
1616
@@ -42,11 +42,17 @@ class IMAP4:
4242 PROTOCOL_VERSION : str
4343 def __init__ (self , host : str = "" , port : int = 143 , timeout : float | None = None ) -> None : ...
4444 def open (self , host : str = "" , port : int = 143 , timeout : float | None = None ) -> None : ...
45+ if sys .version_info >= (3 , 14 ):
46+ @property
47+ @deprecated ("IMAP4.file is unsupported, can cause errors, and may be removed." )
48+ def file (self ) -> IO [str ] | IO [bytes ]: ...
49+ else :
50+ file : IO [str ] | IO [bytes ]
51+
4552 def __getattr__ (self , attr : str ) -> Any : ...
4653 host : str
4754 port : int
4855 sock : _socket
49- file : IO [str ] | IO [bytes ]
5056 def read (self , size : int ) -> bytes : ...
5157 def readline (self ) -> bytes : ...
5258 def send (self , data : ReadableBuffer ) -> None : ...
@@ -72,6 +78,9 @@ class IMAP4:
7278 def getannotation (self , mailbox : str , entry : str , attribute : str ) -> _CommandResults : ...
7379 def getquota (self , root : str ) -> _CommandResults : ...
7480 def getquotaroot (self , mailbox : str ) -> _CommandResults : ...
81+ if sys .version_info >= (3 , 14 ):
82+ def idle (self , duration : float | None = None ) -> Idler : ...
83+
7584 def list (self , directory : str = '""' , pattern : str = "*" ) -> tuple [str , _AnyResponseData ]: ...
7685 def login (self , user : str , password : str ) -> tuple [Literal ["OK" ], _list [bytes ]]: ...
7786 def login_cram_md5 (self , user : str , password : str ) -> _CommandResults : ...
@@ -100,6 +109,15 @@ class IMAP4:
100109 def xatom (self , name : str , * args : str ) -> _CommandResults : ...
101110 def print_log (self ) -> None : ...
102111
112+ if sys .version_info >= (3 , 14 ):
113+ class Idler :
114+ def __init__ (self , imap : IMAP4 , duration : float | None = None ) -> None : ...
115+ def __enter__ (self ) -> Self : ...
116+ def __exit__ (self , exc_type : object , exc_val : Unused , exc_tb : Unused ) -> Literal [False ]: ...
117+ def __iter__ (self ) -> Self : ...
118+ def __next__ (self ) -> tuple [str , float | None ]: ...
119+ def burst (self , interval : float = 0.1 ) -> Generator [tuple [str , float | None ]]: ...
120+
103121class IMAP4_SSL (IMAP4 ):
104122 if sys .version_info < (3 , 12 ):
105123 keyfile : str
@@ -119,14 +137,25 @@ class IMAP4_SSL(IMAP4):
119137 timeout : float | None = None ,
120138 ) -> None : ...
121139 sslobj : SSLSocket
122- file : IO [Any ]
140+ if sys .version_info >= (3 , 14 ):
141+ @property
142+ @deprecated ("IMAP4_SSL.file is unsupported, can cause errors, and may be removed." )
143+ def file (self ) -> IO [Any ]: ...
144+ else :
145+ file : IO [Any ]
146+
123147 def open (self , host : str = "" , port : int | None = 993 , timeout : float | None = None ) -> None : ...
124148 def ssl (self ) -> SSLSocket : ...
125149
126150class IMAP4_stream (IMAP4 ):
127151 command : str
128152 def __init__ (self , command : str ) -> None : ...
129- file : IO [Any ]
153+ if sys .version_info >= (3 , 14 ):
154+ @property
155+ @deprecated ("IMAP4_stream.file is unsupported, can cause errors, and may be removed." )
156+ def file (self ) -> IO [Any ]: ...
157+ else :
158+ file : IO [Any ]
130159 process : subprocess .Popen [bytes ]
131160 writefile : IO [Any ]
132161 readfile : IO [Any ]
0 commit comments