/snap/core24/1587/usr/lib/python3.12/__pycache__
NameSizeModeActions
abc.cpython-312.pyc80550644editdlrm
aifc.cpython-312.pyc428630644editdlrm
antigravity.cpython-312.pyc10030644editdlrm
argparse.cpython-312.pyc1016820644editdlrm
ast.cpython-312.pyc1002790644editdlrm
base64.cpython-312.pyc244080644editdlrm
bdb.cpython-312.pyc373590644editdlrm
bisect.cpython-312.pyc36410644editdlrm
bz2.cpython-312.pyc151330644editdlrm
calendar.cpython-312.pyc396210644editdlrm
cgi.cpython-312.pyc402280644editdlrm
cgitb.cpython-312.pyc173320644editdlrm
chunk.cpython-312.pyc73100644editdlrm
cmd.cpython-312.pyc186190644editdlrm
code.cpython-312.pyc130510644editdlrm
codecs.cpython-312.pyc422740644editdlrm
codeop.cpython-312.pyc69160644editdlrm
colorsys.cpython-312.pyc46420644editdlrm
compileall.cpython-312.pyc204970644editdlrm
configparser.cpython-312.pyc635820644editdlrm
contextlib.cpython-312.pyc303760644editdlrm
contextvars.cpython-312.pyc2610644editdlrm
copy.cpython-312.pyc98000644editdlrm
copyreg.cpython-312.pyc74140644editdlrm
cProfile.cpython-312.pyc85930644editdlrm
crypt.cpython-312.pyc53610644editdlrm
csv.cpython-312.pyc177880644editdlrm
dataclasses.cpython-312.pyc446780644editdlrm
datetime.cpython-312.pyc4090644editdlrm
decimal.cpython-312.pyc4060644editdlrm
difflib.cpython-312.pyc754990644editdlrm
dis.cpython-312.pyc345600644editdlrm
doctest.cpython-312.pyc1056860644editdlrm
enum.cpython-312.pyc807080644editdlrm
filecmp.cpython-312.pyc146610644editdlrm
fileinput.cpython-312.pyc202800644editdlrm
fnmatch.cpython-312.pyc64950644editdlrm
fractions.cpython-312.pyc366670644editdlrm
ftplib.cpython-312.pyc426360644editdlrm
functools.cpython-312.pyc405060644editdlrm
genericpath.cpython-312.pyc68220644editdlrm
getopt.cpython-312.pyc83630644editdlrm
getpass.cpython-312.pyc68500644editdlrm
gettext.cpython-312.pyc221510644editdlrm
glob.cpython-312.pyc98410644editdlrm
graphlib.cpython-312.pyc103270644editdlrm
gzip.cpython-312.pyc320150644editdlrm
hashlib.cpython-312.pyc80870644editdlrm
heapq.cpython-312.pyc179560644editdlrm
hmac.cpython-312.pyc106980644editdlrm
imaplib.cpython-312.pyc628890644editdlrm
imghdr.cpython-312.pyc69440644editdlrm
inspect.cpython-312.pyc1334460644editdlrm
io.cpython-312.pyc41390644editdlrm
ipaddress.cpython-312.pyc907620644editdlrm
keyword.cpython-312.pyc10410644editdlrm
linecache.cpython-312.pyc64010644editdlrm
locale.cpython-312.pyc595360644editdlrm
lzma.cpython-312.pyc158550644editdlrm
mailbox.cpython-312.pyc1116180644editdlrm
mailcap.cpython-312.pyc111550644editdlrm
mimetypes.cpython-312.pyc241850644editdlrm
modulefinder.cpython-312.pyc279440644editdlrm
netrc.cpython-312.pyc89030644editdlrm
nntplib.cpython-312.pyc449390644editdlrm
ntpath.cpython-312.pyc260330644editdlrm
nturl2path.cpython-312.pyc30340644editdlrm
numbers.cpython-312.pyc139670644editdlrm
opcode.cpython-312.pyc147160644editdlrm
operator.cpython-312.pyc173640644editdlrm
optparse.cpython-312.pyc675460644editdlrm
os.cpython-312.pyc434740644editdlrm
pathlib.cpython-312.pyc620980644editdlrm
pdb.cpython-312.pyc849190644editdlrm
pickle.cpython-312.pyc761760644editdlrm
pickletools.cpython-312.pyc811280644editdlrm
pipes.cpython-312.pyc109140644editdlrm
pkgutil.cpython-312.pyc199590644editdlrm
platform.cpython-312.pyc416000644editdlrm
plistlib.cpython-312.pyc412860644editdlrm
poplib.cpython-312.pyc184460644editdlrm
posixpath.cpython-312.pyc182360644editdlrm
pprint.cpython-312.pyc294740644editdlrm
profile.cpython-312.pyc225400644editdlrm
pstats.cpython-312.pyc379220644editdlrm
pty.cpython-312.pyc73630644editdlrm
pyclbr.cpython-312.pyc148870644editdlrm
pydoc.cpython-312.pyc1429550644editdlrm
py_compile.cpython-312.pyc100780644editdlrm
queue.cpython-312.pyc147320644editdlrm
quopri.cpython-312.pyc93230644editdlrm
random.cpython-312.pyc331530644editdlrm
reprlib.cpython-312.pyc99090644editdlrm
rlcompleter.cpython-312.pyc82820644editdlrm
runpy.cpython-312.pyc143850644editdlrm
sched.cpython-312.pyc77350644editdlrm
secrets.cpython-312.pyc25560644editdlrm
selectors.cpython-312.pyc261280644editdlrm
shelve.cpython-312.pyc129130644editdlrm
shlex.cpython-312.pyc141620644editdlrm
shutil.cpython-312.pyc681130644editdlrm
signal.cpython-312.pyc44480644editdlrm
site.cpython-312.pyc290630644editdlrm
sitecustomize.cpython-312.pyc3000644editdlrm
smtplib.cpython-312.pyc482210644editdlrm
sndhdr.cpython-312.pyc107120644editdlrm
socket.cpython-312.pyc418170644editdlrm
socketserver.cpython-312.pyc342580644editdlrm
sre_compile.cpython-312.pyc6250644editdlrm
sre_constants.cpython-312.pyc6280644editdlrm
sre_parse.cpython-312.pyc6210644editdlrm
ssl.cpython-312.pyc630110644editdlrm
stat.cpython-312.pyc52310644editdlrm
statistics.cpython-312.pyc554230644editdlrm
string.cpython-312.pyc114820644editdlrm
stringprep.cpython-312.pyc251600644editdlrm
struct.cpython-312.pyc3250644editdlrm
subprocess.cpython-312.pyc791870644editdlrm
sunau.cpython-312.pyc254230644editdlrm
symtable.cpython-312.pyc187810644editdlrm
sysconfig.cpython-312.pyc300010644editdlrm
tabnanny.cpython-312.pyc121560644editdlrm
tarfile.cpython-312.pyc1233880644editdlrm
telnetlib.cpython-312.pyc284230644editdlrm
tempfile.cpython-312.pyc473390644editdlrm
textwrap.cpython-312.pyc182930644editdlrm
this.cpython-312.pyc14080644editdlrm
threading.cpython-312.pyc653460644editdlrm
timeit.cpython-312.pyc148640644editdlrm
token.cpython-312.pyc35570644editdlrm
tokenize.cpython-312.pyc247750644editdlrm
trace.cpython-312.pyc330240644editdlrm
traceback.cpython-312.pyc515230644editdlrm
tracemalloc.cpython-312.pyc269070644editdlrm
tty.cpython-312.pyc26680644editdlrm
turtle.cpython-312.pyc1846320644editdlrm
types.cpython-312.pyc149390644editdlrm
typing.cpython-312.pyc1418600644editdlrm
uu.cpython-312.pyc78160644editdlrm
uuid.cpython-312.pyc330070644editdlrm
warnings.cpython-312.pyc237920644editdlrm
wave.cpython-312.pyc320840644editdlrm
weakref.cpython-312.pyc313480644editdlrm
webbrowser.cpython-312.pyc263530644editdlrm
xdrlib.cpython-312.pyc118410644editdlrm
zipapp.cpython-312.pyc99770644editdlrm
zipimport.cpython-312.pyc244750644editdlrm
_aix_support.cpython-312.pyc47590644editdlrm
_collections_abc.cpython-312.pyc459120644editdlrm
_compat_pickle.cpython-312.pyc72210644editdlrm
_compression.cpython-312.pyc74970644editdlrm
_distutils_system_mod.cpython-312.pyc78180644editdlrm
_markupbase.cpython-312.pyc122790644editdlrm
_osx_support.cpython-312.pyc177310644editdlrm
_pydatetime.cpython-312.pyc941930644editdlrm
_pydecimal.cpython-312.pyc2278070644editdlrm
_pyio.cpython-312.pyc1102690644editdlrm
_pylong.cpython-312.pyc99830644editdlrm
_py_abc.cpython-312.pyc70540644editdlrm
_sitebuiltins.cpython-312.pyc47600644editdlrm
_strptime.cpython-312.pyc241160644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-312.pyc586510644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-312.pyc586450644editdlrm
_threading_local.cpython-312.pyc82950644editdlrm
_weakrefset.cpython-312.pyc117510644editdlrm
__future__.cpython-312.pyc47040644editdlrm
__hello__.cpython-312.pyc8700644editdlrm
Edit: /snap/core24/1587/usr/lib/python3.12/__pycache__/imaplib.cpython-312.pyc (62889B)
ЦiddZdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z m Z m Z ddlmZ ddlZdZgdZd ZdZd Zd Zd Zd Ziddddddddddddddddddddddddddd dd!dd"dd#did$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dd0dd1dd2dd3dd4dddddddddd5Zej6d6Zej6d7Zej6d8Zej6d9ej>Z ej6d:Z!ej6d;Z"ej6d<Z#ej6d=ej>Z$d9Z%d=Z&Gd>d?Z'erGd@dAe'Z(ejSdAGdBdCe'Z*GdDdEZ+dFjYdGZ-e.e-dHdDcic]\}}|j_|dHzc}}Z0dIZ1dJZ2dKZ3dLZ4e5dMk(rddl6Z6ddl7Z7 e6jlejpdHddN\Z9Z:dZ=e9D]!\Z>ZdPk(r e?e<Ze>dQk(se\ZMZ:eGeMe:ZSeMe:fdkk7reSdujYZTeTs-eGdwddxeTduzdyf@eUdzyy#e$rdZYwxYwcc}}w#e6jv$rZ.*))?s.*FLAGS \((?P[^\)]*)\)s.*INTERNALDATE "(?P[ 0123][0-9])-(?P[A-Z][a-z][a-z])-(?P[0-9][0-9][0-9][0-9]) (?P[0-9][0-9]):(?P[0-9][0-9]):(?P[0-9][0-9]) (?P[-+])(?P[0-9][0-9])(?P[0-9][0-9])"s.*{(?P\d+)}$s \r\n|\r|\ns%\[(?P[A-Z-]+)( (?P.*))?\]s$\* (?P[A-Z-]+)( (?P.*))?s3\* (?P\d+) (?P[A-Z-]+)( (?P.*))?c8eZdZdZGddeZGddeZGddeZded fd Z d Z d Z d Z dZ dZdZdZded fdZdZdZdZdZdZdZdZdZdZdZdZdZdZd Zd!Z d"Z!d#Z"d$Z#d%Z$d&Z%d'Z&d(Z'd)Z(dVd*Z)d+Z*d,Z+d-Z,d.Z-dVd/Z.d0Z/d1Z0d2Z1d3Z2d4Z3d5Z4d6Z5dWd7Z6d8Z7d9Z8d:Z9d;Z:dXd<Z;d=ZZ=d?Z>d@Z?dAZ@dBZAdCZBdDZCdEZDdFZEdGZFdHZGdIZHdJZIdYdKZJdLZKdMZLdNZMdOZNdPZOdQZP dXdRZQdSZRdTZSdUZTy )ZraIMAP4 client class. Instantiate with: IMAP4([host[, port[, timeout=None]]]) host - host's name (default: localhost); port - port number (default: standard IMAP4 port). timeout - socket timeout (default: None) If timeout is not given or is None, the global default socket timeout is used All IMAP4rev1 commands are supported by methods of the same name (in lowercase). All arguments to commands are converted to strings, except for AUTHENTICATE, and the last argument to APPEND which is passed as an IMAP4 literal. If necessary (the string contains any non-printing characters or white-space and isn't enclosed with either parentheses or double quotes) each string is quoted. However, the 'password' argument to the LOGIN command is always quoted. If you want to avoid having an argument string quoted (eg: the 'flags' argument to STORE) then enclose the string in parentheses (eg: "(\Deleted)"). Each command returns a tuple: (type, [data, ...]) where 'type' is usually 'OK' or 'NO', and 'data' is either the text from the tagged response, or untagged results from command. Each 'data' is either a string, or a tuple. If a tuple, then the first part is the header of the response, and the second part contains the data (ie: 'literal' value). Errors raise the exception class .error(""). IMAP4 server errors raise .abort(""), which is a sub-class of 'error'. Mailbox status changes from READ-WRITE to READ-ONLY raise the exception class .readonly(""), which is a sub-class of 'abort'. "error" exceptions imply a program error. "abort" exceptions imply the connection should be reset, and the command re-tried. "readonly" exceptions imply the command should be re-tried. Note: to use this module, you must read the RFCs pertaining to the IMAP4 protocol, as the semantics of the arguments to each IMAP4 command are left to the invoker, not to mention the results. Also, most IMAP servers implement a sub-set of the commands available here. c eZdZy) IMAP4.errorN__name__ __module__ __qualname__/usr/lib/python3.12/imaplib.pyerrorr?rErGc eZdZy) IMAP4.abortNr@rDrErFabortrJrHrErKc eZdZy)IMAP4.readonlyNr@rDrErFreadonlyrMrHrErNNcNt|_d|_d|_i|_i|_d|_d|_d|_d|_ |j|j||| |jy#t$r" |j#t$rYwxYwwxYw)NrrOFr)Debugdebugstateliteraltagged_commandsuntagged_responsescontinuation_response is_readonlytagnum_tls_established _mode_asciiopen_connect ExceptionshutdownOSErrorselfhostporttimeouts rF__init__zIMAP4.__init__s   !"$%'"  %  $g&  MMO        s0(A99 B$BB$ B B$B  B$cd|_d|_tjttj |_tjttj |_y)NFascii) utf8_enabled _encodingrecompile_LiteralASCIILiteral_Untagged_statusUntagged_statusrbs rFr[zIMAP4._mode_asciis?! zz(BHH5 !zz*:BHHErEcd|_d|_tjt|_tjt |_y)NTutf-8)rirjrkrlrmrorprqrrs rF _mode_utf8zIMAP4._mode_utf8s3  zz(+ !zz*:;rEc ttjdd|_t j d|jzdztj |_ d|_d|_ i|_ |jdk\r6|jdtz|jd |jz|j|_d |j vrd |_n1d |j vrd |_n|j%|j|j' |jdk\r|jd|j(t*D]}||j(vr||_y|j%d)Niis(?Ps"\d+) (?P[A-Z]+) (?P.*) rzimaplib version %sznew IMAP4 connection, tag=%sPREAUTHrOKrzCAPABILITIES: zserver not IMAP4 compliant)r randomrandinttagprerkrlrntagre _cmd_log_len _cmd_log_idx_cmd_logrR_mesg __version__ _get_responsewelcomerVrSrG_get_capabilities capabilitiesAllowedVersionsPROTOCOL_VERSION)rbversions rFr]zIMAP4._connectsRV^^D%89 ZZ ++!&@!ABD((L   "D  !D DMzzQ /+=> 9DKKGH))+ // /DJ T,, ,"DJ**T\\* *  zzQ 1B1BDE& Gd///$+D !    jj566rEcb|tvrt||jStd|z)NzUnknown IMAP4 command: '%s')CommandsgetattrlowerAttributeError)rbattrs rF __getattr__zIMAP4.__getattr__ s. 8 4. .:TABBrEc|SNrDrrs rF __enter__zIMAP4.__enter__s rEcd|jdk(ry |jy#t$rYywxYw)Nr)rSlogoutr`)rbargss rF__exit__zIMAP4.__exit__s1 :: !   KKM   s # //c"| |s td|jsdn |j}tjd||j|j||jf}|t j ||St j |S)Nz0Non-blocking socket (timeout=0) is not supportedz imaplib.open) ValueErrorrcsysauditrdsocketcreate_connection)rbrercaddresss rF_create_socketzIMAP4._create_socket#s{  wOP P99t$)) .$ 499=#  ++GW= =''00rEc||_||_|j||_|jj d|_y)zSetup connection to remote server on "host:port" (default: localhost:standard IMAP4 port). This connection will be used by the routines: read, readline, send, shutdown. rbN)rcrdrsockmakefilefileras rFr\z IMAP4.open0s:   ''0 II&&t, rEc8|jj|SzRead 'size' bytes from remote.)rreadrbsizes rFrz IMAP4.read<syy~~d##rEc|jjtdz}t|tkDr|j dtz|S)Read line from remote.rxzgot more than %d bytes)rreadline_MAXLINElenrGrblines rFrzIMAP4.readlineAs@yy!!(Q,/ t9x **5@A A rEchtjd|||jj|y)Send data to remote.z imaplib.sendN)rrrsendallrbdatas rFsendz IMAP4.sendIs$ .$- $rEc|jj |jjtj |jjy#t $r8}|jtjk7rt|dddk7rYd}~Wd}~wwxYw#|jjwxYw) Close I/O established in "open".winerrorri&'N) rcloserr_r SHUT_RDWRr`errnoENOTCONNr)rbexcs rFr_zIMAP4.shutdownOs   II  v// 0 IIOO   U^^+3 A.%7   IIOO s))A B!).BB$B!!B$$Cc|jS)zfReturn socket instance used to connect to IMAP4 server. socket = .socket() )rrrs rFrz IMAP4.socket_s yyrEcd}|jddg|\}}|dr||fS|j\}}|j|||S)aReturn most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command. (typ, [data]) = .recent() 'data' is None if no new messages, else list of RECENT responses, most recent last. RECENTrzN)_untagged_responsenooprbnametypdats rFrecentz IMAP4.recentksW**4$>S r78O99;S&&sC66rEcF|j|dg|jS)zReturn data for response 'code' if received, or None. Old value for response 'code' is cleared. (code, [data]) = .response(code) N)rupper)rbcodes rFresponsezIMAP4.response|s!&&tdVTZZ\BBrEcd}|sd}|r|d|dfdk7rd|z}nd}|r t|}nd}tjt|}|jrd|zd z}||_|j ||||S) zAppend message to named mailbox. (typ, [data]) = .append(mailbox, flags, date_time, message) All args except `message' can be None. rINBOXrr()(%s)NsUTF8 ())r MapCRLFsubCRLFrirT_simple_command)rbmailboxflags date_timemessagerrTs rFappendz IMAP4.appendsG ar#y0E ))4II++dG,   ')D0G ##D'5)DDrEc|j}t|j|_|j d|\}}|dk7r$|j |dj ddd|_||fS)asAuthenticate command - requires response processing. 'mechanism' specifies which authentication mechanism is to be used - it must appear in .capabilities in the form AUTH=. 'authobject' must be a callable object: data = authobject(response) It will be called to process server continuation responses; the response argument it is passed will be a bytes. It should return bytes data that will be base64 encoded and sent to the server. It should return None if the client abort response '*' should be sent instead. rrzrrtreplacer)r_AuthenticatorprocessrTrrGdecoderS)rb mechanism authobjectmechrrs rF authenticatezIMAP4.authenticateso   &j199 ''=S $;**SW^^GY?@ @ CxrEcTd}|j|\}}|j|||S)zT(typ, [data]) = .capability() Fetch capabilities list from server.rrrrs rF capabilityzIMAP4.capabilitys2''-S&&sC66rEc$|jdS)zRCheckpoint mailbox on server. (typ, [data]) = .check() rrrrs rFcheckz IMAP4.checks ##G,,rEcZ |jd\}}d|_||fS#d|_wxYw)zClose currently selected mailbox. Deleted messages are removed from writable mailbox. This is the recommended command before 'LOGOUT'. (typ, [data]) = .close() rrrrSrbrrs rFrz IMAP4.closes6 ++G4HCDJCx DJ! *c(|jd||S)zCopy 'message_set' messages onto end of 'new_mailbox'. (typ, [data]) = .copy(message_set, new_mailbox) rr)rb message_set new_mailboxs rFcopyz IMAP4.copys ##FKEErEc&|jd|S)zPCreate new mailbox. (typ, [data]) = .create(mailbox) rrrbrs rFcreatez IMAP4.create ##Hg66rEc&|jd|S)zPDelete old mailbox. (typ, [data]) = .delete(mailbox) rrrs rFdeletez IMAP4.deleterrEc(|jd||S)zDelete the ACLs (remove any rights) set for who on mailbox. (typ, [data]) = .deleteacl(mailbox, who) rr)rbrwhos rF deleteaclzIMAP4.deleteacls ##K#>>rEcd|jvrtjd|jd|\}}|dk(r"d|j vr|j ||fS)zlSend an RFC5161 enable string to the server. (typ, [data]) = .enable(capability) rzServer does not support ENABLErzz UTF8=ACCEPT)rrrGrrru)rbrrrs rFenablez IMAP4.enablesc 4,, ,++>? ?((:> T $;=J,<,<,>> OO DyrEcTd}|j|\}}|j|||S)zPermanently remove deleted items from selected mailbox. Generates 'EXPUNGE' response for each deleted message. (typ, [data]) = .expunge() 'data' is list of 'EXPUNGE'd message numbers in order received. rrrs rFexpungez IMAP4.expunge s2''-S&&sC66rEcXd}|j|||\}}|j|||S)a#Fetch (parts of) messages. (typ, [data, ...]) = .fetch(message_set, message_parts) 'message_parts' should be a string of selected parts enclosed in parentheses, eg: "(UID BODY[TEXT])". 'data' are tuples of message part envelope and data. r r)rbr message_partsrrrs rFfetchz IMAP4.fetchs6''k=IS&&sC66rEcR|jd|\}}|j||dS)zXGet the ACLs for a mailbox. (typ, [data]) = .getacl(mailbox) r!ACLrrbrrrs rFgetaclz IMAP4.getacl(s/ ''':S&&sC77rEcV|jd|||\}}|j||dS)za(typ, [data]) = .getannotation(mailbox, entry, attribute) Retrieve ANNOTATIONs.r" ANNOTATIONr)rbrentry attributerrs rF getannotationzIMAP4.getannotation1s3''%SS&&sC>>rEcR|jd|\}}|j||dS)zGet the quota root's resource usage and limits. Part of the IMAP4 QUOTA extension defined in rfc2087. (typ, [data]) = .getquota(root) r#QUOTAr)rbrootrrs rFgetquotazIMAP4.getquota9s/'' D9S&&sC99rEc|jd|\}}|j||d\}}|j||d\}}|||gfS)zGet the list of quota roots for the named mailbox. (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = .getquotaroot(mailbox) r$r QUOTAROOTr)rbrrrquota quotaroots rF getquotarootzIMAP4.getquotarootDsZ ''@S,,S#w? U00c;GYY&&&rEcXd}|j|||\}}|j|||S)zList mailbox names in directory matching pattern. (typ, [data]) = .list(directory='""', pattern='*') 'data' is list of LIST responses. r&rrb directorypatternrrrs rFlistz IMAP4.listO6''iAS&&sC66rEc|jd||j|\}}|dk7r|j|dd|_||fS)zIdentify client using plaintext password. (typ, [data]) = .login(user, password) NB: 'password' will be quoted. r'rzrr)r_quoterGrS)rbuserpasswordrrs rFloginz IMAP4.login[sO''t{{87LMS $;**SW% % CxrEcX||c|_|_|jd|jS)zr Force use of CRAM-MD5 authentication. (typ, [data]) = .login_cram_md5(user, password) zCRAM-MD5)r!r"r_CRAM_MD5_AUTH)rbr!r"s rFlogin_cram_md5zIMAP4.login_cram_md5is- $(  4=  T-@-@AArEcddl}t|jtr|jj dn |j}|j dz|j ||djzS)z1 Authobject to use with CRAM-MD5 authentication. rNrt md5)hmac isinstancer"strencoder!HMAC hexdigest)rb challenger*pwds rFr%zIMAP4._CRAM_MD5_AUTHrsY0:4==#0Nt}}##G,26-- yy33 5!A!K!K!MMMrEc`d|_|jd\}}|j||fS)z|Shutdown connection to server. (typ, [data]) = .logout() Returns server 'BYE' response. r)rSrr_rs rFrz IMAP4.logoutzs1 ''1S CxrEcXd}|j|||\}}|j|||S)zList 'subscribed' mailbox names in directory matching pattern. (typ, [data, ...]) = .lsub(directory='""', pattern='*') 'data' are tuples of message part envelope and data. r(rrs rFlsubz IMAP4.lsubrrEcR|jd|\}}|j||dS)zShow my ACLs for a mailbox (i.e. the rights that I have on mailbox). (typ, [data]) = .myrights(mailbox) r%rr s rFmyrightszIMAP4.myrightss/ &&z7;C&&sC<.namespace() r*rrs rF namespacezIMAP4.namespaces2 ''-S&&sC66rEcz |jdk\r|j|j|jdS)zFSend NOOP command. (typ, [data]) = .noop() r{r+)rR_dump_urrVrrrs rFrz IMAP4.noops5 zzQ d556##F++rEc\d}|j|||||\}}|j||dS)zFetch truncated part of a message. (typ, [data, ...]) = .partial(message_num, message_part, start, length) 'data' is tuple of message part envelope and data. r,r r)rb message_num message_partstartlengthrrrs rFpartialz IMAP4.partials;''k<PVWS&&sC99rEc*d}|jd|S)zAssume authentication as "user". Allows an authorised administrator to proxy into any user's mailbox. (typ, [data]) = .proxyauth(user) r-r)rbr!rs rF proxyauthzIMAP4.proxyauths##K66rEc(|jd||S)zkRename old mailbox name to new. (typ, [data]) = .rename(oldmailbox, newmailbox) r.r)rb oldmailbox newmailboxs rFrenamez IMAP4.renames ##Hj*EErEcd}|r:|jrtjd|j|d|g|\}}n|j|g|\}}|j |||S)zSearch mailbox for matching messages. (typ, [data]) = .search(charset, criterion, ...) 'data' is space separated list of matching message numbers. If UTF8 is enabled, charset MUST be None. r/z'Non-None charset not valid in UTF8 modeCHARSET)rirrGrr)rbcharsetcriteriarrrs rFsearchz IMAP4.searchst   kk"KLL+t++D)WPxPHC+t++D<8.select(mailbox='INBOX', readonly=False) 'data' is count of messages in mailbox ('EXISTS' response). Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so other responses should be obtained via .response('FLAGS') etc. rr0rzrr READ-ONLYrxz%s is not writableEXISTSN)rVrXrrSrRr:rNget)rbrrNrrrs rFselectz IMAP4.selects#%# DD''g6S $;DJ8O $11 1 ::?MM$"9"9:-- 4w >? ?D++//4&AAArEc*|jd|||S)zZSet a mailbox acl. (typ, [data]) = .setacl(mailbox, who, what) r1r)rbrrwhats rFsetaclz IMAP4.setacls ##HgsDAArEcT|jdg|\}}|j||dS)z_(typ, [data]) = .setannotation(mailbox[, entry, attribute]+) Set ANNOTATIONs.r2r r)rbrrrs rF setannotationzIMAP4.setannotation s4(4''?$?S&&sC>>rEcT|jd||\}}|j||dS)ziSet the quota root's resource limits. (typ, [data]) = .setquota(root, limits) r3rr)rbrlimitsrrs rFsetquotazIMAP4.setquotas1 '' D&AS&&sC99rEcd}|d|dfdk7rd|z}|j|||g|\}}|j|||S)zIMAP4rev1 extension SORT command. (typ, [data]) = .sort(sort_criteria, charset, search_criteria, ...) r4rrrrr)rb sort_criteriarIsearch_criteriarrrs rFsortz IMAP4.sorts`  ! ]2. /9 <"]2M'4''mWWWS&&sC66rEcd}ts|jd|jr|jd||jvr|jd|t j }|j|\}}|dk(rd|j|j|j|_ |jjd|_ d|_|jn|jd |j|||S) Nr5zSSL support missingzTLS session already establishedzTLS not supported by serverrzserver_hostnamerTzCouldn't establish TLS session)HAVE_SSLrGrZrKrssl_create_stdlib_contextr wrap_socketrrcrrrr)rb ssl_contextrrrs rFstarttlszIMAP4.starttls)s**23 3  **>? ? t(( (**:; ;  446K''-S $;#// @D 0KDI **40DI$(D !  " " $**=> >&&sC66rEcXd}|j|||\}}|j|||S)zpRequest named status conditions for mailbox. (typ, [data]) = .status(mailbox, names) r6r)rbrnamesrrrs rFstatusz IMAP4.status@s8 ''gu=S&&sC66rEcz|d|dfdk7rd|z}|jd|||\}}|j||dS)zAlters flag dispositions for messages in mailbox. (typ, [data]) = .store(message_set, command, flags) rrrrr7r r)rbrcommandrrrs rFstorez IMAP4.storeLsQ !HU2Y 9 ,UNE''guMS&&sC99rEc&|jd|S)zYSubscribe to new mailbox. (typ, [data]) = .subscribe(mailbox) r8rrs rF subscribezIMAP4.subscribeWs ##K99rEc\d}|j|||g|\}}|j|||S)zIMAPrev1 extension THREAD command. (type, [data]) = .thread(threading_algorithm, charset, search_criteria, ...) r9r)rbthreading_algorithmrIr[rrrs rFthreadz IMAP4.thread_s> '4''.A7]_]S&&sC66rEc b|j}|tvr|jd|z|jt|vr:|jd|d|jddj t|d}|j ||g|\}}|dvr|}nd}|j |||S) zExecute "command arg ..." with messages identified by UID, rather than message number. (typ, [data]) = .uid(command, arg1, arg2, ...) Returns response appropriate to 'command'. zUnknown IMAP4 UID command: %scommand  illegal in state , only allowed in states , r:)r/r4r9r )rrrGrSjoinrr)rbrjrrrrs rFuidz IMAP4.uidis--/("**.unsubscribe(mailbox) r;rrs rF unsubscribezIMAP4.unsubscribes ##M7;;rEcZ |jd\}}d|_||fS#d|_wxYw)aMFree server's resources associated with the selected mailbox and returns the server to the authenticated state. This command performs the same actions as CLOSE, except that no messages are permanently removed from the currently selected mailbox. (typ, [data]) = .unselect() r<rr)rbrrs rFunselectzIMAP4.unselects7 ,,Z8ICDJDy DJrc|j}|tvr|jft|<|j|g|S)aAllow simple extension commands notified by server in CAPABILITY response. Assumes command is legal in current state. (typ, [data]) = .xatom(name, arg, ...) Returns response appropriate to extension command `name'. )rrrSrrbrrs rFxatomz IMAP4.xatoms@zz|x"jj]HTN#t##D0400rEc |d}|j} |jdk\r4|jd|dt|j |dd|d||vr||j |y|g||<y)NrEuntagged_responses[z] rOz += ["z"])rVrRrrrOr)rbrrurs rF_append_untaggedzIMAP4._append_untaggedsn ;C  $ $ zzQ c"&&R.1389 "9 sGNN3 eBsGrEc|jjd}|r.|j|dj|jdy)NBYErr)rVrOrKrrj)rbbyes rF _check_byezIMAP4._check_byesB%%))%0 **SW^^DNNIFG G rEc V|jt|vrAd|_|jd|d|jddj t|dD]}||j vs|j |= d|j vr|j s|jd|j}t||j}|dz|z}|D]3}|t|trt||j}|dz|z}5|j}|Qd|_t|t|jur|}n'd}|td t|z|jz} |j d k\r|j#d |zn|j%d |z |j'|t(z||S |j/r"|j0|r|S|j/r"r||j2} |j d k\r|j#d t|z |j'||j't(|s |S#t*$r} |j-d | zd} ~ wwxYw#t*$r} |j-d | zd} ~ wwxYw)NrrrsrtrurzNOBADrMz#mailbox status changed to READ-ONLY z {%s}z> %rzsocket error: %szwrite literal size %s)rSrrTrGrvrVrXrN_new_tagbytesrjr+r,type_commandrrRr_logrrr`rKrrUrW) rbrrrtagrargrT literatorvals rFrzIMAP4._commands ::Xd^ +DL**"DJJ"ii79: : ' 1Cd---++C0 1 $11 1  -- EF FmmoT4>>*TzD  %C{H#s#C0$;$D  % ,,  DLG}T]] 33#  eGc'l$:DNNKK zzQ 6D=) &4-( 7 IIdTk " ?J$$&'',J$$& #D$>$>?::?JJ6WEF ; '" $ 3  7**/#56 6 72 ;jj!3c!9:: ;s0$I!5&J! J*I>>J J(J##J(ct|dk(}|s|j |j||\}}|s|j|dk(r|j|d|d|||fS#|j$r}|jd|d|d}~w|j$r}|jd|d|d}~wwxYw)Nr) expect_byez command:  => rz command error: r()r_get_tagged_responserKrG)rbrrrrrrs rF_command_completezIMAP4._command_completes(" OO  @11#&1IIC  OO  %<**$TJK KDyzz @**D#>? ?zz @**D#>? ? @s#A##B72B  B7B22B7c|j\}}|dgk(r|jdt|d|j}|j }t |j |_y)Nz"no CAPABILITY response from serverr)rrGr,rjrtuplesplitrrs rFrzIMAP4._get_capabilities#s]??$S 4&=**AB B#b'4>>*iik!#))+.rEch|j}|j|j|r|jj d}||j vr|j d|z|jj d}t||j}|jj d}||gf|j |<nd}|jt|s7|j|j|r|jj d}|jK|jt|r!|jj d|_ y|j d|z|jj d}t||j}|jj d}|d}|r|dz|z}|j|j|rt|jj d } |jd k\r|j!d |z|j#|}|j%|||f|j}|j|j|r|j%|||d vrr|jt&|r\|jj d}t||j}|j%||jj d |jd k\r|dvr|j!|d||S)Nrzunexpected tagged response: %rrrdata2zunexpected response: %rrErrrzread literal size %srrx)rrrz response: ) _get_line_matchrmogrouprUrKr,rjUntagged_responserq ContinuationrWrointrRrrr Response_code)rbresprrrdat2rrs rFrzIMAP4._get_response,s~~ ;;tzz4 (''--&C$...jj!AD!HII''--'Cc4>>*C''--'C),se D  %D;;0$7;;t33T:77==1Dww;;|T215v1FD.jj!:T!ABB''--'Cc4>>*C''--'C{#C3:,S++dllC0477==01zzQ #9D#@Ayy%%cC;7nn&!++dllC0$  ! !#s + % %$++mS*I''--'Cc4>>*C  ! !#tww}}V'< = zzQ3*>#> S9: rEcD |j|}||j|=|S|r$d}|jj|d}|||fS|j |j h#|j $r&} |j dk\r|jd}~wwxYw)Nrxr)rUrVpoprrrKrR print_log)rbrrresultrrrs rFrzIMAP4._get_tagged_response|s))#.F!((- --11#t<?:% OO  ""$/0:: zzQ(  sA**B9!BBc|j}|s|jd|jds|jd|z|dd} |jdk\r|j d|z|S|j d|z|S)Nzsocket error: EOFr z#socket error: unterminated line: %rrz< %r)rrKendswithrRrrrs rFrzIMAP4._get_lines}}**01 1}}W%**BTIJ JCRy zzQ 6D=)  &4-( rEc|j||_ |jH|jdk\r9|jd|jd|jj |jduS)Nrz matched r)matchrrRrrgroups)rbcress rFrz IMAP4._matchsY ))A, ww"tzzQ 3;;@PQRwwd""rEc|jtt|j|jz}|jdz|_d|j |<|S)Nrx)r~rr,rYrjrU)rbrs rFrzIMAP4._new_tagsHkkE#dkk"2DNNCCkkAo $(S! rEcZ|jdd}|jdd}d|zdzS)N\z\\"z\")r)rbrs rFr z IMAP4._quotes0kk$'kk#u%Sy3rEcH|j||j|g|Sr)rrr}s rFrzIMAP4._simple_commands%%%dMDMM$,F,FGGrEc|dk(r||fS||jvr|dgfS|jj|} |jdk\r|jd|d|||fS)Nrrrz] => )rVrrRr)rbrrrrs rFrzIMAP4._untagged_responsesk $;8Ot...; &&**40 zzQ T4HIDyrEc|tj}tjdtj|}tjj d||dzdz|fztjj y)Nz%M:%Sz %s.%02d %s d)timestrftime localtimerstderrwriteflush)rbrsecstms rFrz IMAP4._mesgsb|yy{wt(<=B JJ  -d3h^Q0GG H JJ   rEc~|syd|jD}|jddj|zy)Nc30K|]\}}|d|yw): NrD).0keyvalues rF z!IMAP4._dump_ur..s)B"UuBui(Bszuntagged responses dump:z )itemsrrv)rbuntagged_resp_dictrs rFr:zIMAP4._dump_urs=%B&8&>&>&@BE JJ1HMM%4HH IrEc|tjf|j|j<|xjdz c_|j|jk\rd|_yy)Nrxr)rrrrrs rFrz IMAP4._logsS04diik/BDMM$++ ,    "   D$5$55$%!6rEc |jdt|jz|j|j}}|r< |j|j||dz }||jk\rd}|dz}|r;yy#Y$xYw)Nzlast %d IMAP4 interactions:rxr)rrrrr)rbins rFrzIMAP4.print_logs JJ4s4==7II J$$d&7&7qADJJ a 01Q)))AQs A??B)z""*)rFr)F)UrArBrC__doc__r^rGrKrN IMAP4_PORTrfr[rur]rrrrr\rrrr_rrrrrrrrrrrrrrrr rrrrr#r&r%rr4r6r8rr@rBrFrKrPrSrUrXr\rerhrkrmrprwryr{r~rrrrrrrrrrr rrrr:rrrDrErFrrs-^!  5Z2F<'7TC  1T -$   7"CE4:7- F77?  7 78?:' 7 BN  7=7, : 7F7$B@B?: 77. 7::772<  1, H JZ$/M`B& #H   J & rErc8eZdZdZdefddddZdZdedfdZy) IMAP4_SSLaIMAP4 client class over SSL connection Instantiate with: IMAP4_SSL([host[, port[, ssl_context[, timeout=None]]]]) host - host's name (default: localhost); port - port number (default: standard IMAP4 SSL port); ssl_context - a SSLContext object that contains your certificate chain and private key (default: None) timeout - socket timeout (default: None) If timeout is not given or is None, the global default socket timeout is used for more documentation see the docstring of the parent class IMAP4. rON)rdrecn|tj}||_tj ||||yr)rarbrdrrf)rbrcrdrdres rFrfzIMAP4_SSL.__init__s0"!88: *D  NN4tW 5rEc|tj||}|jj||jS)Nr^)rrrdrcrc)rbrers rFrzIMAP4_SSL._create_sockets=''g6D##//@D 0K KrEc4tj||||y)zSetup connection to remote server on "host:port". (default: localhost:standard IMAP4 SSL port). This connection will be used by the routines: read, readline, send, shutdown. N)rr\ras rFr\zIMAP4_SSL.open!s JJtT4 1rE)rArBrCrIMAP4_SSL_PORTrfrr\rDrErFrrs1 !# 6$($ 6 K ^T 2rErc6eZdZdZdZd dZdZdZdZdZ y) rzIMAP4 client class over a stream Instantiate with: IMAP4_stream(command) "command" - a string that can be passed to subprocess.Popen() for more documentation see the docstring of the parent class IMAP4. c<||_tj|yr)rjrrf)rbrjs rFrfzIMAP4_stream.__init__8s  trENc<d|_d|_d|_d|_t j |j ttjtjdd|_ |jj|_ |jj|_ y)zSetup a stream connection. This connection will be used by the routines: read, readline, send, shutdown. NT)bufsizestdinstdoutshell close_fds)rcrdrr subprocessPopenrjrPIPErr writefilerreadfileras rFr\zIMAP4_stream.open=sq     !'' '//*//$( ++ ++ rEc8|jj|Sr)rrrs rFrzIMAP4_stream.readMs}}!!$''rEc6|jjS)r)rrrrs rFrzIMAP4_stream.readlineRs}}%%''rEcn|jj||jjy)rN)rrrrs rFrzIMAP4_stream.sendWs$ T" rEc|jj|jj|jj y)rN)rrrrwaitrrs rFr_zIMAP4_stream.shutdown]s2   rE)NNN) rArBrCrrfr\rrrr_rDrErFrr,s% , ( (  rErc(eZdZdZdZdZdZdZy)rzcPrivate class to provide en/decoding for base64-based authentication conversation. c||_yr)r)rbmechinsts rFrfz_Authenticator.__init__ks  rEcj|j|j|}|y|j|S)N*)rrr-)rbrrets rFrz_Authenticator.processns0ii D)* ;{{3rEcd}t|tr|jd}|r?t|dkDr |dd}|dd}n|}d}t j |}|r||ddz}|r?|S)NrErt0r)r+r,r-rbinascii b2a_base64)rbinpouptes rFr-z_Authenticator.encodets} c3 **W%C3x"}H"#h##A&AAcrFl rEc2|sytj|S)NrE)r a2b_base64)rbrs rFrz_Authenticator.decodes""3''rEN)rArBrCrrfrr-rrDrErFrres 0(rErz0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr(rxc tj|}|syt|jd}|jd}t |jd}t |jd}t |jd}t |jd}t |jd}t |jd } t |jd } | d z| zd z} |d k(r| } ||||||d d d f } t j | | z } tj| S)zParse an IMAP4 INTERNALDATE string. Return corresponding local time. The return value is a time.struct_time tuple or None if the string has wrong format. Nmonzonendayyearhourminseczonehzonem<-r) InternalDaterMon2numrrcalendartimegmrr)rrrrrrrrrrrzonettutcs rFr r s   D !B  "((5/ "C HHW E bhhuo C rxx D rxx D bhhuo C bhhuo C ! "E ! "E "Hu b D }u S$S"b" 5B //"  $C >># rEctd}d}tt|}|rt|d\}}|||dz|z}|r|S)z-Convert integer to A-P string representation.rEsABCDEFGHIJKLMNOPrx)rabsdivmod)numrAPmods rFr r sM C'r c#h-C #r?SSUmc!  JrEctj|}|syt|jdj S)z-Convert IMAP4 flags response to python tuple.rDr)Flagsrrrr)rrs rFr r s5 T B  '"((* ++rEc:t|ttfr3tj|t j j}nt|tr1 |j}t!|}t|dddt |i}nTt|tr|j" t%d|}n*t|t&r|d|dfd k(r|St%d d j)t*|j,}|j/|S#t$rtjrZ|d}|dk(r+tjtj|d}tj tjf| }ntj }Y2wxYw) aConvert date_time to IMAP4 INTERNALDATE representation. Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'. The date_time argument can be a number (int or float) representing seconds since epoch (as returned by time.time()), a 9-tuple representing local time, an instance of time.struct_time (as returned by time.localtime()), an aware datetime instance or a double-quoted string. In the last case, it is assumed to already be in the correct format. r)secondsNtzinfozdate_time must be awarer)rrzdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z")r+rfloatr fromtimestamprr astimezoner tm_gmtoffrrdaylightrmktimealtzonerrrr,formatMonthsmonthr)rdtgmtoffdstdeltafmts rFr r s])c5\*  # #I$,LL22<*, Iu % (((F&) y!} =Xe_ = Ix (    #67 7  Is #1im(D (Q899 " ) )&*: ;C ;;s ' (}}l"9..Y)?@CC==$,,7<<-- (s DBFF__main__zd:s:)rDrDz-dz-s)rOzIMAP password for z on localhostrzJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s )r!lfr#)r) /tmp/xxx 1)rF)r3z/tmp/yyy)r /tmp/yyz 2rr5)r)z/tmpzyy*)rPr4)rK)NSUBJECTtest)r)1z(FLAGS INTERNALDATE RFC822))rk)r8FLAGSz (\Deleted))r8rD)rrD)rrD)rrD)rPrD)r) UIDVALIDITY)rw)r/ALL)r)rN)rrDctj|d|tt||\}}tj|d|d||dk(r|d|S)Nr(rrr)Mrr)cmdrrrs rFrunr?0sP 3%&"71c?D)S c3/0 $;c!f  rErzPROTOCOL_VERSION = %szCAPABILITIES = r)z/tmp/zyy%z .*"([^"]+)"$rrrwz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z All tests OK.z Tests failed.z8 If you would like to see debugging output, try: %s -d5 )Vrrrrr|rkrrrrr rrriorrar` ImportError__all__rrQrrrrrrlrrr rnrorrrrqrmrprrrrrrr( enumerater-r r r r r rAgetoptgetpassargvoptlistrrGrstream_commandoptrrcgetuserUSERPASSWD test_mesg test_seq1 test_seq2r?r=rSrrrr>mlrrrpathrrwprint)rrs00rFrSsv , KKKKK22"H 8    (  , ,,   ,  A ,  ,  ,   ,  ,,  ,,  ,,   ,  ,,   ,   ,  ,, ,!, " ,#, $ ,%, & ,', ( ,), *  +, , A-, . ,/, 0  1, 2 ,3, 4 A5, 6  7, 8  9, : ,;, <  =, > ,?, @ ,A, B ,C, D ,E, F  G, H%,%,%%,%W, `rzz01  45rzz "**+RXX 6 "**^ $ DE BJJGH"**;RXXG "Jxxv# #2E#2J NN;555r*(*(X < A A# F&/qr &; <F ,%R z % chhqrlF; N2C $;HE D[ N 1 2  7D 7?? D W__tTEX[EXY ZF\gkrv_wwI tVn* dD)45)3,I$! dD),-I) ^,Ad A 77f !!" I '!*<*<<= q~~78! HC TN f./ #B/2.B"((1+4B$ 4' "  # " SHCc4.CDz77b'--/C BPR S S  {q.Hd+ =` << j     hhqk  s<O O"#O(?DP OO(P7PP %P/