%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/__pycache__/mailbox.cpython-38.pyc

U

n©ßaE3ã@sRdZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddlZzddl
Z
Wnek
rˆdZ
YnXddddddd	d
ddd
ddddddgZej d¡ZGdd„dƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd„deƒZGdd	„d	ejjƒZGd d
„d
eƒZGd!d"„d"eƒZGd#d„deƒZGd$d„deƒZGd%d
„d
eƒZ Gd&d„deƒZ!Gd'd(„d(ƒZ"Gd)d*„d*e"ƒZ#d=d,d-„Z$d.d/„Z%d0d1„Z&d2d3„Z'd4d5„Z(d6d7„Z)Gd8d„de*ƒZ+Gd9d„de+ƒZ,Gd:d„de+ƒZ-Gd;d„de+ƒZ.Gd<d„de+ƒZ/dS)>zDRead/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.éNÚMailboxÚMaildirÚmboxÚMHÚBabylÚMMDFÚMessageÚMaildirMessageÚmboxMessageÚ	MHMessageÚBabylMessageÚMMDFMessageÚErrorÚNoSuchMailboxErrorÚ
NotEmptyErrorÚExternalClashErrorÚFormatErrorÚasciic@seZdZdZdCdd„Zdd„Zdd	„Zd
d„Zdd
„Zdd„Z	dDdd„Z
dd„Zdd„Zdd„Z
dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„ZdEd0d1„Zd2d3„ZdFd4d5„Zd6d7„Zd8d9„Zd:d;„Zd<d=„Z d>d?„Z!d@Z"dGdAdB„Z#dS)Hrz*A group of messages in a particular place.NTcCs tj tj |¡¡|_||_dS)zInitialize a Mailbox instance.N)ÚosÚpathÚabspathÚ
expanduserÚ_pathÚ_factory©ÚselfrÚfactoryÚcreate©rú#/usr/local/lib/python3.8/mailbox.pyÚ__init__$szMailbox.__init__cCstdƒ‚dS)ú$Add message and return assigned key.ú&Method must be implemented by subclassN©ÚNotImplementedError©rÚmessagerrrÚadd)szMailbox.addcCstdƒ‚dS)ú=Remove the keyed message; raise KeyError if it doesn't exist.r"Nr#©rÚkeyrrrÚremove-szMailbox.removecCs| |¡dS©N)r+r)rrrÚ__delitem__1szMailbox.__delitem__cCs(z| |¡Wntk
r"YnXdS©z'If the keyed message exists, remove it.N)r+ÚKeyErrorr)rrrÚdiscard4szMailbox.discardcCstdƒ‚dS)ú>Replace the keyed message; raise KeyError if it doesn't exist.r"Nr#©rr*r&rrrÚ__setitem__;szMailbox.__setitem__cCs*z| |¡WStk
r$|YSXdS)z9Return the keyed message, or default if it doesn't exist.N)Ú__getitem__r/)rr*ÚdefaultrrrÚget?szMailbox.getc
CsB|js| |¡St | |¡¡}| |¡W5QR£SQRXdS)z=Return the keyed message; raise KeyError if it doesn't exist.N)rÚget_messageÚ
contextlibÚclosingÚget_file)rr*Úfilerrrr4Fs
zMailbox.__getitem__cCstdƒ‚dS)ú4Return a Message representation or raise a KeyError.r"Nr#r)rrrr7NszMailbox.get_messagecCst | |¡¡ ¡S)zœReturn a string representation or raise a KeyError.

        Uses email.message.Message to create a 7bit clean string
        representation of the message.©ÚemailÚmessage_from_bytesÚ	get_bytesZ	as_stringr)rrrÚ
get_stringRszMailbox.get_stringcCstdƒ‚dS)z8Return a byte string representation or raise a KeyError.r"Nr#r)rrrr@YszMailbox.get_bytescCstdƒ‚dS)ú6Return a file-like representation or raise a KeyError.r"Nr#r)rrrr:]szMailbox.get_filecCstdƒ‚dS)úReturn an iterator over keys.r"Nr#©rrrrÚiterkeysaszMailbox.iterkeyscCst| ¡ƒS)zReturn a list of keys.)ÚlistrErDrrrÚkeyseszMailbox.keysc	cs>| ¡D]0}z||}Wntk
r0YqYnX|VqdS)z%Return an iterator over all messages.N©rEr/©rr*ÚvaluerrrÚ
itervaluesis
zMailbox.itervaluescCs| ¡Sr,)rKrDrrrÚ__iter__rszMailbox.__iter__cCst| ¡ƒS)z,Return a list of messages. Memory intensive.)rFrKrDrrrÚvaluesuszMailbox.valuesc	csB| ¡D]4}z||}Wntk
r0YqYnX||fVqdS)z.Return an iterator over (key, message) tuples.NrHrIrrrÚ	iteritemsys
zMailbox.iteritemscCst| ¡ƒS)z9Return a list of (key, message) tuples. Memory intensive.)rFrNrDrrrÚitems‚sz
Mailbox.itemscCstdƒ‚dS)ú9Return True if the keyed message exists, False otherwise.r"Nr#r)rrrÚ__contains__†szMailbox.__contains__cCstdƒ‚dS)ú*Return a count of messages in the mailbox.r"Nr#rDrrrÚ__len__ŠszMailbox.__len__cCs| ¡D]}| |¡qdS)zDelete all messages.N)rGr0r)rrrÚclearŽsz
Mailbox.clearcCs4z||}Wntk
r$|YSX| |¡|S)z3Delete the keyed message and return it, or default.)r/r0)rr*r5ÚresultrrrÚpop“s

zMailbox.popcCs*| ¡D]}|| |¡fStdƒ‚dS)z6Delete an arbitrary (key, message) pair and return it.zNo messages in mailboxN)rErVr/r)rrrÚpopitemœszMailbox.popitemc	Cstt|dƒr| ¡}nt|dƒr(| ¡}n|}d}|D].\}}z|||<Wq4tk
r`d}Yq4Xq4|rptdƒ‚dS)z4Change the messages that correspond to certain keys.rNrOFTzNo message with key(s)N)ÚhasattrrNrOr/)rÚargÚsourceZbad_keyr*r&rrrÚupdate£s



zMailbox.updatecCstdƒ‚dS)ú&Write any pending changes to the disk.r"Nr#rDrrrÚflush´sz
Mailbox.flushcCstdƒ‚dS)úLock the mailbox.r"Nr#rDrrrÚlock¸szMailbox.lockcCstdƒ‚dS)ú#Unlock the mailbox if it is locked.r"Nr#rDrrrÚunlock¼szMailbox.unlockcCstdƒ‚dS)úFlush and close the mailbox.r"Nr#rDrrrÚcloseÀsz
Mailbox.closecCs.z| d¡WStk
r(tdƒ‚YnXdS)Nrz?String input must be ASCII-only; use bytes or a Message instead)ÚencodeÚUnicodeErrorÚ
ValueErrorr%rrrÚ_string_to_bytesÄszMailbox._string_to_bytesFc	Csüt|tjjƒrvt ¡}tj ||d¡}| |¡| 	d¡| 
¡}| dt¡}| 
|¡|jrr| t¡sr| 
t¡n‚t|tttjfƒrt|tjƒr¬t dtd¡| ¡}t|tƒrÀ| |¡}|rÐ| dd¡}| dt¡}| 
|¡|jrø| t¡sø| 
t¡nòt|dƒrèt|dƒr2t d	td¡|j}d
}| ¡}| d¡r\|d
d…d}n| d
¡rx|d
d…d}|s‚qÂ|r¤| d¡r¤d|dd
…}| dt¡}| 
|¡|}q6|jrø|rø| t¡sø| 
t¡ntdt|ƒƒ‚d
S)z%Dump message contents to target file.ró
ú8Use of StringIO input is deprecated, use BytesIO insteadés
From s
>From ÚreadÚbufferúDUse of text mode files is deprecated, use a binary mode file insteadNó
éþÿÿÿó
éÿÿÿÿóFrom s>From éúInvalid message type: %s)Ú
isinstancer>r&rÚioÚBytesIOÚ	generatorÚBytesGeneratorÚflattenÚseekrkÚreplaceÚlinesepÚwriteÚ_append_newlineÚendswithÚstrÚbytesÚStringIOÚwarningsÚwarnÚDeprecationWarningÚgetvaluergrXrlÚreadlineÚ
startswithÚ	TypeErrorÚtype)	rr&ÚtargetZmangle_from_rlÚgenÚdataZlastlineÚlinerrrÚ
_dump_messageÑs`


ÿ


ÿ
zMailbox._dump_message)NT)N)N)N)F)$Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r'r+r-r0r3r6r4r7rAr@r:rErGrKrLrMrNrOrQrSrTrVrWr[r]r_rarcrgrrrrrrr!sB

		
	
c@sÚeZdZdZdZd6dd„Zdd„Zd	d
„Zdd„Zd
d„Z	dd„Z
dd„Zdd„Zdd„Z
dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-Zd.d/„Zd0d1„Zd2d3„Zd4d5„ZdS)7rzA qmail-style Maildir mailbox.ú:NTcCs¬t ||||¡tj |jd¡tj |jd¡tj |jd¡dœ|_tj |j¡sŠ|r€t |jd¡|j 	¡D]}t |d¡qln
t
|jƒ‚i|_dddœ|_d|_
d|_d	S)
zInitialize a Maildir instance.ÚtmpÚnewÚcur)r–r—r˜éÀr)r˜r—gš™™™™™¹?N)rr rrÚjoinrÚ_pathsÚexistsÚmkdirrMrÚ_tocÚ_toc_mtimesÚ
_last_readÚ_skewfactor)rÚdirnamerrrrrrr 
sý
zMaildir.__init__c
Cs~| ¡}z| ||¡Wn*tk
rB| ¡t |j¡‚YnXt|ƒt|t	ƒr|| 
¡}|j| ¡}||jkr„d}nd}d}tj
 |j¡ |j¡d}tj
 |j|||¡}t|t	ƒrÞt |jtj
 |j¡| ¡f¡zLzt |j|¡Wn(ttfk
rt |j|¡YnXt |j¡WnNtk
rx}z.t |j¡|jtjkrftd|ƒ‚n‚W5d}~XYnX|S)r!Úr—rz$Name clash with existing message: %sN)Ú_create_tmprÚ
BaseExceptionrcrr+ÚnameÚ_sync_closerur	Ú
get_subdirÚcolonÚget_inforÚbasenameÚsplitršrÚutimeÚgetatimeÚget_dateÚlinkÚAttributeErrorÚPermissionErrorÚrenameÚOSErrorÚerrnoÚEEXISTr)rr&Ztmp_fileÚsubdirÚsuffixÚuniqÚdestÚerrrr'!sF


ÿÿzMaildir.addcCs t tj |j| |¡¡¡dS©r(N)rr+rršrÚ_lookupr)rrrr+KszMaildir.removec	Cs,z| |¡Wnttfk
r&YnXdSr.)r+r/ÚFileNotFoundErrorr)rrrr0OszMaildir.discardcCsÊ| |¡}| |¡}| |¡}t|tƒr.|}n|}tj |¡}|j|kr`|j| |j¡d}nd}| 	|¡tj 
|j|¡}	tj 
|j|||¡}
t|tƒrºt |	tj 
|	¡| ¡f¡t |	|
¡dS)r1rqr£N)r½r'rur	rrr¢r©r¬r0ršrr­r®r¯r³)rr*r&Zold_subpathZtemp_keyZtemp_subpathZdominant_subpathr·r¸Ztmp_pathÚnew_pathrrrr3Ws$






ÿzMaildir.__setitem__c	Cs¢| |¡}ttj |j|¡dƒ }|jr4| |¡}nt|ƒ}W5QRXtj |¡\}}| 	|¡|j
|kr€| | |j
¡d¡| tj 
tj |j|¡¡¡|S)r<Úrbrq)r½Úopenrrršrrr	r¬Ú
set_subdirr©Úset_infoÚset_dateÚgetmtime)rr*ÚsubpathÚfÚmsgr·r¦rrrr7rs


zMaildir.get_messagec
CsDttj |j| |¡¡dƒ}| ¡ td¡W5QR£SQRXdS)ú2Return a bytes representation or raise a KeyError.rÀrhN)	rÁrrršrr½rkr|r}©rr*rÇrrrr@szMaildir.get_bytescCs$ttj |j| |¡¡dƒ}t|ƒS)rBrÀ)rÁrrršrr½Ú
_ProxyFilerÊrrrr:†szMaildir.get_filec	csF| ¡|jD]2}z| |¡Wntk
r8YqYnX|VqdS©rCN)Ú_refreshržr½r/r)rrrrE‹s

zMaildir.iterkeyscCs| ¡||jkS©rP)rÍržr)rrrrQ•szMaildir.__contains__cCs| ¡t|jƒS©rR)rÍÚlenržrDrrrrSšszMaildir.__len__cCsdS)ú"Write any pending changes to disk.NrrDrrrr]Ÿsz
Maildir.flushcCsdS)r^NrrDrrrr_¥szMaildir.lockcCsdS)r`NrrDrrrra©szMaildir.unlockcCsdS©rbNrrDrrrrc­sz
Maildir.closecCs\g}t |j¡D]F}t|ƒdkr|ddkrtj tj |j|¡¡r| |dd…¡q|S)úReturn a list of folder names.érÚ.N)rÚlistdirrrÐrÚisdirršÚappend©rrUÚentryrrrÚlist_folders±sÿzMaildir.list_folderscCs ttj |jd|¡|jddS)z/Return a Maildir instance for the named folder.rÕF©rr)rrrršrr©rÚfolderrrrÚ
get_folderºsþzMaildir.get_foldercCs\tj |jd|¡}t||jd}tj |d¡}tj |¡sXt t |tj	tj
Bd¡¡|S)z>Create a folder and return a Maildir instance representing it.rÕ©rZ
maildirfolderé¶)rrršrrrrœrcrÁÚO_CREATÚO_WRONLY)rrÞrrUZmaildirfolder_pathrrrÚ
add_folderÀsÿzMaildir.add_foldercCstj |jd|¡}t tj |d¡¡t tj |d¡¡D](}t|ƒdksX|ddkr<td|ƒ‚q<t |¡D]B}|dkrp|dkrp|dkrptj tj ||¡¡rptd||fƒ‚qptj|d	d
D]F\}}}|D]}t 	tj ||¡¡qÐ|D]}t 
tj ||¡¡qîqÂt 
|¡dS)ú-Delete the named folder, which must be empty.rÕr—r˜rÔrzFolder contains message(s): %sr–z%Folder contains subdirectory '%s': %sF)ÚtopdownN)rrršrrÖrÐrr×Úwalkr+Úrmdir)rrÞrrÚÚrootÚdirsÚfilesrrrÚ
remove_folderÊs&ÿÿÿzMaildir.remove_foldercCsXt ¡}t tj |jd¡¡D]4}tj |jd|¡}|tj |¡dkrt |¡qdS)zDelete old files in "tmp".r–i@úN)ÚtimerrÖrršrr®r+)rÚnowrÚrrrrÚcleanÝs
z
Maildir.cleanrÔcCsØt ¡}t ¡}d|kr$| dd¡}d|kr8| dd¡}dt|ƒt|ddƒt ¡tj|f}tj	 
|jd|¡}zt |¡WnFt
k
rÆtjd7_zt|ƒWYStk
rÀYnXYnXtd	|ƒ‚d
S)z=Create a file in the tmp subdirectory and open and return it.ú/z\057r•z\072z%s.M%sP%sQ%s.%srÔg€„.Ar–z&Name clash prevented file creation: %sN)ríÚsocketÚgethostnamer|ÚintrÚgetpidrÚ_countrršrÚstatr¾Ú_create_carefullyÚFileExistsErrorr)rrîÚhostnamer¹rrrrr¤çs,ÿÿzMaildir._create_tmpcCsØt ¡|jd|jkr^d}|jD]2}tj |j|¡}||j|krJd}||j|<q"|s^dSi|_|jD]^}|j|}t 	|¡D]D}tj 
||¡}tj |¡r¢q‚| |j
¡d}tj 
||¡|j|<q‚qjt ¡|_dS)z!Update table of contents mapping.éFTNr)rír r¡rŸrrrÅr›ržrÖršr×r¬r©)rZrefreshr·ÚmtimerrÚÚpr¹rrrrÍÿs&


zMaildir._refreshcCs€z.tj tj |j|j|¡¡r,|j|WSWntk
rBYnX| ¡z|j|WStk
rztd|ƒd‚YnXdS)z=Use TOC to return subpath for given key, or raise a KeyError.úNo message with key: %sN)rrrœršrržr/rÍr)rrrr½#szMaildir._lookupcCsXt|dƒs| ¡|_z|t|jƒWStk
r:YdStk
rPYqYqXqdS)z0Return the next message in a one-time iteration.Ú
_onetime_keysN)rXrErþÚnextÚ
StopIterationr/rDrrrrÿ1s

zMaildir.next)NT)r‘r’r“r”r©r r'r+r0r3r7r@r:rErQrSr]r_rarcrÛrßrärìrïrõr¤rÍr½rÿrrrrrs6
*
	
$c@s”eZdZdZd$dd„Zdd„Zdd	„Zd
d„Zdd
„Zdd„Z	dd„Z
dd„Zdd„Zdd„Z
dd„Zdd„Zdd„Zdd„Zd%d d!„Zd"d#„ZdS)&Ú_singlefileMailboxzA single-file mailbox.NTc
Cs¾t ||||¡zt|jdƒ}Wnntk
rŽ}zP|jtjkr\|rPt|jdƒ}q~t|jƒ‚n"|jtjtj	fkr|t|jdƒ}n‚W5d}~XYnX||_
d|_d|_d|_
d|_d|_d|_dS)z!Initialize a single-file mailbox.úrb+zwb+rÀNrF)rr rÁrr´rµÚENOENTrÚEACCESÚEROFSÚ_fileržÚ	_next_keyÚ_pendingÚ
_pending_syncÚ_lockedÚ_file_length)rrrrrÇr»rrrr As$z_singlefileMailbox.__init__cCs8| ¡| |¡|j|j<|jd7_d|_|jdS)r!rÔT)r½Ú_append_messageržrr	r%rrrr'Xs
z_singlefileMailbox.addcCs| |¡|j|=d|_dS)r(TN)r½ržrr)rrrr+bs
z_singlefileMailbox.removecCs$| |¡| |¡|j|<d|_dS)r1TN)r½rržrr2rrrr3hs
z_singlefileMailbox.__setitem__ccs| ¡|j ¡EdHdSrÌ)r½ržrGrDrrrrEnsz_singlefileMailbox.iterkeyscCs| ¡||jkSrÎ)r½ržr)rrrrQssz_singlefileMailbox.__contains__cCs| ¡t|jƒSrÏ)r½rÐržrDrrrrSxsz_singlefileMailbox.__len__cCs|jst|jƒd|_dS)r^TN)r
Ú
_lock_filerrDrrrr_}s
z_singlefileMailbox.lockcCs|jrt|jƒd|_dS©r`FN)r
Ú_unlock_filerrDrrrraƒs
z_singlefileMailbox.unlockc
Csä|js |jrt|jƒd|_dS|jdk	s.t‚|j dd¡|j ¡}||jkrbt	d|j|fƒ‚t
|jƒ}z¤i}| |¡t
|j ¡ƒD]x}|j|\}}|j |¡| |¡| ¡}|j td||j ¡ƒ¡}|sÜqè| |¡qº|| ¡f||<| |¡qŠ| ¡|_Wn"| ¡t |j¡‚YnXt|ƒ|j ¡t |j¡j}	t |j|	¡zt |j|j¡Wn2tk
r¨t |j¡t |j|j¡YnXt|jdƒ|_||_d|_d|_|jràt |jdddS)	rÑFNrrúz4Size of mailbox file changed (expected %i, found %i)ér)Údotlock)!rr	Ú_sync_flushrržÚAssertionErrorr{ÚtellrrÚ_create_temporaryrÚ_pre_mailbox_hookÚsortedrGÚ_pre_message_hookrkÚminr~Ú_post_message_hookrcrr+r¦r§röÚst_modeÚchmodr³rørÁr
r
)
rZcur_lenZnew_fileZnew_tocr*ÚstartÚstopZ	new_startrlÚmoderrrr]‰sb


þ



ÿ
z_singlefileMailbox.flushcCsdS)ú,Called before writing the mailbox to file f.Nr©rrÇrrrrÉsz$_singlefileMailbox._pre_mailbox_hookcCsdS)ú-Called before writing each message to file f.Nrr!rrrrÍsz$_singlefileMailbox._pre_message_hookcCsdS©ú,Called after writing each message to file f.Nrr!rrrrÑsz%_singlefileMailbox._post_message_hookcCs4z| ¡W5z|jr| ¡W5|j ¡XXdSrÒ)rrcr
rar]rDrrrrcÕsz_singlefileMailbox.closecCsN|jdkr| ¡|dk	rJz|j|WStk
rHtd|ƒd‚YnXdS)z'Return (start, stop) or raise KeyError.Nrý)ržÚ
_generate_tocr/r)rrrr½às
z_singlefileMailbox._lookupcCsœ|j dd¡|j ¡}t|jƒdkr8|js8| |j¡z&| |j¡| |¡}| 	|j¡Wn"t
k
r€|j |¡‚YnX|j ¡|j ¡|_
|S)z;Append message to mailbox and return (start, stop) offsets.rrú)rr{rrÐržrrrÚ_install_messagerr¥Útruncater]r)rr&ÚbeforeZoffsetsrrrrês


z"_singlefileMailbox._append_message)NT)N)r‘r’r“r”r r'r+r3rErQrSr_rar]rrrrcr½rrrrrr>s"

@

rc@sBeZdZdZdZdd„Zddd„Zddd	„Zdd
d„Zdd
„Z	dS)Ú	_mboxMMDFzAn mbox or MMDF mailbox.TcCsp| |¡\}}|j |¡|j ¡ td¡}|j ||j ¡¡}| | td¡¡}| 	|dd… 
d¡¡|S)r<órhrsNr)r½rr{rˆr|r}rkrÚ_message_factoryÚset_fromÚdecode)rr*rrÚ	from_lineÚstringrÈrrrr7sz_mboxMMDF.get_messageFcCst | ||¡¡j|dS)ú3Return a string representation or raise a KeyError.)Úunixfromr=)rr*Úfrom_rrrrAs

ÿÿz_mboxMMDF.get_stringcCsJ| |¡\}}|j |¡|s(|j ¡|j ||j ¡¡}| td¡S)r0rh)r½rr{rˆrkrr|r})rr*r2rrr/rrrr@s
z_mboxMMDF.get_bytescCs<| |¡\}}|j |¡|s(|j ¡t|j|j ¡|ƒS)rB)r½rr{rˆÚ_PartialFiler)rr*r2rrrrrr:s

z_mboxMMDF.get_filecCsd}t|tƒr| |¡}t|tƒrf| d¡rf| d¡}|dkr\|d|…}||dd…}q°|}d}nJt|tƒrˆ| ¡ d¡}d|}n(t|t	j
jƒr°| ¡}|dk	r°| d¡}|dkrÎdt
 t
 ¡¡ ¡}|j ¡}|j |t¡| ||j|j¡|j ¡}||fS)	z1Format a message and blindly write to self._file.NrrrhrqrÔr*rsFrom MAILER-DAEMON )rurrgr‚r‰ÚfindÚ_mboxMMDFMessageÚget_fromrdr>r&rÚget_unixfromríÚasctimeÚgmtimerrr~r}rÚ
_mangle_from_)rr&r.ÚnewlineZauthorrrrrrr&&s0







z_mboxMMDF._install_messageN)F)F)F)
r‘r’r“r”r:r7rAr@r:r&rrrrr)s


	
r)c@s2eZdZdZdZdZd
dd„Zdd„Zdd	„ZdS)rzA classic mbox mailbox.TNcCst|_t ||||¡dS)zInitialize an mbox mailbox.N)r
r+r)r rrrrr Lsz
mbox.__init__cCs| t¡dSr#©r~r}r!rrrrQszmbox._post_message_hookcCsègg}}d}|j d¡|j ¡}|j ¡}| d¡rzt|ƒt|ƒkrj|r`| |ttƒ¡n
| |¡| |¡d}q|s¤|r–| |ttƒ¡q¸| |¡q¸q|tkr²d}qd}qtt	t
||ƒƒƒ|_t|jƒ|_|j ¡|_
dS)ú0Generate key-to-(start, stop) table of contents.FrrrTN)rr{rrˆr‰rÐrØr}ÚdictÚ	enumerateÚzipržrr)rÚstartsÚstopsZlast_was_emptyÚline_posrrrrr%Us.






zmbox._generate_toc)NT)	r‘r’r“r”r:rr rr%rrrrrCs
c@s2eZdZdZddd„Zdd„Zdd	„Zd
d„ZdS)
rzAn MMDF mailbox.NTcCst|_t ||||¡dS)zInitialize an MMDF mailbox.N)r
r+r)r rrrrr zsz
MMDF.__init__cCs| dt¡dS)r"óNr<r!rrrrszMMDF._pre_message_hookcCs| tdt¡dS)r$rDNr<r!rrrrƒszMMDF._post_message_hookcCsÞgg}}|j d¡d}|}|j ¡}|j ¡}| dt¡r˜| |¡|}|j ¡}|j ¡}|dtkr„| |ttƒ¡qžqJ|sJ| |¡qžqJq|sq qtt	t
||ƒƒƒ|_t|jƒ|_|j dd¡|j ¡|_
dS)r=rrDrúN)rr{rˆrr‰r}rØrÐr>r?r@ržrr)rrArBÚnext_posrCrrrrr%‡s.






zMMDF._generate_toc)NT)r‘r’r“r”r rrr%rrrrrws

c@sÂeZdZdZd0dd„Zdd„Zdd	„Zd
d„Zdd
„Zdd„Z	dd„Z
dd„Zdd„Zdd„Z
dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„ZdS)1rzAn MH mailbox.NTcCstt ||||¡tj |j¡sj|r`t |jd¡t t tj 	|jd¡tj
tjBtjBd¡¡n
t
|jƒ‚d|_dS)zInitialize an MH instance.r™ú
.mh_sequencesi€FN)rr rrrœrrrcrÁršrâÚO_EXCLrãrr
rrrrr §sÿ
zMH.__init__cCsä| ¡}t|ƒdkrd}nt|ƒd}tj |jt|ƒ¡}t|ƒ}d}zŠ|j
rVt|ƒzfz| 
||¡Wn:tk
r¢|j
r†t|ƒt	|ƒd}t |¡‚YnXt|tƒrº| ||¡W5|j
rÌt|ƒXW5|sÞt	|ƒX|S)r!rrÔFT)rGrÐÚmaxrrršrrr÷r§r
r
rrr¥r+rurÚ_dump_sequences)rr&rGZnew_keyr¿rÇÚclosedrrrr'³s6


zMH.addc
Csxtj |jt|ƒ¡}zt|dƒ}Wn>tk
r`}z |jtjkrNt	d|ƒ‚n‚W5d}~XYnX| 
¡t |¡dS)r(rrýN)rrršrrrÁr´rµrr/rcr+)rr*rrÇr»rrrr+Õsz	MH.removec
CsÖtj |jt|ƒ¡}zt|dƒ}Wn>tk
r`}z |jtjkrNt	d|ƒ‚n‚W5d}~XYnXzd|jrrt|ƒz@t t |tjtjB¡¡| ||¡t|tƒr°| ||¡W5|jrÂt
|ƒXW5t
|ƒXdS)r1rrýN)rrršrrrÁr´rµrr/r§r
r
rrcrãÚO_TRUNCrrurrI)rr*r&rrÇr»rrrr3ãs$
zMH.__setitem__c
Csèz@|jr$ttj |jt|ƒ¡dƒ}nttj |jt|ƒ¡dƒ}Wn>tk
r~}z |jtj	krlt
d|ƒ‚n‚W5d}~XYnX|2|jr”t|ƒzt
|ƒ}W5|jr°t|ƒXW5QRX| ¡ ¡D]\}}||krÈ| |¡qÈ|S)r<rrÀrýN)r
rÁrrršrrr´rµrr/r
rrÚ
get_sequencesrOÚadd_sequence)rr*rÇr»rÈr¦Úkey_listrrrr7ûs&zMH.get_messagec
CsÔz@|jr$ttj |jt|ƒ¡dƒ}nttj |jt|ƒ¡dƒ}Wn>tk
r~}z |jtj	krlt
d|ƒ‚n‚W5d}~XYnX|F|jr”t|ƒz | 
¡ td¡W¢W5QR£S|jrÄt|ƒXW5QRXdS)rÉrrÀrýNrh)r
rÁrrršrrr´rµrr/r
rrkr|r}©rr*rÇr»rrrr@s zMH.get_bytesc
Csfzttj |jt|ƒ¡dƒ}Wn>tk
r\}z |jtjkrJt	d|ƒ‚n‚W5d}~XYnXt
|ƒS)rBrÀrýN)rÁrrršrrr´rµrr/rËrOrrrr:)szMH.get_filecCsttdd„t |j¡DƒƒƒS)rCcss|]}| ¡rt|ƒVqdSr,)Úisdigitró)Ú.0rÚrrrÚ	<genexpr>6sÿzMH.iterkeys.<locals>.<genexpr>)ÚiterrrrÖrrDrrrrE4szMH.iterkeyscCstj tj |jt|ƒ¡¡SrÎ)rrrœršrrr)rrrrQ9szMH.__contains__cCstt| ¡ƒƒSrÏ)rÐrFrErDrrrrS=sz
MH.__len__cCs2|js.ttj |jd¡dƒ|_t|jƒd|_dS)r^rFrTN)r
rÁrrršrrr
rDrrrr_As
zMH.lockcCs(|jr$t|jƒt|jƒ|`d|_dSr)r
rrr§rDrrrraHs


z	MH.unlockcCsdS)r\NrrDrrrr]PszMH.flushcCs|jr| ¡dSrÒ)r
rarDrrrrcTszMH.closecCs<g}t |j¡D]&}tj tj |j|¡¡r| |¡q|S)rÓ)rrÖrrr×ršrØrÙrrrrÛYs
zMH.list_folderscCsttj |j|¡|jddS)z+Return an MH instance for the named folder.FrÜ©rrrršrrrÝrrrrßasÿz
MH.get_foldercCsttj |j|¡|jdS)z:Create a folder and return an MH instance representing it.ràrTrÝrrrräfsÿz
MH.add_foldercCs`tj |j|¡}t |¡}|dgkr:t tj |d¡¡n|gkrDntd|jƒ‚t |¡dS)rårFzFolder not empty: %sN)rrršrrÖr+rrè)rrÞrÚentriesrrrrìks

zMH.remove_folderc

si}ttj |jd¡dddÜ}t| ¡ƒ‰|D]Ä}zš| d¡\}}tƒ}| ¡D]H}| ¡rn| 	t
|ƒ¡qRdd„| d¡Dƒ\}}	| t||	d	ƒ¡qR‡fd
d„t
|ƒDƒ||<t||ƒdkrÌ||=Wq0tk
ròtd
| ¡ƒ‚Yq0Xq0W5QRX|S)z=Return a name-to-key-list dictionary to define each sequence.rFÚrÚASCII©Úencodingr•css|]}t|ƒVqdSr,)ró)rQÚxrrrrR„sz#MH.get_sequences.<locals>.<genexpr>ú-rÔcsg|]}|ˆkr|‘qSrr)rQr*©Zall_keysrrÚ
<listcomp>†sÿz$MH.get_sequences.<locals>.<listcomp>rz"Invalid sequence specification: %s)rÁrrršrÚsetrGr¬rPr'rór[ÚrangerrÐrfrÚrstrip)
rÚresultsrÇrr¦ÚcontentsrGÚspecrrrr\rrLws(
ÿzMH.get_sequencescCsttj |jd¡ddd}zØt t |jtjtj	B¡¡| 
¡D]®\}}t|ƒdkrVq@| |d¡d}d}t
t|ƒƒD]R}|d	|krœ|sÆd
}| d¡n*|r¸d}| d||f¡n| d
|¡|}qx|rä| t|ƒd¡q@| d¡q@W5t|ƒXdS)z:Set sequences using the given name-to-key-list dictionary.rFzr+rWrXrr•NFrÔTr[z%s %sz %sÚ
)rÁrrršrr§rcr¦rãrKrOrÐr~rr^r)rÚ	sequencesrÇr¦rGÚprevZ
completingr*rrrÚ
set_sequencess.zMH.set_sequencesc	
Cs>| ¡}d}g}| ¡D]Â}|d|krÒ| ||df¡z4t tj |jt|ƒ¡tj |jt|dƒ¡¡WnHt	t
fk
r¶t tj |jt|ƒ¡tj |jt|dƒ¡¡YnXt tj |jt|ƒ¡¡|d7}q|d|_
t|ƒdkrödS| ¡D]0\}}|D]"\}}||kr
||| |¡<q
qþ| |¡dS)z?Re-name messages to eliminate numbering gaps. Invalidates keys.rrÔN)rLrErØrr°rršrrr±r²r³ÚunlinkrrÐrOÚindexrg)	rrerfZchangesr*r¦rNÚoldr—rrrÚpack¬s0ÿÿ



zMH.packcCst| ¡}| ¡}| ¡D]0\}}||kr4| |¡q||kr|| |¡=q|D]}||krN|g||<qN| |¡dS)z;Inspect a new MHMessage and update sequences appropriately.N)rLrOrØrirg)rr&r*Zpending_sequencesZ
all_sequencesr¦rNÚsequencerrrrIÆszMH._dump_sequences)NT)r‘r’r“r”r r'r+r3r7r@r:rErQrSr_rar]rcrÛrßrärìrLrgrkrIrrrrr¤s.
"c@seZdZdZedddddddhƒZd%dd„Zd
d„Zdd„Zdd„Z	dd„Z
dd„Zdd„Zdd„Z
dd„Zdd„Zdd „Zd!d"„Zd#d$„Zd	S)&rzAn Rmail-style Babyl mailbox.ÚunseenÚdeletedZfiledÚansweredÚ	forwardedZeditedÚresentNTcCst ||||¡i|_dS)zInitialize a Babyl mailbox.N)rr Ú_labelsrrrrr ÛszBabyl.__init__cCs(t ||¡}t|tƒr$| ¡|j|<|S)r!)rr'rurÚ
get_labelsrr)rr&r*rrrr'às
z	Babyl.addcCs"t ||¡||jkr|j|=dSr¼)rr+rrr)rrrr+çs
zBabyl.removecCs*t |||¡t|tƒr&| ¡|j|<dS)r1N)rr3rurrsrrr2rrrr3ís
zBabyl.__setitem__c
Csþ| |¡\}}|j |¡|j ¡t ¡}|j ¡}|dtks\|sHq\| | td¡¡q,t ¡}|j ¡}|tks|s|q| | td¡¡qd||j 	¡}|dksªt
‚|j |¡}| td¡}t| 
¡|ƒ}	|	 | 
¡¡||jkrú|	 |j|¡|	S)r<ó*** EOOH ***rhr)r½rr{rˆrvrwr}r~r|rrrkrr‡Úset_visiblerrÚ
set_labels)
rr*rrÚoriginal_headersrZvisible_headersÚnZbodyrÈrrrr7ós,



zBabyl.get_messagec	Cs¸| |¡\}}|j |¡|j ¡t ¡}|j ¡}|dtks\|sHq\| | td¡¡q,|j ¡}|tksv|s\qvq\| 	¡}||j 
¡}|dks˜t‚|j |¡}| td¡}||S)r0rtrhr)
r½rr{rˆrvrwr}r~r|r‡rrrk)	rr*rrrwrZheadersrxrŽrrrr@s"


zBabyl.get_bytescCst | |¡ dt¡¡S)rBrh)rvrwr@r|r}r)rrrr:%szBabyl.get_filecCs<| ¡tƒ}|j ¡D]}| |¡q| |j¡t|ƒS)z4Return a list of user-defined labels in the mailbox.)r½r^rrrMr[Údifference_updateÚ_special_labelsrF)rÚlabelsZ
label_listrrrrs)szBabyl.get_labelscCs:gg}}|j d¡d}g}|}|j ¡}|j ¡}|dtkrœt|ƒt|ƒkrd| |ttƒ¡| |¡dd„|j ¡dd… d¡Dƒ}| |¡q|dks°|dtkrÔt|ƒt|ƒkrì| |ttƒ¡q|s| |ttƒ¡qîqtt	t
||ƒƒƒ|_tt	|ƒƒ|_t|jƒ|_
|j dd	¡|j ¡|_dS)
r=rscSsg|]}| ¡r| ¡‘qSr)Ústrip©rQÚlabelrrrr]@sþz'Babyl._generate_toc.<locals>.<listcomp>rÔNó,órú)rr{rˆrr}rÐrØr¬r>r?r@ržrrrr)rrArBrEZlabel_listsrCrr{rrrr%2s4



ÿzBabyl._generate_toccCsVdt}|dt7}| ¡}dd„|Dƒ}|dd |¡t7}|d7}| |¡dS)	r sBABYL OPTIONS:s
Version: 5css|]}| ¡VqdSr,)rdr}rrrrRUsz*Babyl._pre_mailbox_hook.<locals>.<genexpr>sLabels:rr€N)r}rsršr~)rrÇZbabylr{rrrrPszBabyl._pre_mailbox_hookcCs| dt¡dS)r"óNr<r!rrrrZszBabyl._pre_message_hookcCs| td¡dS)r$r€Nr<r!rrrr^szBabyl._post_message_hookcCsx|j ¡}t|tƒr°g}g}| ¡D]$}||jkr>| |¡q$| |¡q$|j d¡|D]}|j d| ¡¡qZ|j d¡|D]}|j d| ¡d¡q„|j t	¡n|j dt	¡t|t
jjƒrt
 ¡}t
j |dd¡}| |¡| d¡| ¡}|j | d	t	¡¡|d	ks,|süq,qü|j d
t	¡t|tƒr¤t
 ¡}	t
j |	dd¡}
|
 | ¡¡|	 ¡}|j | d	t	¡¡|d	ks¢|snqâqnn>| d¡| ¡}|j | d	t	¡¡|d	ksâ|s®qâq®| d¡}|söqf|j | d	t	¡¡qânTt|ttt
jfƒrt|t
jƒrJt dtd
¡| ¡}t|tƒr`| |¡}| d¡d}|ddkrâ|j |d|… d	t	¡¡|j d
t	¡|j |d|… d	t	¡¡|j ||d… d	t	¡¡n(|j d
t	t	¡|j | d	t	¡¡nXt |dƒrVt |dƒr:t dtd
¡|j!}| ¡}
d}| ¡}| "d¡rl|dd…d	}n| "d¡rˆ|dd…d	}|j | d	t	¡¡|d	ks¬|sF|rÚd}|j d
t	¡| |
¡nqÚqF| ¡}|sìqf| "d¡r
|dd…t	}n:| "d¡r(|dd…t	}n| "d	¡rD|dd…t	}|j |¡qÚnt#dt$|ƒƒ‚|j ¡}||fS)z0Write message contents and return (start, stop).ó1s, s,,ó rs1,,Frrhrtrrirjs

rúrqNrˆrlrmTrnrorprt)%rrrurrsrzrØr~rdr}r>r&rrvrwrxryrzr{rˆr|Úget_visiblerkr‚rrƒr„r…r†r‡rgr4rXrlr€rŠr‹)rr&rZspecial_labelsr{r~Zorig_bufferZorig_generatorrZ
vis_bufferZ
vis_generatorrlZ
body_startZoriginal_posZ
first_passrrrrr&bs¼







ÿ
ÿ
zBabyl._install_message)NT)r‘r’r“r”Ú	frozensetrzr r'r+r3r7r@r:rsr%rrrr&rrrrrÕs&
ÿ
	
c@s*eZdZdZd	dd„Zdd„Zdd„ZdS)
rz0Message with mailbox-format-specific properties.NcCsÒt|tjjƒr4| t |¡¡t|tƒrÎ| |¡nšt|tƒrP| t 	|¡¡n~t|t
ƒrl| t |¡¡nbt|tj
ƒrŠ| t |¡¡nDt|dƒr¦| t |¡¡n(|dkr¾tjj |¡ntdt|ƒƒ‚dS)zInitialize a Message instance.rkNrt)rur>r&rÚ_become_messageÚcopyÚdeepcopyÚ_explain_tor‚r?rZmessage_from_stringrvÚ
TextIOWrapperZmessage_from_filerXZmessage_from_binary_filer rŠr‹r%rrrr Ñs



zMessage.__init__cCs4t|dgƒ}|jD]}||kr|j||j|<qdS)z0Assume the non-format-specific state of message.Ú_type_specific_attributesN)ÚgetattrÚ__dict__)rr&Z
type_specificr¦rrrr†äs
zMessage._become_messagecCst|tƒrdStdƒ‚dS)z:Copy format-specific state to message insofar as possible.Nz Cannot convert to specified type)rurrŠr%rrrr‰ës
zMessage._explain_to)N)r‘r’r“r”r r†r‰rrrrrÎs
c@s|eZdZdZdddgZddd„Zdd	„Zd
d„Zdd
„Zdd„Z	dd„Z
dd„Zdd„Zdd„Z
dd„Zdd„Zdd„ZdS)r	z)Message with Maildir-specific properties.Ú_subdirÚ_infoÚ_dateNcCs&d|_d|_t ¡|_t ||¡dS)z%Initialize a MaildirMessage instance.r—r£N)rŽrrírrr r%rrrr øs
zMaildirMessage.__init__cCs|jS)zReturn 'new' or 'cur'.)rŽrDrrrr¨ÿszMaildirMessage.get_subdircCs(|dks|dkr||_ntd|ƒ‚dS)zSet subdir to 'new' or 'cur'.r—r˜z!subdir must be 'new' or 'cur': %sN)rŽrf)rr·rrrrÂszMaildirMessage.set_subdircCs"|j d¡r|jdd…SdSdS)ú*Return as a string the flags that are set.ú2,rúNr£)rr‰rDrrrÚ	get_flags
szMaildirMessage.get_flagscCsdd t|ƒ¡|_dS)ú)Set the given flags and unset all others.r’r£N)ršrr)rÚflagsrrrÚ	set_flagsszMaildirMessage.set_flagscCs$| d t| ¡ƒt|ƒB¡¡dS©z.Set the given flag(s) without changing others.r£N©r–ršr^r“©rÚflagrrrÚadd_flagszMaildirMessage.add_flagcCs,| ¡r(| d t| ¡ƒt|ƒ¡¡dS)ú7Unset the given string flag(s) without changing others.r£N)r“r–ršr^r™rrrÚremove_flagszMaildirMessage.remove_flagcCs|jS)z<Return delivery date of message, in seconds since the epoch.)rrDrrrr¯szMaildirMessage.get_datecCs6zt|ƒ|_Wn"tk
r0td|ƒd‚YnXdS)z9Set delivery date of message, in seconds since the epoch.zcan't convert to float: %sN)ÚfloatrrfrŠ)rÚdaterrrrÄ"szMaildirMessage.set_datecCs|jS)z%Get the message's "info" as a string.)rrDrrrrª)szMaildirMessage.get_infocCs&t|tƒr||_ntdt|ƒƒ‚dS)z Set the message's "info" string.zinfo must be a string: %sN)rurrrŠr‹)rÚinforrrrÃ-s
zMaildirMessage.set_infocCs¤t|tƒr8| | ¡¡| | ¡¡| | ¡¡nht|tƒrÄt	| ¡ƒ}d|kr`| 
d¡| ¡dkrv| 
d¡d|krˆ| 
d¡d|krš| 
d¡d|kr¬| 
d¡| d	t 
| ¡¡¡nÜt|tƒrt	| ¡ƒ}d|krî| d
¡d|kr| d¡d|kr | d¡nˆt|tƒr‚t	| ¡ƒ}d|krD| d
¡d|krX| d
¡d|krl| d¡d|kr | d¡nt|tƒrntdt|ƒƒ‚dS)z;Copy Maildir-specific state to message insofar as possible.ÚSÚRr˜ÚOÚTÚDÚFÚAú
MAILER-DAEMONrmÚrepliedÚflaggedrnroÚPrpú$Cannot convert to specified type: %sN)rur	r–r“rÂr¨rÄr¯r5r^r›r,rír9rrMrÚ	add_labelrrŠr‹)rr&r•rrrr‰4sP

















ÿzMaildirMessage._explain_to)N)r‘r’r“r”r‹r r¨rÂr“r–r›rr¯rÄrªrÃr‰rrrrr	ós

c@sZeZdZdZdgZddd„Zdd„Zddd	„Zd
d„Zdd
„Z	dd„Z
dd„Zdd„ZdS)r5z/Message with mbox- or MMDF-specific properties.Ú_fromNcCsV| dd¡t|tjjƒrF| ¡}|dk	rF| d¡rF| |dd…¡t ||¡dS)z'Initialize an mboxMMDFMessage instance.r¨TNzFrom rs)r,rur>r&rr7r‰r )rr&r1rrrr esz_mboxMMDFMessage.__init__cCs|jS)z Return contents of "From " line.)r®rDrrrr6nsz_mboxMMDFMessage.get_fromcCs4|dk	r*|dkrt ¡}|dt |¡7}||_dS)z>Set "From " line, formatting and appending time_ if specified.NTú )rír9r8r®)rr2Ztime_rrrr,rs
z_mboxMMDFMessage.set_fromcCs| dd¡| dd¡S)r‘ÚStatusr£úX-Status)r6rDrrrr“zsz_mboxMMDFMessage.get_flagscCsÒt|ƒ}d\}}dD]}||kr||7}| |¡qdD]}||kr8||7}| |¡q8|d t|ƒ¡7}z| d|¡Wn tk
rš| d|¡YnXz| d|¡Wn tk
rÌ| d|¡YnXdS)r”)r£r£)r¢r£)r¥r¦r§r£r°r±N)r^r+ršrÚreplace_headerr/Z
add_header)rr•Zstatus_flagsZ
xstatus_flagsršrrrr–~s&z_mboxMMDFMessage.set_flagscCs$| d t| ¡ƒt|ƒB¡¡dSr—r˜r™rrrr›”sz_mboxMMDFMessage.add_flagcCs4d|ksd|kr0| d t| ¡ƒt|ƒ¡¡dS)rœr°r±r£Nr˜r™rrrr˜sz_mboxMMDFMessage.remove_flagc	CsÞt|tƒrÐt| ¡ƒ}d|kr(| d¡d|kr:| d¡d|krL| d¡d|kr^| d¡d|krp| d¡|d	=|d
=d | ¡ ¡dd
…¡}z| 	t
 t 
|d¡¡¡Wnttfk
rÊYnXn
t|tƒrø| | ¡¡| | ¡¡nât|tƒrZt| ¡ƒ}d|kr$| d¡d|kr8| d¡d|krL| d¡|d	=|d
=n€t|tƒr¼t| ¡ƒ}d|kr†| d¡d|krš| d¡d|kr®| d¡|d	=|d
=nt|tƒrÊntdt|ƒƒ‚d
S)zACopy mbox- or MMDF-specific state to message insofar as possible.r£r˜r¦r§r¢r¡r¥r¤Ústatuszx-statusr¯éûÿÿÿNz%a %b %d %H:%M:%S %Yrmr©rªrnror¬)rur	r^r“rÂr›ršr6r¬rÄÚcalendarZtimegmríÚstrptimerfÚ
OverflowErrorr5r–r,rrMrr­rrŠr‹)rr&r•Z
maybe_daterrrr‰sb





ÿ













ÿz_mboxMMDFMessage._explain_to)N)N)
r‘r’r“r”r‹r r6r,r“r–r›rr‰rrrrr5`s
	
r5c@seZdZdZdS)r
z&Message with mbox-specific properties.N©r‘r’r“r”rrrrr
Ñsc@sHeZdZdZdgZddd„Zdd„Zdd	„Zd
d„Zdd
„Z	dd„Z
dS)rz$Message with MH-specific properties.Ú
_sequencesNcCsg|_t ||¡dS)z!Initialize an MHMessage instance.N)r¹rr r%rrrr ÚszMHMessage.__init__cCs|jdd…S)z4Return a list of sequences that include the message.N)r¹rDrrrrLßszMHMessage.get_sequencescCst|ƒ|_dS)z3Set the list of sequences that include the message.N)rFr¹)rrerrrrgãszMHMessage.set_sequencescCs6t|tƒr"||jkr2|j |¡ntdt|ƒƒ‚dS)z8Add sequence to list of sequences including the message.zsequence type must be str: %sN)rurr¹rØrŠr‹©rrlrrrrMçs

zMHMessage.add_sequencecCs*z|j |¡Wntk
r$YnXdS)zARemove sequence from the list of sequences including the message.N)r¹r+rfrºrrrÚremove_sequenceïszMHMessage.remove_sequencecCsFt|tƒrdt| ¡ƒ}d|kr*| d¡n| d¡| d¡d|krP| d¡d|krb| d¡nÞt|tƒr¾t| ¡ƒ}d|krŽ| d¡n
| d	¡d|krª| d¡d|kr¼| d
¡n„t|tƒrâ| ¡D]}| |¡qÐn`t|t	ƒr$t| ¡ƒ}d|kr| 
d¡d|krB| 
d¡nt|tƒr2ntdt
|ƒƒ‚d
S)z6Copy MH-specific state to message insofar as possible.rmr˜r¡rªr¦r©r¢ÚROr£r§ror¬N)rur	r^rLrÂr›r5rrMrr­rrŠr‹)rr&rerlrrrr‰ösB










ÿzMHMessage._explain_to)N)r‘r’r“r”r‹r rLrgrMr»r‰rrrrrÕs
c@sbeZdZdZddgZddd„Zdd„Zd	d
„Zdd„Zd
d„Z	dd„Z
dd„Zdd„Zdd„Z
dS)rz'Message with Babyl-specific properties.rrÚ_visibleNcCsg|_tƒ|_t ||¡dS)z#Initialize a BabylMessage instance.N)rrrr½r r%rrrr "szBabylMessage.__init__cCs|jdd…S)z'Return a list of labels on the message.N)rrrDrrrrs(szBabylMessage.get_labelscCst|ƒ|_dS)z&Set the list of labels on the message.N)rFrr)rr{rrrrv,szBabylMessage.set_labelscCs6t|tƒr"||jkr2|j |¡ntdt|ƒƒ‚dS)z+Add label to list of labels on the message.zlabel must be a string: %sN)rurrrrØrŠr‹©rr~rrrr­0s

zBabylMessage.add_labelcCs*z|j |¡Wntk
r$YnXdS)z4Remove label from the list of labels on the message.N)rrr+rfr¾rrrÚremove_label8szBabylMessage.remove_labelcCs
t|jƒS)z3Return a Message representation of visible headers.©rr½rDrrrr„?szBabylMessage.get_visiblecCst|ƒ|_dS)z2Set the Message representation of visible headers.NrÀ)rZvisiblerrrruCszBabylMessage.set_visiblecCsb|j ¡D](}||kr*|j |||¡q
|j|=q
dD]$}||kr8||jkr8|||j|<q8dS)z9Update and/or sensibly generate a set of visible headers.)ZDateZFromzReply-ToZToZCCZSubjectN)r½rGr²)rÚheaderrrrÚupdate_visibleGs
zBabylMessage.update_visiblecCsrt|tƒr~t| ¡ƒ}d|kr*| d¡n| d¡| d¡d|ksNd|krX| d¡d|krj| d¡d	|kr|| d
¡nðt|tƒrØt| ¡ƒ}d|kr¨| d¡n
| d¡d	|krÄ| d
¡d|krÖ| d¡n–t|tƒrt| ¡ƒ}d|kr| d¡d|krn| d¡nTt|t	ƒrP| 
| ¡¡| ¡D]}| |¡q<nt|t
ƒr^ntdt|ƒƒ‚dS)z9Copy Babyl-specific state to message insofar as possible.rmr˜r¡rprqr«ror¢rnr¤r¼r£r¥r§r©r¬N)rur	r^rsrÂr›r5rrMrrur„r­rrŠr‹)rr&r{r~rrrr‰RsH










ÿzBabylMessage._explain_to)N)r‘r’r“r”r‹r rsrvr­r¿r„rurÂr‰rrrrrs
c@seZdZdZdS)r
z&Message with MMDF-specific properties.Nr¸rrrrr
|sc@s¨eZdZdZd&dd„Zd'dd„Zd(dd„Zd)d	d
„Zd*dd„Zd
d„Z	dd„Z
d+dd„Zdd„Zdd„Z
dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zed$d%„ƒZdS),rËzA read-only wrapper of a file.NcCs$||_|dkr| ¡|_n||_dS)zInitialize a _ProxyFile.N)rrÚ_pos)rrÇÚposrrrr ƒsz_ProxyFile.__init__cCs| ||jj¡S©zRead bytes.)Ú_readrrk©rÚsizerrrrk‹sz_ProxyFile.readcCs| ||jj¡SrÅ)rÆrÚread1rÇrrrrÉsz_ProxyFile.read1cCs| ||jj¡S)zRead a line.)rÆrrˆrÇrrrrˆ“sz_ProxyFile.readlinecCs<g}|D].}| |¡|dk	r|t|ƒ8}|dkrq8q|S)zRead multiple lines.Nr)rØrÐ)rÚsizehintrUrrrrÚ	readlines—s
z_ProxyFile.readlinesccs| ¡}|sdS|VqdS)zIterate over lines.N)rˆ)rrrrrrL¢sz_ProxyFile.__iter__cCs|jS)zReturn the position.)rÃrDrrrrªsz_ProxyFile.tellrcCs4|dkr|j |j¡|j ||¡|j ¡|_dS)zChange position.rÔN©rr{rÃr©rÚoffsetÚwhencerrrr{®sz_ProxyFile.seekcCs0t|dƒr,zt|jdƒr"|j ¡W5|`XdS)zClose the file.rrcN)rXrrcrDrrrrcµs

z_ProxyFile.closecCs2|dkrd}|j |j¡||ƒ}|j ¡|_|S)z"Read size bytes using read_method.NrqrÌ)rrÈÚread_methodrUrrrrƾsz_ProxyFile._readcCs|S)z$Context management protocol support.rrDrrrÚ	__enter__Çsz_ProxyFile.__enter__cGs| ¡dSr,)rc)rÚexcrrrÚ__exit__Ësz_ProxyFile.__exit__cCs
|j ¡Sr,)rÚreadablerDrrrrÔÎsz_ProxyFile.readablecCs
|j ¡Sr,)rÚwritablerDrrrrÕÑsz_ProxyFile.writablecCs
|j ¡Sr,)rÚseekablerDrrrrÖÔsz_ProxyFile.seekablecCs
|j ¡Sr,)rr]rDrrrr]×sz_ProxyFile.flushcCs&t|dƒsdSt|jdƒsdS|jjS)NrTrJF)rXrrJrDrrrrJÚs

z_ProxyFile.closed)N)N)N)N)N)r)r‘r’r“r”r rkrÉrˆrËrLrr{rcrÆrÑrÓrÔrÕrÖr]ÚpropertyrJrrrrrË€s&





		rËc@s<eZdZdZddd„Zdd„Zddd	„Zd
d„Zdd
„ZdS)r3z&A read-only wrapper of part of a file.NcCst |||¡||_||_dS)zInitialize a _PartialFile.N)rËr Ú_startÚ_stop)rrÇrrrrrr æsz_PartialFile.__init__cCst |¡|jS)z*Return the position with respect to start.)rËrrØrDrrrrìsz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}t |||¡dS)z8Change position, possibly with respect to start or stop.rrÔrúN)rØrÃrÙrËr{rÍrrrr{ðsz_PartialFile.seekcCsB|j|j}|dkrdS|dks0|dks0||kr4|}t |||¡S)z;Read size bytes using read_method, honoring start and stop.rr*N)rÙrÃrËrÆ)rrÈrÐÚ	remainingrrrrÆúsz_PartialFile._readcCst|dƒr|`dS)Nr)rXrrDrrrrcs
z_PartialFile.close)NN)r)	r‘r’r“r”r rr{rÆrcrrrrr3ãs


	r3Tc
Cs¦d}zbtrpzt |tjtjB¡WnJtk
rn}z,|jtjtjtjfkr\t	d|j
ƒ‚n‚W5d}~XYnX|rfzt|j
dƒ}| ¡WnBtk
rÒ}z$|jtjtjfkrÀWY¢WdS‚W5d}~XYnXz`zt
 |j
|j
d¡d}Wn2ttfk
r$t
 |j
|j
d¡d}YnXt
 |j
¡Wn0tk
rdt
 |j
¡t	d|j
ƒ‚YnXWn8tr„t |tj¡|ršt
 |j
d¡‚YnXdS)z(Lock file f using lockf and dot locking.Fzlockf: lock unavailable: %sNú.lockTzdot lock unavailable: %s)ÚfcntlÚlockfZLOCK_EXZLOCK_NBr´rµÚEAGAINrrrr¦rrcrr°r±r²r³rhrør+ÚLOCK_UN)rÇrZdotlock_doner»Zpre_lockrrrr

sLÿ
ÿr
cCs8trt |tj¡tj |jd¡r4t |jd¡dS)z*Unlock file f using lockf and dot locking.rÛN)rÜrÝrßrrrœr¦r+©rÇrrrr4src	Cs<t |tjtjBtjBd¡}zt|dƒW¢St |¡XdS)zCCreate a file if it doesn't exist and open for reading and writing.rárN)rrÁrârGÚO_RDWRrc)rÚfdrrrr÷;sr÷cCs$td|tt ¡ƒt ¡t ¡fƒS)zBCreate a temp file based on path and open for reading and writing.z%s.%s.%s.%s)r÷rórírñròrrô)rrrrrCsþrcCs$| ¡ttdƒr t | ¡¡dS)z0Ensure changes to file f are physically on disk.ÚfsyncN)r]rXrrãÚfilenoràrrrrIs
rcCst|ƒ| ¡dS)z:Close file f, ensuring all changes are physically on disk.N)rrcràrrrr§Osr§c@seZdZdZdS)rz"Raised for module-specific errors.Nr¸rrrrrUsc@seZdZdZdS)rz:The specified mailbox does not exist and won't be created.Nr¸rrrrrXsc@seZdZdZdS)rz>The specified mailbox is not empty and deletion was requested.Nr¸rrrrr[sc@seZdZdZdS)rz)Another process caused an action to fail.Nr¸rrrrr^sc@seZdZdZdS)rz)A file appears to have an invalid format.Nr¸rrrrras)T)0r”rrírµrñrµr‡r„r>Z
email.messageZemail.generatorrvr8rÜÚImportErrorÚ__all__r}rdrrrr)rrrrr&rr	r5r
rrr
rËr3r
rr÷rrr§Ú	ExceptionrrrrrrrrrÚ<module>s‚
ýh8DB4-3z%mqH_c'
*

Zerion Mini Shell 1.0