Hacked By AnonymousFox

Current Path : /proc/thread-self/root/opt/alt/python27/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/opt/alt/python27/lib64/python2.7/mailbox.pyo

�
^
bc@s�dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlZy(ejdkr�e
�nddlZWne
k
r�eZnXddlZej��0ejrejdde�nddlZWdQXdddd	d
ddd
dddddddddgZdfd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZd	efd��YZd
efd ��YZdejj fd!��YZ d
e fd"��YZ!d#e fd$��YZ"de"fd%��YZ#de fd&��YZ$de fd'��YZ%de"fd(��YZ&d)fd*��YZ'd+e'fd,��YZ(e)d-�Z*d.�Z+d/�Z,d0�Z-d1�Z.d2�Z/d3fd4��YZ0de0fd5��YZ1de1fd6��YZ2de0fd7��YZ3dfd8��YZ4de0fd9��YZ5d:e6fd;��YZ7d<e7fd=��YZ8d>e7fd?��YZ9d@e7fdA��YZ:dBe7fdC��YZ;dS(DsDRead/write support for Maildir, mbox, MH, Babyl, and MMDF mailboxes.i����Ntos2emxtignores.*rfc822 has been removedtMailboxtMaildirtmboxtMHtBabyltMMDFtMessagetMaildirMessagetmboxMessaget	MHMessagetBabylMessagetMMDFMessagetUnixMailboxtPortableUnixMailboxtMmdfMailboxt	MHMailboxtBabylMailboxcBs4eZdZded�Zd�Zd�Zd�Zd�Z	d�Z
dd�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zd�Zdd�Zd�Zd�Zd�Z d�Z!e"Z#e"d�Z$RS( s*A group of messages in a particular place.cCs.tjjtjj|��|_||_dS(sInitialize a Mailbox instance.N(tostpathtabspatht
expandusert_patht_factory(tselfRtfactorytcreate((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt__init__+s!cCstd��dS(s$Add message and return assigned key.s&Method must be implemented by subclassN(tNotImplementedError(Rtmessage((s,/opt/alt/python27/lib64/python2.7/mailbox.pytadd0scCstd��dS(s=Remove the keyed message; raise KeyError if it doesn't exist.s&Method must be implemented by subclassN(R(Rtkey((s,/opt/alt/python27/lib64/python2.7/mailbox.pytremove4scCs|j|�dS(N(R!(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt__delitem__8scCs)y|j|�Wntk
r$nXdS(s'If the keyed message exists, remove it.N(R!tKeyError(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pytdiscard;s
cCstd��dS(s>Replace the keyed message; raise KeyError if it doesn't exist.s&Method must be implemented by subclassN(R(RR R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt__setitem__BscCs*y|j|�SWntk
r%|SXdS(s9Return the keyed message, or default if it doesn't exist.N(t__getitem__R#(RR tdefault((s,/opt/alt/python27/lib64/python2.7/mailbox.pytgetFs
cCs0|js|j|�S|j|j|��SdS(s=Return the keyed message; raise KeyError if it doesn't exist.N(Rtget_messagetget_file(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR&Ms	
cCstd��dS(s4Return a Message representation or raise a KeyError.s&Method must be implemented by subclassN(R(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR)TscCstd��dS(s3Return a string representation or raise a KeyError.s&Method must be implemented by subclassN(R(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt
get_stringXscCstd��dS(s6Return a file-like representation or raise a KeyError.s&Method must be implemented by subclassN(R(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR*\scCstd��dS(sReturn an iterator over keys.s&Method must be implemented by subclassN(R(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytiterkeys`scCst|j��S(sReturn a list of keys.(tlistR,(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytkeysdsccsEx>|j�D]0}y||}Wntk
r7q
nX|Vq
WdS(s%Return an iterator over all messages.N(R,R#(RR tvalue((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt
itervalueshs
cCs
|j�S(N(R0(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt__iter__qscCst|j��S(s,Return a list of messages. Memory intensive.(R-R0(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytvaluestsccsKxD|j�D]6}y||}Wntk
r7q
nX||fVq
WdS(s.Return an iterator over (key, message) tuples.N(R,R#(RR R/((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt	iteritemsxs
cCst|j��S(s9Return a list of (key, message) tuples. Memory intensive.(R-R3(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytitems�scCstd��dS(s9Return True if the keyed message exists, False otherwise.s&Method must be implemented by subclassN(R(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pythas_key�scCs
|j|�S(N(R5(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt__contains__�scCstd��dS(s*Return a count of messages in the mailbox.s&Method must be implemented by subclassN(R(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt__len__�scCs(x!|j�D]}|j|�q
WdS(sDelete all messages.N(R,R$(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pytclear�scCs4y||}Wntk
r"|SX|j|�|S(s3Delete the keyed message and return it, or default.(R#R$(RR R'tresult((s,/opt/alt/python27/lib64/python2.7/mailbox.pytpop�s

cCs7x0|j�D]}||j|�fSWtd��dS(s6Delete an arbitrary (key, message) pair and return it.sNo messages in mailboxN(R,R:R#(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pytpopitem�scCs�t|d�r|j�}n$t|d�r<|j�}n|}t}x<|D]4\}}y|||<WqOtk
r�t}qOXqOW|r�td��ndS(s4Change the messages that correspond to certain keys.R3R4sNo message with key(s)N(thasattrR3R4tFalseR#tTrue(Rtargtsourcetbad_keyR R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytupdate�s
cCstd��dS(s&Write any pending changes to the disk.s&Method must be implemented by subclassN(R(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytflush�scCstd��dS(sLock the mailbox.s&Method must be implemented by subclassN(R(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytlock�scCstd��dS(s#Unlock the mailbox if it is locked.s&Method must be implemented by subclassN(R(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytunlock�scCstd��dS(sFlush and close the mailbox.s&Method must be implemented by subclassN(R(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytclose�sc	Cs	t|tjj�r�tj�}tjj||d�}|j|�|jd�|j	�j
dtj�}|j
|�|jr|jtj�r|j
tj�qnXt|t�r+|r�|j
dd�}n|j
dtj�}|j
|�|jr|jtj�r|j
tj�qn�t|d�r�d}xttr�|j�}|dkrePn|r�|jd�r�d|d	}n|j
dtj�}|j
|�|}qCW|jr|r|jtj�r|j
tj�qntd
t|���dS(s%Dump message contents to target file.is
s
From s
>From treadtsFrom s>From isInvalid message type: %sN(t
isinstancetemailRRtStringIOt	generatort	GeneratortflattentseekRGtreplaceRtlineseptwritet_append_newlinetendswithtstrR<tNoneR>treadlinet
startswitht	TypeErrorttype(	RRttargettmangle_from_tbuffertgentdatatlastlinetline((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt
_dump_message�s<



	

"N(%t__name__t
__module__t__doc__RVR>RRR!R"R$R%R(R&R)R+R*R,R.R0R1R2R3R4R5R6R7R8R:R;RBRCRDRERFR=RSRb(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR(s@																												cBs�eZdZdZejed�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdZd�Zd�Zd�Zd�ZRS(sA qmail-style Maildir mailbox.t:cCs
tj||||�itjj|jd�d6tjj|jd�d6tjj|jd�d6|_tjj|j�s�|r�tj|jd�x9|jj	�D]}tj|d�q�Wq�t
|j��ni|_idd6dd6|_d|_
d|_dS(sInitialize a Maildir instance.ttmptnewtcuri�ig�������?N(RRRRtjoinRt_pathstexiststmkdirR2tNoSuchMailboxErrort_toct_toc_mtimest
_last_readt_skewfactor(RtdirnameRRR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s		cCs�|j�}y|j||�Wn.tk
rP|j�tj|j��nXt|�t|t	�r�|j
�}|j|j�}||jkr�d}q�nd}d}tj
j|j�j|j�d}tj
j|j|||�}t|t	�r4tj|jtj
j|j�|j�f�nyLttd�rltj|j|�tj|j�ntj|j|�WnKtk
r�}tj|j�|jtjkr�td|��q��nX|S(s$Add message and return assigned key.RHRhitlinks$Name clash with existing message: %s(t_create_tmpRbt
BaseExceptionRFRR!tnamet_sync_closeRIR	t
get_subdirtcolontget_infoRtbasenametsplitRjRtutimetgetatimetget_dateR<RttrenametOSErrorterrnotEEXISTtExternalClashError(RRttmp_filetsubdirtsuffixtuniqtdestte((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRs@


%%
cCs,tjtjj|j|j|���dS(s=Remove the keyed message; raise KeyError if it doesn't exist.N(RR!RRjRt_lookup(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR!4scCsSy|j|�Wn;tk
r$n+tk
rN}|jtjkrO�qOnXdS(s'If the keyed message exists, remove it.N(R!R#R�R�tENOENT(RR R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR$8s
cCs$|j|�}|j|�}|j|�}t|t�rE|}n|}tjj|�}|j|kr�|j|j|j�d}nd}|j	|�tjj
|j|�}	tjj
|j|||�}
t|t�rtj|	tjj
|	�|j�f�ntj|	|
�dS(s>Replace the keyed message; raise KeyError if it doesn't exist.i����RHN(R�RRIR	RRRsRzR}R$RjRR~RR�R�(RR Rtold_subpathttemp_keyttemp_subpathtdominant_subpathR�R�ttmp_pathtnew_path((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR%Cs"	 
	"cCs�|j|�}ttjj|j|�d�}z+|jrN|j|�}nt|�}Wd|j�Xtjj	|�\}}|j
|�|j|kr�|j|j	|j�d�n|j
tjjtjj|j|���|S(s4Return a Message representation or raise a KeyError.trNi����(R�topenRRRjRRR	RFR}t
set_subdirRztset_infotset_datetgetmtime(RR tsubpathtftmsgR�Rw((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR)^s!	
 +cCsJttjj|j|j|��d�}z|j�SWd|j�XdS(s3Return a string representation or raise a KeyError.R�N(R�RRRjRR�RGRF(RR R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR+ps*cCs4ttjj|j|j|��d�}t|�S(s6Return a file-like representation or raise a KeyError.trb(R�RRRjRR�t
_ProxyFile(RR R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR*xs*ccsO|j�x>|jD]3}y|j|�Wntk
rAqnX|VqWdS(sReturn an iterator over keys.N(t_refreshRoR�R#(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR,}s

cCs|j�||jkS(s9Return True if the keyed message exists, False otherwise.(R�Ro(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR5�s
cCs|j�t|j�S(s*Return a count of messages in the mailbox.(R�tlenRo(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR7�s
cCsdS(s"Write any pending changes to disk.N((R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRC�scCsdS(sLock the mailbox.N((R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRD�scCsdS(s#Unlock the mailbox if it is locked.N((R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRE�scCsdS(sFlush and close the mailbox.N((R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRF�scCs�g}xttj|j�D]`}t|�dkr|ddkrtjjtjj|j|��r|j|d�qqW|S(sReturn a list of folder names.iit.(RtlistdirRR�RtisdirRjtappend(RR9tentry((s,/opt/alt/python27/lib64/python2.7/mailbox.pytlist_folders�s"$cCs/ttjj|jd|�d|jdt�S(s/Return a Maildir instance for the named folder.R�RR(RRRRjRRR=(Rtfolder((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt
get_folder�s	cCs�tjj|jd|�}t|d|j�}tjj|d�}tjj|�s�tjtj|tj	tj
Bd��n|S(s>Create a folder and return a Maildir instance representing it.R�Rt
maildirfolderi�(RRRjRRRRlRFR�tO_CREATtO_WRONLY(RR�RR9tmaildirfolder_path((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt
add_folder�s
cCs�tjj|jd|�}xwtjtjj|d��tjtjj|d��D];}t|�dks|ddkrWtd|��qWqWWxutj|�D]d}|dkr�|dkr�|dkr�tjjtjj||��r�td||f��q�q�Wx�tj|d	t	�D]i\}}}x*|D]"}tj
tjj||��q:Wx*|D]"}tjtjj||��qgWq$Wtj|�d
S(s-Delete the named folder, which must be empty.R�RhRiiisFolder contains message(s): %sRgs%Folder contains subdirectory '%s': %sttopdownN(RRRjRR�R�t
NotEmptyErrorR�twalkR=R!trmdir(RR�RR�troottdirstfiles((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt
remove_folder�s #"$!%
 
$cCs�tj�}xptjtjj|jd��D]M}tjj|jd|�}|tjj|�dkr.tj|�q.q.WdS(sDelete old files in "tmp".Rgi@�N(ttimeRR�RRjRRR!(RtnowR�R((s,/opt/alt/python27/lib64/python2.7/mailbox.pytclean�s
(icCsItj�}tj�}d|kr9|jdd�}nd|krZ|jdd�}ndt|�t|dd�tj�tj|f}tj	j
|jd|�}ytj|�Wnvt
k
r4}|jtjkr.tjd7_yt|�SWq1t
k
r*}|jtjkr+�q+q1Xq5�nXtd	|��d
S(s=Create a file in the tmp subdirectory and open and return it.t/s\057Rfs\072s%s.M%sP%sQ%s.%sig��.ARgs&Name clash prevented file creation: %sN(R�tsockettgethostnameRPtintRtgetpidRt_countRRjRtstatR�R�R�t_create_carefullyR�R�(RR�thostnameR�RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRu�s,&
cCs?tj�|jd|jkr�t}xS|jD]H}tjj|j|�}||j|krkt	}n||j|<q0W|s�dSni|_
x�|jD]�}|j|}xvtj|�D]e}tjj||�}tjj
|�r�q�n|j|j�d}tjj||�|j
|<q�Wq�Wtj�|_dS(s!Update table of contents mapping.iNi(R�RqRrR=RpRRR�RkR>RoR�RjR�R}Rz(RtrefreshR�tmtimeRR�tpR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s& 		
$cCs�y:tjjtjj|j|j|��r9|j|SWntk
rMnX|j�y|j|SWn!tk
r�td|��nXdS(s=Use TOC to return subpath for given key, or raise a KeyError.sNo message with key: %sN(RRRlRjRRoR#R�(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s+


cCsot|d�s!|j�|_nxGtrjy||jj�SWq$tk
rSdStk
rfq$q$Xq$WdS(s0Return the next message in a one-time iteration.t
_onetime_keysN(R<R,R�R>tnextt
StopIterationRVR#(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�'s	

( RcRdReRztrfc822RR>RRR!R$R%R)R+R*R,R5R7RCRDRERFR�R�R�R�R�R�RuR�R�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s6	)							
										
				$	t_singlefileMailboxcBs�eZdZded�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zdd�Zd�ZRS(sA single-file mailbox.cCs�tj||||�yt|jd�}Wn�tk
r�}|jtjkr}|rkt|jd�}q�t|j��q�|jtjtj	fkr�t|jd�}q��nX||_
d|_d|_
t|_t|_t|_d|_dS(s!Initialize a single-file mailbox.srb+swb+R�iN(RRR�RtIOErrorR�R�RntEACCEStEROFSt_fileRVRot	_next_keyR=t_pendingt
_pending_synct_lockedt_file_length(RRRRR�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR7s$						cCsF|j�|j|�|j|j<|jd7_t|_|jdS(s$Add message and return assigned key.i(R�t_append_messageRoR�R>R�(RR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRNs

	cCs$|j|�|j|=t|_dS(s=Remove the keyed message; raise KeyError if it doesn't exist.N(R�RoR>R�(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR!Xs

cCs0|j|�|j|�|j|<t|_dS(s>Replace the keyed message; raise KeyError if it doesn't exist.N(R�R�RoR>R�(RR R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR%^s
ccs-|j�x|jj�D]}|VqWdS(sReturn an iterator over keys.N(R�RoR.(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR,ds
cCs|j�||jkS(s9Return True if the keyed message exists, False otherwise.(R�Ro(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR5js
cCs|j�t|j�S(s*Return a count of messages in the mailbox.(R�R�Ro(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR7os
cCs&|js"t|j�t|_ndS(sLock the mailbox.N(R�t
_lock_fileR�R>(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRDts	
cCs&|jr"t|j�t|_ndS(s#Unlock the mailbox if it is locked.N(R�t_unlock_fileR�R=(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyREzs	
cCs�|js/|jr+t|j�t|_ndS|jjdd�|jj�}||jkr|td|j|f��nt	|j
�}y�i}|j|�x�t|j
j��D]�}|j
|\}}|jj|�|j|�|j�}xOtrJ|jjtd||jj���}|dkr:Pn|j|�q�W||j�f||<|j|�q�W|j�|_Wn$|j�tj|j��nXt|�|jj�tj|j
�j}	tj|j|	�ytj|j|j
�Wnrtk
rv}
|
jtj ksGtjdkrp|
jtj!krptj|j
�tj|j|j
�qw�nXt"|j
d�|_||_
t|_t|_|j#r�t$|jd	t�ndS(
s"Write any pending changes to disk.Niis4Size of mailbox file changed (expected %i, found %i)iRHtos2srb+tdotlock(%R�R�t_sync_flushR�R=ROttellR�R�t_create_temporaryRt_pre_mailbox_hooktsortedRoR.t_pre_message_hookR>RGtminRRt_post_message_hookRFRR!RwRxR�tst_modetchmodR�R�R�R�R�R�R�R�(Rtcur_lentnew_filetnew_tocR tstarttstopt	new_startR]tmodeR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRC�sd		
	

	


!				cCsdS(s,Called before writing the mailbox to file f.N((RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��scCsdS(s-Called before writing each message to file f.N((RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��scCsdS(s,Called after writing each message to file f.N((RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��scCsAz|j�Wdz|jr*|j�nWd|jj�XXdS(sFlush and close the mailbox.N(RCR�RER�RF(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRF�s	cCsb|jdkr|j�n|dk	r^y|j|SWq^tk
rZtd|��q^XndS(s'Return (start, stop) or raise KeyError.sNo message with key: %sN(RoRVt
_generate_tocR#(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s

cCs�|jjdd�|jj�}t|j�dkrT|jrT|j|j�ny3|j|j�|j|�}|j	|j�Wn$t
k
r�|jj|��nX|jj�|jj�|_
|S(s;Append message to mailbox and return (start, stop) offsets.ii(R�ROR�R�RoR�R�R�t_install_messageR�RvttruncateRCR�(RRtbeforetoffsets((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s

N(RcRdReRVR>RRR!R%R,R5R7RDRERCR�R�R�RFR�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�4s"	
								D				
t	_mboxMMDFcBs>eZdZeZd�Zed�Zed�Zd�Z	RS(sAn mbox or MMDF mailbox.cCs�|j|�\}}|jj|�|jj�jtjd�}|jj||jj��}|j	|jtjd��}|j
|d�|S(s4Return a Message representation or raise a KeyError.RHs
i(R�R�RORWRPRRQRGR�t_message_factorytset_from(RR R�R�t	from_linetstringR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR)scCsm|j|�\}}|jj|�|s;|jj�n|jj||jj��}|jtjd�S(s3Return a string representation or raise a KeyError.s
(	R�R�RORWRGR�RPRRQ(RR tfrom_R�R�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR+scCsW|j|�\}}|jj|�|s;|jj�nt|j|jj�|�S(s6Return a file-like representation or raise a KeyError.(R�R�RORWt_PartialFileR�(RR R�R�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR*s
cCs/d}t|t�ri|jd�ri|jd�}|dkrZ|| }||d}q�|}d}nFt|t�r�d|j�}n$t|tjj	�r�|j
�}n|dkr�dtjtj
��}n|jj�}|jj|tj�|j||j|j�|jj�}||fS(s1Format a message and blindly write to self._file.sFrom s
i����iRHsFrom MAILER-DAEMON %sN(RVRIRURXtfindt_mboxMMDFMessagetget_fromRJRRtget_unixfromR�tasctimetgmtimeR�R�RRRRQRbt
_mangle_from_(RRR�tnewlineR�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s&
	(
RcRdReR>R�R)R=R+R*R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s	
	cBs;eZdZeZeZded�Zd�Zd�Z	RS(sA classic mbox mailbox.cCs#t|_tj||||�dS(sInitialize an mbox mailbox.N(R
R�R�R(RRRR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR=s	cCs|jtj�dS(s,Called after writing each message to file f.N(RRRRQ(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�BscCs\gg}}t}|jjd�x�tr|jj�}|jj�}|jd�r�t|�t|�kr�|r�|j|tt	j
��q�|j|�n|j|�t}q&|s�|r�|j|tt	j
��n
|j|�Pq&|t	j
krt}q&t}q&Wttt
||���|_t|j�|_|jj�|_dS(s0Generate key-to-(start, stop) table of contents.isFrom N(R=R�ROR>R�RWRXR�R�RRQtdictt	enumeratetzipRoR�R�(Rtstartststopstlast_was_emptytline_posRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�Fs0
	
	
	
N(
RcRdReR>R�RSRVRR�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR4s	cBs8eZdZded�Zd�Zd�Zd�ZRS(sAn MMDF mailbox.cCs#t|_tj||||�dS(sInitialize an MMDF mailbox.N(R
R�R�R(RRRR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRks	cCs|jdtj�dS(s-Called before writing each message to file f.sN(RRRRQ(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�pscCs|jtjdtj�dS(s,Called after writing each message to file f.sN(RRRRQ(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�tscCsbgg}}|jjd�d}x�tr|}|jj�}|jj�}|jdtj�r�|j|�x�tr�|}|jj�}|jj�}|dtjkr�|j|t	tj��Pqv|dkrv|j|�PqvqvWq&|dkr&Pq&q&Wt
tt||���|_
t	|j
�|_|jjdd�|jj�|_dS(s0Generate key-to-(start, stop) table of contents.isRHiN(R�ROR>RWR�RXRRQR�R�R�R�R�RoR�R�(RRRtnext_posRRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�xs2
	
	
N(	RcRdReRVR>RR�R�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRhs
		cBs�eZdZded�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sAn MH mailbox.cCs�tj||||�tjj|j�s�|r�tj|jd�tjtjtjj	|jd�tj
tjBtjBd��q�t
|j��nt|_dS(sInitialize an MH instance.i�s
.mh_sequencesi�N(RRRRRlRRmRFR�RjR�tO_EXCLR�RnR=R�(RRRR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s!!cCs:|j�}t|�dkr'd}nt|�d}tjj|jt|��}t|�}t	}z�|j
r�t|�nz�y|j||�WnGt
k
r�|j
r�t|�nt|�t}tj|��nXt|t�r|j||�nWd|j
rt|�nXWd|s5t|�nX|S(s$Add message and return assigned key.iiN(R.R�tmaxRRRjRRUR�R=R�R�RbRvR�RxR>R!RIRt_dump_sequences(RRR.tnew_keyR�R�tclosed((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s6		

	


	cCs�tjj|jt|��}yt|d�}Wn;tk
rn}|jtjkrht	d|��q��nX|j
�tj|�dS(s=Remove the keyed message; raise KeyError if it doesn't exist.srb+sNo message with key: %sN(RRRjRRUR�R�R�R�R#RFR!(RR RR�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR!�s
cCstjj|jt|��}yt|d�}Wn;tk
rn}|jtjkrht	d|��qo�nXz�|j
r�t|�nzYtjtj|tj
tjB��|j||�t|t�r�|j||�nWd|j
r�t|�nXWdt|�XdS(s>Replace the keyed message; raise KeyError if it doesn't exist.srb+sNo message with key: %sN(RRRjRRUR�R�R�R�R#R�R�RFR�tO_TRUNCRbRIRRR�Rx(RR RRR�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR%�s$	
#	cCs1y^|jr6ttjj|jt|��d�}n'ttjj|jt|��d�}Wn;tk
r�}|jtj	kr�t
d|��q��nXzD|jr�t|�nzt|�}Wd|jr�t
|�nXWd|j�Xx<|j�j�D](\}}||kr|j|�qqW|S(s4Return a Message representation or raise a KeyError.sr+R�sNo message with key: %sN(R�R�RRRjRRUR�R�R�R#R�RR�RFt
get_sequencesR3tadd_sequence(RR R�R�R�Rwtkey_list((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR)�s(	*+	
	cCs�y^|jr6ttjj|jt|��d�}n'ttjj|jt|��d�}Wn;tk
r�}|jtj	kr�t
d|��q��nXzB|jr�t|�nz|j�SWd|jr�t
|�nXWd|j�XdS(s3Return a string representation or raise a KeyError.sr+R�sNo message with key: %sN(R�R�RRRjRRUR�R�R�R#R�RGR�RF(RR R�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR+s 	*+	
	cCssy+ttjj|jt|��d�}Wn;tk
rh}|jtjkrbt	d|��qi�nXt
|�S(s6Return a file-like representation or raise a KeyError.R�sNo message with key: %s(R�RRRjRRUR�R�R�R#R�(RR R�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR*s+cCs&ttd�tj|j�D���S(sReturn an iterator over keys.css'|]}|j�rt|�VqdS(N(tisdigitR�(t.0R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pys	<genexpr>+s(titerR�RR�R(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR,)scCs(tjjtjj|jt|���S(s9Return True if the keyed message exists, False otherwise.(RRRlRjRRU(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR5.scCstt|j���S(s*Return a count of messages in the mailbox.(R�R-R,(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR72scCsJ|jsFttjj|jd�d�|_t|j�t|_ndS(sLock the mailbox.s
.mh_sequencessrb+N(	R�R�RRRjRR�R�R>(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRD6s	$
cCs9|jr5t|j�t|j�|`t|_ndS(s#Unlock the mailbox if it is locked.N(R�R�R�RxR=(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRE=s
	

cCsdS(s&Write any pending changes to the disk.N((R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRCEscCs|jr|j�ndS(sFlush and close the mailbox.N(R�RE(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRFIs	cCs[g}xNtj|j�D]:}tjjtjj|j|��r|j|�qqW|S(sReturn a list of folder names.(RR�RRR�RjR�(RR9R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�Ns
$cCs+ttjj|j|�d|jdt�S(s+Return an MH instance for the named folder.RR(RRRRjRRR=(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�VscCs%ttjj|j|�d|j�S(s:Create a folder and return an MH instance representing it.R(RRRRjRR(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�[scCs�tjj|j|�}tj|�}|dgkrUtjtjj|d��n"|gkrdntd|j��tj|�dS(s-Delete the named folder, which must be empty.s
.mh_sequencessFolder not empty: %sN(RRRjRR�R!R�R�(RR�Rtentries((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�`scCsmi}ttjj|jd�d�}z4t|j��}x|D]}y�|jd�\}}t�}xo|j�D]a}|j�r�|j	t
|��qwd�|jd�D�\}	}
|jt|	|
d��qwWgt
|�D]}||kr�|^q�||<t||�dkr+||=nWqCtk
rUtd|j���qCXqCWWd	|j�X|S(
s=Return a name-to-key-list dictionary to define each sequence.s
.mh_sequencesR�Rfcss|]}t|�VqdS(N(R�(Rtx((s,/opt/alt/python27/lib64/python2.7/mailbox.pys	<genexpr>zst-iis"Invalid sequence specification: %sN(R�RRRjRtsetR.R}RRR�RBtrangeR�R�t
ValueErrortFormatErrortrstripRF(RtresultsR�tall_keysRaRwtcontentsR.tspecR�R�R ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRls,!
	
cCsettjj|jd�d�}z2tjtj|jtjtjB��x|j	�D]�\}}t
|�dkr{qWn|jd|�d
}t
}x�tt|��D]r}|d|kr�|st}|jd�qn7|rt
}|jd||f�n|jd|�|}q�W|rA|jt|�d	�qW|jd	�qWWWd
t|�Xd
S(s:Set sequences using the given name-to-key-list dictionary.s
.mh_sequencessr+is%s:iRs%s %ss %ss
N(R�RRRjRRFRwR�R
R3R�RRRVR=R�RR>RURx(Rt	sequencesR�RwR.tprevt
completingR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt
set_sequences�s.!&
c	Cs�|j�}d}g}x|j�D]�}|d|kr|j||df�ttd�r�tjtjj|jt	|��tjj|jt	|d���tj
tjj|jt	|���qtjtjj|jt	|��tjj|jt	|d���n|d7}q%W|d|_t
|�dkrEdSxS|j�D]E\}}x6|D].\}}||kre|||j|�<qeqeWqRW|j|�dS(s?Re-name messages to eliminate numbering gaps. Invalidates keys.iiRtN(RR,R�R<RRtRRjRRUtunlinkR�R�R�R4tindexR (	RRRtchangesR RwR
toldRh((s,/opt/alt/python27/lib64/python2.7/mailbox.pytpack�s*!#(!&
cCs�|j�}|j�}xU|j�D]G\}}||krM|j|�q%||kr%||j|�=q%q%Wx*|D]"}||krw|g||<qwqwW|j|�dS(s;Inspect a new MHMessage and update sequences appropriately.N(RR3R�R"R (RRR tpending_sequencest
all_sequencesRwR
tsequence((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s
N(RcRdReRVR>RRR!R%R)R+R*R,R5R7RDRERCRFR�R�R�R�RR R%R(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s.	"																			cBs�eZdZed�Zded�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�ZRS(sAn Rmail-style Babyl mailbox.tunseentdeletedtfiledtansweredt	forwardedteditedtresentcCs#tj||||�i|_dS(sInitialize a Babyl mailbox.N(R�Rt_labels(RRRR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�scCs;tj||�}t|t�r7|j�|j|<n|S(s$Add message and return assigned key.(R�RRIRt
get_labelsR0(RRR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�scCs0tj||�||jkr,|j|=ndS(s=Remove the keyed message; raise KeyError if it doesn't exist.N(R�R!R0(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR!�scCs<tj|||�t|t�r8|j�|j|<ndS(s>Replace the keyed message; raise KeyError if it doesn't exist.N(R�R%RIRR1R0(RR R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR%�sc	Cs}|j|�\}}|jj|�|jj�tj�}xXtr�|jj�}|dtjksu|dkryPn|j|j	tjd��qAWtj�}xTtr�|jj�}|tjks�|dkr�Pn|j|j	tjd��q�W|jj
||jj��j	tjd�}t|j
�|�}|j|j
��||jkry|j|j|�n|S(s4Return a Message representation or raise a KeyError.s*** EOOH ***RHs
(R�R�RORWRKR>RRQRRRPRGR�Rtgetvaluetset_visibleR0t
set_labels(	RR R�R�toriginal_headersRatvisible_headerstbodyR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR)�s,
	 	 %	cCs
|j|�\}}|jj|�|jj�tj�}xXtr�|jj�}|dtjksu|dkryPn|j|j	tjd��qAWx8tr�|jj�}|tjks�|dkr�Pq�q�W|j
�|jj||jj��j	tjd�S(s3Return a string representation or raise a KeyError.s*** EOOH ***RHs
(
R�R�RORWRKR>RRQRRRPR2RGR�(RR R�R�R5Ra((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR+s 
	 		%cCs%tj|j|�jdtj��S(s6Return a file-like representation or raise a KeyError.s
(RKR+RPRRQ(RR ((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR*scCsT|j�t�}x$|jj�D]}|j|�q#W|j|j�t|�S(s4Return a list of user-defined labels in the mailbox.(R�RR0R2RBtdifference_updatet_special_labelsR-(Rtlabelst
label_list((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR1s
	c	Cs�gg}}|jjd�d}g}x[tr�|}|jj�}|jj�}|dtjkrt|�t|�kr�|j|ttj��n|j|�g|jj�dj	d�D]$}|j
�dkr�|j
�^q�}|j|�q,|dks!|dtjkrYt|�t|�kr�|j|ttj��q�q,|dkr,|j|ttj��Pq,q,Wttt
||���|_tt|��|_t|j�|_|jjdd�|jj�|_dS(	s0Generate key-to-(start, stop) table of contents.isit,RHsiN(R�ROR>RWR�RRQR�R�R}tstripR�R�R�RoR0R�R�(	RRRRtlabel_listsRRatlabelR:((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�$s6
	
 $ cCs9|jdtjtjdj|j��tjf�dS(s,Called before writing the mailbox to file f.s(BABYL OPTIONS:%sVersion: 5%sLabels:%s%sR<N(RRRRQRjR1(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�Bs	cCs|jdtj�dS(s-Called before writing each message to file f.sN(RRRRQ(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�HscCs|jtjd�dS(s,Called after writing each message to file f.sN(RRRRQ(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�LscCs,|jj�}t|t�r�g}g}x@|j�D]2}||jkr\|j|�q7|j|�q7W|jjd�x"|D]}|jjd|�q�W|jjd�x&|D]}|jjd|d�q�W|jjtj	�n|jjdtj	�t|t
jj�rt
j
�}t
jj|td�}|j|�|jd�xQtr�|j�}|jj|jdtj	��|dks�|d	kr^Pq^q^W|jjd
tj	�t|t�rct
j
�}	t
jj|	td�}
|
j|j��x�tr_|	j�}|jj|jdtj	��|dksX|d	krPqqWna|jd�xQtr�|j�}|jj|jdtj	��|dks�|d	krsPqsqsWxLtr|jd�}|d	kr�Pn|jj|jdtj	��q�Wnt|t�r|jd�d
}|d
dkr�|jj|| jdtj	��|jjd
tj	�|jj|| jdtj	��|jj||jdtj	��q|jjd
tj	tj	�|jj|jdtj	��nt|d�r�|j�}
t}x�tr�|j�}|jj|jdtj	��|dkst|d	kr+|r�t}|jjd
tj	�|j|
�q�Pq+q+Wxatr�|jd�}|d	kr�Pn|jj|jdtj	��q�Wntdt|���|jj�}||fS(s0Write message contents and return (start, stop).t1s, s,,t R<s1,,is
RHs*** EOOH ***is

ii����RWsInvalid message type: %s(R�R�RIRR1R9R�RRRRQRJRRRKRLRMR=RNROR>RWRPtget_visibleRGRUR�R<RYRZ(RRR�tspecial_labelsR:R?torig_buffertorig_generatorRat
vis_buffert
vis_generatorR]t
body_starttoriginal_post
first_passR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�Ps�



		
		&

"		&(R)R*R+R,R-R.R/N(RcRdRet	frozensetR9RVR>RRR!R%R)R+R*R1R�R�R�R�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s 													cBs,eZdZdd�Zd�Zd�ZRS(s0Message with mailbox-format-specific properties.cCs�t|tjj�rM|jtj|��t|t�r�|j|�q�n�t|t�ru|jtj	|��n`t
|d�r�|jtj|��n8|dkr�tjjj
|�ntdt|���dS(sInitialize a Message instance.RGsInvalid message type: %sN(RIRJRRt_become_messagetcopytdeepcopyt_explain_toRUtmessage_from_stringR<tmessage_from_fileRVRRYRZ(RR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�scCs)x"d
D]}|j||j|<qWd	S(s0Assume the non-format-specific state of message.t_headerst	_unixfromt_payloadt_charsettpreambletepiloguetdefectst
_default_typeN(RRRSRTRURVRWRXRY(t__dict__(RRRw((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRL�s
cCs#t|t�rdStd��dS(s:Copy format-specific state to message insofar as possible.Ns Cannot convert to specified type(RIRRY(RR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRO�sN(RcRdReRVRRLRO(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s	cBs}eZdZd
d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�ZRS(s)Message with Maildir-specific properties.cCs5d|_d|_tj�|_tj||�dS(s%Initialize a MaildirMessage instance.RhRHN(t_subdirt_infoR�t_dateRR(RR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s		cCs|jS(sReturn 'new' or 'cur'.(R[(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRy�scCs8|dks|dkr$||_ntd|��dS(sSet subdir to 'new' or 'cur'.RhRis!subdir must be 'new' or 'cur': %sN(R[R(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��scCs%|jjd�r|jdSdSdS(s*Return as a string the flags that are set.s2,iRHN(R\RX(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt	get_flags�scCs ddjt|��|_dS(s)Set the given flags and unset all others.s2,RHN(RjR�R\(Rtflags((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt	set_flags�scCs0|jdjt|j��t|�B��dS(s.Set the given flag(s) without changing others.RHN(R`RjRR^(Rtflag((s,/opt/alt/python27/lib64/python2.7/mailbox.pytadd_flag�scCsE|j�dkrA|jdjt|j��t|���ndS(s7Unset the given string flag(s) without changing others.RHN(R^R`RjR(RRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pytremove_flag�scCs|jS(s<Return delivery date of message, in seconds since the epoch.(R](R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��scCs;yt|�|_Wn!tk
r6td|��nXdS(s9Set delivery date of message, in seconds since the epoch.scan't convert to float: %sN(tfloatR]RRY(Rtdate((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s
cCs|jS(s%Get the message's "info" as a string.(R\(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR{�scCs5t|t�r||_ntdt|���dS(s Set the message's "info" string.sinfo must be a string: %sN(RIRUR\RYRZ(Rtinfo((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�scCsXt|t�rK|j|j��|j|j��|j|j��n	t|t�r t	|j��}d|kr�|j
d�n|j�dkr�|j
d�nd|kr�|j
d�nd|kr�|j
d�nd|kr�|j
d�n|jd	tj
|j���n4t|t�r�t	|j��}d|kr]|jd
�nd|kry|jd�nd|krT|jd�qTn�t|t�r,t	|j��}d|kr�|jd
�nd|kr�|jd
�nd|kr
|jd�nd|krT|jd�qTn(t|t�r>ntdt|���dS(s;Copy Maildir-specific state to message insofar as possible.tStRRitOtTtDtFtAs
MAILER-DAEMONR)trepliedtflaggedR*R,tPR-s$Cannot convert to specified type: %sN(RIR	R`R^R�RyR�R�R�RRbR�R�R�RRRt	add_labelRRYRZ(RRR_((s,/opt/alt/python27/lib64/python2.7/mailbox.pyROsN"N(RcRdReRVRRyR�R^R`RbRcR�R�R{R�RO(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR	�s										R�cBs\eZdZd	d�Zd�Zd	d�Zd�Zd�Zd�Z	d�Z
d�ZRS(
s/Message with mbox- or MMDF-specific properties.cCsw|jdt�t|tjj�rc|j�}|dk	rc|jd�rc|j|d�qcntj	||�dS(s'Initialize an mboxMMDFMessage instance.s
MAILER-DAEMONsFrom iN(
R�R>RIRJRRR�RVRXR(RRtunixfrom((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR7scCs|jS(s Return contents of "From " line.(t_from(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�@scCsN|dk	rA|tkr'tj�}n|dtj|�7}n||_dS(s>Set "From " line, formatting and appending time_ if specified.RAN(RVR>R�R�R�Rs(RR�ttime_((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�Ds
cCs |jdd�|jdd�S(s*Return as a string the flags that are set.tStatusRHsX-Status(R((R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR^LscCst|�}d
\}}x4dD],}||kr||7}|j|�qqWx4dD],}||krV||7}|j|�qVqVW|djt|��7}y|jd|�Wn!tk
r�|jd|�nXy|jd|�Wn!tk
r|jd|�nXd	S(
s)Set the given flags and unset all others.RHRhRiRkRlRmRusX-StatusN(RHRH(RhRi(RkRlRm(RR!RjR�treplace_headerR#t
add_header(RR_tstatus_flagst
xstatus_flagsRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR`Ps&





cCs0|jdjt|j��t|�B��dS(s.Set the given flag(s) without changing others.RHN(R`RjRR^(RRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRbfscCsKd|ksd|krG|jdjt|j��t|���ndS(s7Unset the given string flag(s) without changing others.RusX-StatusRHN(R`RjRR^(RRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRcjscCs�t|t�rt|j��}d|kr=|jd�nd|krY|jd�nd|kru|jd�nd|kr�|jd�nd|kr�|jd�n|d	=|d
=dj|j�j�d�}y&|j	t
jtj
|d
���Wq�ttfk
rq�Xnlt|t�rU|j|j��|j|j��n4t|t�r�t|j��}d|kr�|jd�nd|kr�|jd�nd|kr�|jd�n|d	=|d
=n�t|t�rat|j��}d|kr|jd�nd|kr4|jd�nd|krP|jd�n|d	=|d
=n(t|t�rsntdt|���dS(sACopy mbox- or MMDF-specific state to message insofar as possible.RiRiRlRmRhRgRkRjtstatussx-statusRAi����s%a %b %d %H:%M:%S %YR)RnRoR*R,s$Cannot convert to specified type: %sN(RIR	RR^R�RbRjR�R}R�tcalendarttimegmR�tstrptimeRt
OverflowErrorR�R`R�RRRRqRRYRZ(RRR_t
maybe_date((s,/opt/alt/python27/lib64/python2.7/mailbox.pyROos^

N(RcRdReRVRR�R�R^R`RbRcRO(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�4s						cBseZdZRS(s&Message with mbox-specific properties.(RcRdRe(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR
�scBsGeZdZdd�Zd�Zd�Zd�Zd�Zd�Z	RS(s$Message with MH-specific properties.cCsg|_tj||�dS(s!Initialize an MHMessage instance.N(t
_sequencesRR(RR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s	cCs|jS(s4Return a list of sequences that include the message.(R�(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�scCst|�|_dS(s3Set the list of sequences that include the message.N(R-R�(RR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR �scCsNt|t�r4||jkrJ|jj|�qJntdt|���dS(s8Add sequence to list of sequences including the message.ssequence must be a string: %sN(RIRUR�R�RYRZ(RR(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�scCs,y|jj|�Wntk
r'nXdS(sARemove sequence from the list of sequences including the message.N(R�R!R(RR(((s,/opt/alt/python27/lib64/python2.7/mailbox.pytremove_sequence�s
cCs�t|t�r�t|j��}d|kr=|jd�n|jd�|jd�d|krs|jd�nd|kr�|jd�q�n?t|t�rt|j��}d|kr�|jd�n
|jd	�d|kr�|jd�nd|kr�|jd
�q�n�t|t�rMx�|j�D]}|j|�q3Wn�t|t	�r�t|j��}d|kr�|j
d�nd|kr�|j
d�q�n(t|t�r�ntdt
|���d
S(s6Copy MH-specific state to message insofar as possible.R)RiRgRoRlRnRhtRORiRmR,s$Cannot convert to specified type: %sN(RIR	RRR�RbR�RRRRqRRYRZ(RRRR(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRO�s@


N(
RcRdReRVRRR RR�RO(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s				cBsbeZdZd
d�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�ZRS(s'Message with Babyl-specific properties.cCs)g|_t�|_tj||�dS(s#Initialize a BabylMessage instance.N(R0Rt_visibleR(RR((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s	cCs|jS(s'Return a list of labels on the message.(R0(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR1�scCst|�|_dS(s&Set the list of labels on the message.N(R-R0(RR:((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR4�scCsNt|t�r4||jkrJ|jj|�qJntdt|���dS(s+Add label to list of labels on the message.slabel must be a string: %sN(RIRUR0R�RYRZ(RR?((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRq�scCs,y|jj|�Wntk
r'nXdS(s4Remove label from the list of labels on the message.N(R0R!R(RR?((s,/opt/alt/python27/lib64/python2.7/mailbox.pytremove_labels
cCs
t|j�S(s3Return a Message representation of visible headers.(RR�(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRB
scCst|�|_dS(s2Set the Message representation of visible headers.N(RR�(Rtvisible((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR3scCs�xG|jj�D]6}||kr<|jj|||�q|j|=qWx=dD]5}||krQ||jkrQ|||j|<qQqQWdS(	s9Update and/or sensibly generate a set of visible headers.tDatetFromsReply-TotTotCCtSubjectN(R�R�sReply-ToR�R�R�(R�R.Rv(Rtheader((s,/opt/alt/python27/lib64/python2.7/mailbox.pytupdate_visibles
cCst|t�r�t|j��}d|kr=|jd�n|jd�|jd�d|ksod|kr|jd�nd|kr�|jd�nd	|kr|jd
�qnRt|t�r?t|j��}d|kr�|jd�n
|jd�d	|kr |jd
�nd|kr|jd�qn�t|t�r�t|j��}d|kr||jd�nd|kr|jd�qnqt|t	�r�|j
|j��xL|j�D]}|j|�q�Wn(t|t
�r�ntdt|���dS(s9Copy Babyl-specific state to message insofar as possible.R)RiRgR-R/RpR,RhR*RjR�RiRkRmRns$Cannot convert to specified type: %sN(RIR	RR1R�RbR�RRRR3RBRqRRYRZ(RRR:R?((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRO sF


N(
RcRdReRVRR1R4RqR�RBR3R�RO(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s							cBseZdZRS(s&Message with MMDF-specific properties.(RcRdRe(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR
JsR�cBsneZdZdd�Zdd�Zdd�Zdd�Zd�Zd�Z	dd�Z
d	�Zd
�ZRS(sA read-only wrapper of a file.cCs4||_|dkr'|j�|_n	||_dS(sInitialize a _ProxyFile.N(R�RVR�t_pos(RR�tpos((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRQs	cCs|j||jj�S(sRead bytes.(t_readR�RG(Rtsize((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRGYscCs|j||jj�S(sRead a line.(R�R�RW(RR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRW]scCsWg}xJ|D]B}|j|�|dk	r
|t|�8}|dkrOPqOq
q
W|S(sRead multiple lines.iN(R�RVR�(RtsizehintR9Ra((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt	readlinesas

cCst|jd�S(sIterate over lines.RH(RRW(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR1lscCs|jS(sReturn the position.(R�(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�psicCsK|dkr"|jj|j�n|jj||�|jj�|_dS(sChange position.iN(R�ROR�R�(Rtoffsettwhence((s,/opt/alt/python27/lib64/python2.7/mailbox.pyROtscCs>t|d�r:t|jd�r1|jj�n|`ndS(sClose the file.R�RFN(R<R�RF(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRF{scCsJ|dkrd}n|jj|j�||�}|jj�|_|S(s"Read size bytes using read_method.i����N(RVR�ROR�R�(RR�tread_methodR9((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s	N(
RcRdReRVRRGRWR�R1R�RORFR�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�Ns			R�cBsDeZdZddd�Zd�Zdd�Zd�Zd�ZRS(s&A read-only wrapper of part of a file.cCs)tj|||�||_||_dS(sInitialize a _PartialFile.N(R�Rt_startt_stop(RR�R�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s	cCstj|�|jS(s*Return the position with respect to start.(R�R�R�(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��sicCsY|dkr!|j|_d}n!|dkrB|j|_d}ntj|||�dS(s8Change position, possibly with respect to start or stop.iiiN(R�R�R�R�RO(RR�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRO�s		cCs`|j|j}|dkr dS|dksD|dksD||krM|}ntj|||�S(s;Read size bytes using read_method, honoring start and stop.iRHN(R�R�RVR�R�(RR�R�t	remaining((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s$	cCst|d�r|`ndS(NR�(R<R�(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRF�sN(	RcRdReRVRR�ROR�RF(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s	
		cCst}y�tr�ytj|tjtjB�Wq�tk
r|}|jtjtjtj	fkrvt
d|j��q}�q�Xn|r�y!t|jd�}|j
�Wn5tk
r�}|jtjtj	fkr�dS�nXyfttd�r$tj|j|jd�t}tj|j�n tj|j|jd�t}Wq�tk
r�}|jtjks�tjdkr�|jtjkr�tj|j�t
d|j��q��q�XnWnCtr�tj|tj�n|r�tj|jd�n�nXdS(s(Lock file f using lockf and dot locking.slockf: lock unavailable: %ss.lockNRtR�sdot lock unavailable: %s(R=tfcntltlockftLOCK_EXtLOCK_NBR�R�tEAGAINR�R�R�RwR�RFR<RRtR>R!R�R�R�R!tLOCK_UN(R�R�tdotlock_doneR�tpre_lock((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��sL!

!cCsPtrtj|tj�ntjj|jd�rLtj|jd�ndS(s*Unlock file f using lockf and dot locking.s.lockN(R�R�R�RRRlRwR!(R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��scCsLtj|tjtjBtjBd�}zt|d�SWdtj|�XdS(sCCreate a file if it doesn't exist and open for reading and writing.i�srb+N(RR�R�RtO_RDWRRF(Rtfd((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s&cCs2td|ttj��tj�tj�f�S(sBCreate a temp file based on path and open for reading and writing.s%s.%s.%s.%s(R�R�R�R�R�RR�(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s	cCs3|j�ttd�r/tj|j��ndS(s0Ensure changes to file f are physically on disk.tfsyncN(RCR<RR�tfileno(R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s
cCst|�|j�dS(s:Close file f, ensuring all changes are physically on disk.N(R�RF(R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRx�s
t_MailboxcBs)eZejd�Zd�Zd�ZRS(cCs||_d|_||_dS(Ni(tfptseekpR(RR�R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRs		cCst|jd�S(N(RR�RV(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR1scCs�x�|jj|j�y|j�Wn$tk
rJ|jj�|_dSX|jj�}|j�|jj�|_}||krPqqW|jt	|j||��S(N(
R�ROR�t
_search_starttEOFErrorR�RVt_search_endRR�(RR�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s

(RcRdR�RRR1R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s	cBs>eZd�Zd�ZdZdZd�Zd�ZeZ	RS(cCskxd|jj�}|jj�}|s0t�n|d dkr|j|�r|jj|�dSqWdS(NisFrom (R�R�RWR�t_isrealfromlineRO(RR�Ra((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�!s	cCss|jj�x_|jj�}|jj�}|s8dS|d dkr|j|�r|jj|�dSqWdS(NisFrom (R�RWR�R�RO(RR�Ra((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�+s
saFrom \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*[^\s]*\s*$cCs=|js-ddl}|j|j�|_n|jj|�S(Ni����(t_regexptretcompilet_fromlinepatterntmatch(RRaR�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt_strict_isrealfromlineUs	cCstS(N(R>(RRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt_portable_isrealfromline[sN(
RcRdR�R�R�RVR�R�R�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRs	
	$		cBseZejZRS((RcRdRR�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRascBseZd�Zd�ZRS(cCs=x6|jj�}|s!t�n|d dkrdSqWdS(Nis
(R�RWR�(RRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�gs	cCsSxL|jj�}|jj�}|s+dS|dkr|jj|�dSqWdS(Ns
(R�R�RWRO(RR�Ra((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�os(RcRdR�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRes	cBs)eZejd�Zd�Zd�ZRS(cCs�ddl}|jd�}||_tj|j�}t|j|�}tt|�}|j	�tt
|�|_|jj�||_
dS(Ni����s
^[1-9][0-9]*$(R�R�RsRR�tfilterR�tmaptlongtsortRUtboxestreverseR(RRsRR�tpatR-((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR|s	

cCst|jd�S(N(RR�RV(R((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR1�scCst|js
dS|jj�}ttjj|j|��}|j|�}y
||_	Wnt
tfk
ronX|S(N(R�RVR:R�RRRjRsRt	_mh_msgnotAttributeErrorRY(RtfnR�R�((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s	
(RcRdR�RRR1R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRzs	cBseZd�Zd�ZRS(cCs9x2|jj�}|s!t�n|dkrdSqWdS(Ns
*** EOOH ***
(R�RWR�(RRa((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s	cCs_xX|jj�}|jj�}|s+dS|dksC|dkr|jj|�dSqWdS(Ns
s(R�R�RWRO(RR�Ra((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��s(RcRdR�R�(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s	tErrorcBseZdZRS(s"Raised for module-specific errors.(RcRdRe(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��sRncBseZdZRS(s:The specified mailbox does not exist and won't be created.(RcRdRe(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyRn�sR�cBseZdZRS(s>The specified mailbox is not empty and deletion was requested.(RcRdRe(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��sR�cBseZdZRS(s)Another process caused an action to fail.(RcRdRe(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR��sRcBseZdZRS(s)A file appears to have an invalid format.(RcRdRe(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyR�s(<RetsysRR�R{R�R�RMRJt
email.messagetemail.generatorRKtplatformtImportErrorR�RVtwarningstcatch_warningstpy3kwarningtfilterwarningstDeprecationWarningR�t__all__RRR�R�RRRRRRR	R�R
RRR
R�R�R>R�R�R�R�R�RxR�RRRRRt	ExceptionR�RnR�R�R(((s,/opt/alt/python27/lib64/python2.7/mailbox.pyt<module>s~	


	
	��C�84-�8� koF]>'-					
B"

Hacked By AnonymousFox1.0, Coded By AnonymousFox