Your IP : 18.191.240.249


Current Path : /lib64/python2.7/
Upload File :
Current File : //lib64/python2.7/mailbox.pyo

�
�mec@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/usr/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/usr/lib64/python2.7/mailbox.pytadd2scCstd��dS(s=Remove the keyed message; raise KeyError if it doesn't exist.s&Method must be implemented by subclassN(R(Rtkey((s/usr/lib64/python2.7/mailbox.pytremove6scCs|j|�dS(N(R!(RR ((s/usr/lib64/python2.7/mailbox.pyt__delitem__:scCs)y|j|�Wntk
r$nXdS(s'If the keyed message exists, remove it.N(R!tKeyError(RR ((s/usr/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/usr/lib64/python2.7/mailbox.pyt__setitem__DscCs*y|j|�SWntk
r%|SXdS(s9Return the keyed message, or default if it doesn't exist.N(t__getitem__R#(RR tdefault((s/usr/lib64/python2.7/mailbox.pytgetHs
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/usr/lib64/python2.7/mailbox.pyR&Os	
cCstd��dS(s4Return a Message representation or raise a KeyError.s&Method must be implemented by subclassN(R(RR ((s/usr/lib64/python2.7/mailbox.pyR)VscCstd��dS(s3Return a string representation or raise a KeyError.s&Method must be implemented by subclassN(R(RR ((s/usr/lib64/python2.7/mailbox.pyt
get_stringZscCstd��dS(s6Return a file-like representation or raise a KeyError.s&Method must be implemented by subclassN(R(RR ((s/usr/lib64/python2.7/mailbox.pyR*^scCstd��dS(sReturn an iterator over keys.s&Method must be implemented by subclassN(R(R((s/usr/lib64/python2.7/mailbox.pytiterkeysbscCst|j��S(sReturn a list of keys.(tlistR,(R((s/usr/lib64/python2.7/mailbox.pytkeysfsccsEx>|j�D]0}y||}Wntk
r7q
nX|Vq
WdS(s%Return an iterator over all messages.N(R,R#(RR tvalue((s/usr/lib64/python2.7/mailbox.pyt
itervaluesjs
cCs
|j�S(N(R0(R((s/usr/lib64/python2.7/mailbox.pyt__iter__sscCst|j��S(s,Return a list of messages. Memory intensive.(R-R0(R((s/usr/lib64/python2.7/mailbox.pytvaluesvsccsKxD|j�D]6}y||}Wntk
r7q
nX||fVq
WdS(s.Return an iterator over (key, message) tuples.N(R,R#(RR R/((s/usr/lib64/python2.7/mailbox.pyt	iteritemszs
cCst|j��S(s9Return a list of (key, message) tuples. Memory intensive.(R-R3(R((s/usr/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/usr/lib64/python2.7/mailbox.pythas_key�scCs
|j|�S(N(R5(RR ((s/usr/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/usr/lib64/python2.7/mailbox.pyt__len__�scCs(x!|j�D]}|j|�q
WdS(sDelete all messages.N(R,R$(RR ((s/usr/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/usr/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/usr/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/usr/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/usr/lib64/python2.7/mailbox.pytflush�scCstd��dS(sLock the mailbox.s&Method must be implemented by subclassN(R(R((s/usr/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/usr/lib64/python2.7/mailbox.pytunlock�scCstd��dS(sFlush and close the mailbox.s&Method must be implemented by subclassN(R(R((s/usr/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/usr/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/usr/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/usr/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|||�}yLttd�r,tj|j|�tj|j�ntj|j|�WnKtk
r�}tj|j�|jtjkr�td|��q��nXt|t	�r�tj|tj
j|�|j�f�n|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_infoRtbasenametsplitRjRR<RttrenametOSErrorterrnotEEXISTtExternalClashErrortutimetgetatimetget_date(RRttmp_filetsubdirtsuffixtuniqtdestte((s/usr/lib64/python2.7/mailbox.pyR
s>


%
+cCs,tjtjj|j|j|���dS(s=Remove the keyed message; raise KeyError if it doesn't exist.N(RR!RRjRt_lookup(RR ((s/usr/lib64/python2.7/mailbox.pyR!2scCsSy|j|�Wn;tk
r$n+tk
rN}|jtjkrO�qOnXdS(s'If the keyed message exists, remove it.N(R!R#RR�tENOENT(RR R�((s/usr/lib64/python2.7/mailbox.pyR$6s
c
Cs|j|�}|j|�}|j|�}t|t�rE|}n|}tjj|�}|j|kr�|j|j|j�d}nd}|j	|�tjj
|j|||�}	tjtjj
|j|�|	�t|t�rtj
|	tjj|	�|j�f�ndS(s>Replace the keyed message; raise KeyError if it doesn't exist.i����RHN(R�RRIR	RRRsRzR}R$RjRR~R�R�R�(
RR Rtold_subpathttemp_keyttemp_subpathtdominant_subpathR�R�tnew_path((s/usr/lib64/python2.7/mailbox.pyR%As 	 
"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/usr/lib64/python2.7/mailbox.pyR)Xs!	
 +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/usr/lib64/python2.7/mailbox.pyR+js*cCs4ttjj|j|j|��d�}t|�S(s6Return a file-like representation or raise a KeyError.trb(R�RRRjRR�t
_ProxyFile(RR R�((s/usr/lib64/python2.7/mailbox.pyR*rs*ccsO|j�x>|jD]3}y|j|�Wntk
rAqnX|VqWdS(sReturn an iterator over keys.N(t_refreshRoR�R#(RR ((s/usr/lib64/python2.7/mailbox.pyR,ws

cCs|j�||jkS(s9Return True if the keyed message exists, False otherwise.(R�Ro(RR ((s/usr/lib64/python2.7/mailbox.pyR5�s
cCs|j�t|j�S(s*Return a count of messages in the mailbox.(R�tlenRo(R((s/usr/lib64/python2.7/mailbox.pyR7�s
cCsdS(s"Write any pending changes to disk.N((R((s/usr/lib64/python2.7/mailbox.pyRC�scCsdS(sLock the mailbox.N((R((s/usr/lib64/python2.7/mailbox.pyRD�scCsdS(s#Unlock the mailbox if it is locked.N((R((s/usr/lib64/python2.7/mailbox.pyRE�scCsdS(sFlush and close the mailbox.N((R((s/usr/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/usr/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/usr/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/usr/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/usr/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�RRjRR�R!(RtnowR�R((s/usr/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_countRRjRtstatRR�R�t_create_carefullyR�R�(RR�thostnameR�RR�((s/usr/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/usr/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/usr/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/usr/lib64/python2.7/mailbox.pyR�!s	

( RcRdReRztrfc822RR>RRR!R$R%R)R+R*R,R5R7RCRDRERFR�R�R�R�R�R�RuR�R�R�(((s/usr/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/usr/lib64/python2.7/mailbox.pyR1s$						cCsF|j�|j|�|j|j<|jd7_t|_|jdS(s$Add message and return assigned key.i(R�t_append_messageRoR�R>R�(RR((s/usr/lib64/python2.7/mailbox.pyRHs

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

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/usr/lib64/python2.7/mailbox.pyR%Xs
ccs-|j�x|jj�D]}|VqWdS(sReturn an iterator over keys.N(R�RoR.(RR ((s/usr/lib64/python2.7/mailbox.pyR,^s
cCs|j�||jkS(s9Return True if the keyed message exists, False otherwise.(R�Ro(RR ((s/usr/lib64/python2.7/mailbox.pyR5ds
cCs|j�t|j�S(s*Return a count of messages in the mailbox.(R�R�Ro(R((s/usr/lib64/python2.7/mailbox.pyR7is
cCs&|js"t|j�t|_ndS(sLock the mailbox.N(R�t
_lock_fileR�R>(R((s/usr/lib64/python2.7/mailbox.pyRDns	
cCs&|jr"t|j�t|_ndS(s#Unlock the mailbox if it is locked.N(R�t_unlock_fileR�R=(R((s/usr/lib64/python2.7/mailbox.pyREts	
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~RR�R�R�R�R�R�(Rtcur_lentnew_filetnew_tocR tstarttstopt	new_startR]tmodeR�((s/usr/lib64/python2.7/mailbox.pyRCzsd		
	

	


!				cCsdS(s,Called before writing the mailbox to file f.N((RR�((s/usr/lib64/python2.7/mailbox.pyR��scCsdS(s-Called before writing each message to file f.N((RR�((s/usr/lib64/python2.7/mailbox.pyR��scCsdS(s,Called after writing each message to file f.N((RR�((s/usr/lib64/python2.7/mailbox.pyR��scCs1|j�|jr |j�n|jj�dS(sFlush and close the mailbox.N(RCR�RER�RF(R((s/usr/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/usr/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/usr/lib64/python2.7/mailbox.pyR��s

N(RcRdReRVR>RRR!R%R,R5R7RDRERCR�R�R�RFR�R�(((s/usr/lib64/python2.7/mailbox.pyR�.s"	
								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/usr/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/usr/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/usr/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/usr/lib64/python2.7/mailbox.pyR�s&
	(
RcRdReR>R�R)R=R+R*R�(((s/usr/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/usr/lib64/python2.7/mailbox.pyR3s	cCs|jtj�dS(s,Called after writing each message to file f.N(RRRRQ(RR�((s/usr/lib64/python2.7/mailbox.pyR�8scCs\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/usr/lib64/python2.7/mailbox.pyR�<s0
	
	
	
N(
RcRdReR>R�RSRVRR�R�(((s/usr/lib64/python2.7/mailbox.pyR*s	cBs8eZdZded�Zd�Zd�Zd�ZRS(sAn MMDF mailbox.cCs#t|_tj||||�dS(sInitialize an MMDF mailbox.N(R
R�R�R(RRRR((s/usr/lib64/python2.7/mailbox.pyRas	cCs|jdtj�dS(s-Called before writing each message to file f.sN(RRRRQ(RR�((s/usr/lib64/python2.7/mailbox.pyR�fscCs|jtjdtj�dS(s,Called after writing each message to file f.sN(RRRRQ(RR�((s/usr/lib64/python2.7/mailbox.pyR�jscCsbgg}}|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�(RR�Rtnext_posRRa((s/usr/lib64/python2.7/mailbox.pyR�ns2
	
	
N(	RcRdReRVR>RR�R�R�(((s/usr/lib64/python2.7/mailbox.pyR^s
		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/usr/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/usr/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/usr/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/usr/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/usr/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/usr/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/usr/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/usr/lib64/python2.7/mailbox.pys	<genexpr>!s(titerR�RR�R(R((s/usr/lib64/python2.7/mailbox.pyR,scCs(tjjtjj|jt|���S(s9Return True if the keyed message exists, False otherwise.(RRRlRjRRU(RR ((s/usr/lib64/python2.7/mailbox.pyR5$scCstt|j���S(s*Return a count of messages in the mailbox.(R�R-R,(R((s/usr/lib64/python2.7/mailbox.pyR7(scCsJ|jsFttjj|jd�d�|_t|j�t|_ndS(sLock the mailbox.s
.mh_sequencessrb+N(	R�R�RRRjRR�R�R>(R((s/usr/lib64/python2.7/mailbox.pyRD,s	$
cCs9|jr5t|j�t|j�|`t|_ndS(s#Unlock the mailbox if it is locked.N(R�R�R�RxR=(R((s/usr/lib64/python2.7/mailbox.pyRE3s
	

cCsdS(s&Write any pending changes to the disk.N((R((s/usr/lib64/python2.7/mailbox.pyRC;scCs|jr|j�ndS(sFlush and close the mailbox.N(R�RE(R((s/usr/lib64/python2.7/mailbox.pyRF?s	cCs[g}xNtj|j�D]:}tjjtjj|j|��r|j|�qqW|S(sReturn a list of folder names.(RR�RRR�RjR�(RR9R�((s/usr/lib64/python2.7/mailbox.pyR�Ds
$cCs+ttjj|j|�d|jdt�S(s+Return an MH instance for the named folder.RR(RRRRjRRR=(RR�((s/usr/lib64/python2.7/mailbox.pyR�LscCs%ttjj|j|�d|j�S(s:Create a folder and return an MH instance representing it.R(RRRRjRR(RR�((s/usr/lib64/python2.7/mailbox.pyR�QscCs�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/usr/lib64/python2.7/mailbox.pyR�Vs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/usr/lib64/python2.7/mailbox.pys	<genexpr>pst-iis"Invalid sequence specification: %sN(R�RRRjRtsetR.R}R
RR�RBtrangeR�R�t
ValueErrortFormatErrortrstripRF(RtresultsR�tall_keysRaRwtcontentsR.tspecR�R�R ((s/usr/lib64/python2.7/mailbox.pyR
bs,!
	
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/usr/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(R
R,R�R<RRtRRjRRUtunlinkR~R�R�R4tindexR(	RRRtchangesR RwRtoldRh((s/usr/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(R
R3R�R!R(RRR tpending_sequencest
all_sequencesRwRtsequence((s/usr/lib64/python2.7/mailbox.pyR�s
N(RcRdReRVR>RRR!R%R)R+R*R,R5R7RDRERCRFR�R�R�R�R
RR$R(((s/usr/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/usr/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_labelsR/(RRR ((s/usr/lib64/python2.7/mailbox.pyR�scCs0tj||�||jkr,|j|=ndS(s=Remove the keyed message; raise KeyError if it doesn't exist.N(R�R!R/(RR ((s/usr/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R0R/(RR R((s/usr/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_visibleR/t
set_labels(	RR R�R�toriginal_headersRatvisible_headerstbodyR�((s/usr/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>RRQRRRPR1RGR�(RR R�R�R4Ra((s/usr/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/usr/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�RR/R2RBtdifference_updatet_special_labelsR-(Rtlabelst
label_list((s/usr/lib64/python2.7/mailbox.pyR0s
	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�RoR/R�R�(	RR�RRtlabel_listsRRatlabelR9((s/usr/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(RRRRQRjR0(RR�((s/usr/lib64/python2.7/mailbox.pyR�8s	cCs|jdtj�dS(s-Called before writing each message to file f.sN(RRRRQ(RR�((s/usr/lib64/python2.7/mailbox.pyR�>scCs|jtjd�dS(s,Called after writing each message to file f.sN(RRRRQ(RR�((s/usr/lib64/python2.7/mailbox.pyR�BscCs,|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R0R8R�RRRRQRJRRRKRLRMR=RNROR>RWRPtget_visibleRGRUR�R<RYRZ(RRR�tspecial_labelsR9R>torig_buffertorig_generatorRat
vis_buffert
vis_generatorR]t
body_starttoriginal_post
first_passR�((s/usr/lib64/python2.7/mailbox.pyR�Fs�



		
		&

"		&(R(R)R*R+R,R-R.N(RcRdRet	frozensetR8RVR>RRR!R%R)R+R*R0R�R�R�R�R�(((s/usr/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/usr/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(RQRRRSRTRURVRWRX(t__dict__(RRRw((s/usr/lib64/python2.7/mailbox.pyRK�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/usr/lib64/python2.7/mailbox.pyRN�sN(RcRdReRVRRKRN(((s/usr/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/usr/lib64/python2.7/mailbox.pyR�s		cCs|jS(sReturn 'new' or 'cur'.(RZ(R((s/usr/lib64/python2.7/mailbox.pyRy�scCs8|dks|dkr$||_ntd|��dS(sSet subdir to 'new' or 'cur'.RhRis!subdir must be 'new' or 'cur': %sN(RZR(RR�((s/usr/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/usr/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/usr/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/usr/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(RR`((s/usr/lib64/python2.7/mailbox.pytremove_flag�scCs|jS(s<Return delivery date of message, in seconds since the epoch.(R\(R((s/usr/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/usr/lib64/python2.7/mailbox.pyR��s
cCs|jS(s%Get the message's "info" as a string.(R[(R((s/usr/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/usr/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�RRaR�R�R�RRRt	add_labelRRYRZ(RRR^((s/usr/lib64/python2.7/mailbox.pyRN�sN"N(RcRdReRVRRyR�R]R_RaRbR�R�R{R�RN(((s/usr/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/usr/lib64/python2.7/mailbox.pyR-scCs|jS(s Return contents of "From " line.(t_from(R((s/usr/lib64/python2.7/mailbox.pyR�6scCsN|dk	rA|tkr'tj�}n|dtj|�7}n||_dS(s>Set "From " line, formatting and appending time_ if specified.R@N(RVR>R�R�R�Rr(RR�ttime_((s/usr/lib64/python2.7/mailbox.pyR�:s
cCs |jdd�|jdd�S(s*Return as a string the flags that are set.tStatusRHsX-Status(R((R((s/usr/lib64/python2.7/mailbox.pyR]BscCst|�}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.RHRgRhRjRkRlRtsX-StatusN(RHRH(RgRh(RjRkRl(RR!RjR�treplace_headerR#t
add_header(RR^tstatus_flagst
xstatus_flagsR`((s/usr/lib64/python2.7/mailbox.pyR_Fs&





cCs0|jdjt|j��t|�B��dS(s.Set the given flag(s) without changing others.RHN(R_RjRR](RR`((s/usr/lib64/python2.7/mailbox.pyRa\scCsKd|ksd|krG|jdjt|j��t|���ndS(s7Unset the given string flag(s) without changing others.RtsX-StatusRHN(R_RjRR](RR`((s/usr/lib64/python2.7/mailbox.pyRb`scCs�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.RhRiRkRlRgRfRjRitstatussx-statusR@i����s%a %b %d %H:%M:%S %YR(RmRnR)R+s$Cannot convert to specified type: %sN(RIR	RR]R�RaRjR�R}R�tcalendarttimegmR�tstrptimeRt
OverflowErrorR�R_R�RRRRpRRYRZ(RRR^t
maybe_date((s/usr/lib64/python2.7/mailbox.pyRNes^

N(RcRdReRVRR�R�R]R_RaRbRN(((s/usr/lib64/python2.7/mailbox.pyR�*s						cBseZdZRS(s&Message with mbox-specific properties.(RcRdRe(((s/usr/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/usr/lib64/python2.7/mailbox.pyR�s	cCs|jS(s4Return a list of sequences that include the message.(R(R((s/usr/lib64/python2.7/mailbox.pyR
�scCst|�|_dS(s3Set the list of sequences that include the message.N(R-R(RR((s/usr/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(RIRURR�RYRZ(RR'((s/usr/lib64/python2.7/mailbox.pyR�scCs,y|jj|�Wntk
r'nXdS(sARemove sequence from the list of sequences including the message.N(RR!R(RR'((s/usr/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(RiRfRnRkRmRgtRORhRlR+s$Cannot convert to specified type: %sN(RIR	RR
R�RaR�RRRRpRRYRZ(RRRR'((s/usr/lib64/python2.7/mailbox.pyRN�s@


N(
RcRdReRVRR
RRR�RN(((s/usr/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 an BabylMessage instance.N(R/Rt_visibleR(RR((s/usr/lib64/python2.7/mailbox.pyR�s	cCs|jS(s'Return a list of labels on the message.(R/(R((s/usr/lib64/python2.7/mailbox.pyR0�scCst|�|_dS(s&Set the list of labels on the message.N(R-R/(RR9((s/usr/lib64/python2.7/mailbox.pyR3�scCsNt|t�r4||jkrJ|jj|�qJntdt|���dS(s+Add label to list of labels on the message.slabel must be a string: %sN(RIRUR/R�RYRZ(RR>((s/usr/lib64/python2.7/mailbox.pyRp�scCs,y|jj|�Wntk
r'nXdS(s4Remove label from the list of labels on the message.N(R/R!R(RR>((s/usr/lib64/python2.7/mailbox.pytremove_label�s
cCs
t|j�S(s3Return a Message representation of visible headers.(RR�(R((s/usr/lib64/python2.7/mailbox.pyRAscCst|�|_dS(s2Set the Message representation of visible headers.N(RR�(Rtvisible((s/usr/lib64/python2.7/mailbox.pyR2scCs�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�sCCR�(R�R.Ru(Rtheader((s/usr/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(RiRfR,R.RoR+RgR)RiR�RhRjRlRms$Cannot convert to specified type: %sN(RIR	RR0R�RaR�RRRR2RARpRRYRZ(RRR9R>((s/usr/lib64/python2.7/mailbox.pyRNsF


N(
RcRdReRVRR0R3RpR�RAR2R�RN(((s/usr/lib64/python2.7/mailbox.pyR�s							cBseZdZRS(s&Message with MMDF-specific properties.(RcRdRe(((s/usr/lib64/python2.7/mailbox.pyR
@sR�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/usr/lib64/python2.7/mailbox.pyRGs	cCs|j||jj�S(sRead bytes.(t_readR�RG(Rtsize((s/usr/lib64/python2.7/mailbox.pyRGOscCs|j||jj�S(sRead a line.(R�R�RW(RR�((s/usr/lib64/python2.7/mailbox.pyRWSscCsWg}xJ|D]B}|j|�|dk	r
|t|�8}|dkrOPqOq
q
W|S(sRead multiple lines.iN(R�RVR�(RtsizehintR9Ra((s/usr/lib64/python2.7/mailbox.pyt	readlinesWs

cCst|jd�S(sIterate over lines.RH(RRW(R((s/usr/lib64/python2.7/mailbox.pyR1bscCs|jS(sReturn the position.(R�(R((s/usr/lib64/python2.7/mailbox.pyR�fsicCsK|dkr"|jj|j�n|jj||�|jj�|_dS(sChange position.iN(R�ROR�R�(Rtoffsettwhence((s/usr/lib64/python2.7/mailbox.pyROjscCs>t|d�r:t|jd�r1|jj�n|`ndS(sClose the file.R�RFN(R<R�RF(R((s/usr/lib64/python2.7/mailbox.pyRFqscCsJ|dkrd}n|jj|j�||�}|jj�|_|S(s"Read size bytes using read_method.i����N(RVR�ROR�R�(RR�tread_methodR9((s/usr/lib64/python2.7/mailbox.pyR�xs	N(
RcRdReRVRRGRWR�R1R�RORFR�(((s/usr/lib64/python2.7/mailbox.pyR�Ds			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/usr/lib64/python2.7/mailbox.pyR�s	cCstj|�|jS(s*Return the position with respect to start.(R�R�R�(R((s/usr/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/usr/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/usr/lib64/python2.7/mailbox.pyR��s$	cCst|d�r|`ndS(NR�(R<R�(R((s/usr/lib64/python2.7/mailbox.pyRF�sN(	RcRdReRVRR�ROR�RF(((s/usr/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~RR�R!tLOCK_UN(R�R�tdotlock_doneR�tpre_lock((s/usr/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/usr/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/usr/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/usr/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/usr/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/usr/lib64/python2.7/mailbox.pyRx�s
t_MailboxcBs)eZejd�Zd�Zd�ZRS(cCs||_d|_||_dS(Ni(tfptseekpR(RR�R((s/usr/lib64/python2.7/mailbox.pyR�s		cCst|jd�S(N(RR�RV(R((s/usr/lib64/python2.7/mailbox.pyR1scCs�x�|jj|j�y|j�Wn$tk
rJ|jj�|_dSX|jj�}|j�|jj�|_}||krPqq|jt	|j||��S(N(
R�ROR�t
_search_starttEOFErrorR�RVt_search_endRR�(RR�R�((s/usr/lib64/python2.7/mailbox.pyR�s

(RcRdR�RRR1R�(((s/usr/lib64/python2.7/mailbox.pyR��s	cBs>eZd�Zd�ZdZdZd�Zd�ZeZ	RS(cCsjxc|jj�}|jj�}|s0t�n|d dkr|j|�r|jj|�dSqdS(NisFrom (R�R�RWR�t_isrealfromlineRO(RR�Ra((s/usr/lib64/python2.7/mailbox.pyR�s	cCsr|jj�x^|jj�}|jj�}|s8dS|d dkr|j|�r|jj|�dSqdS(NisFrom (R�RWR�R�RO(RR�Ra((s/usr/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/usr/lib64/python2.7/mailbox.pyt_strict_isrealfromlineKs	cCstS(N(R>(RRa((s/usr/lib64/python2.7/mailbox.pyt_portable_isrealfromlineQsN(
RcRdR�R�R�RVR�R�R�R�(((s/usr/lib64/python2.7/mailbox.pyRs	
	$		cBseZejZRS((RcRdRR�R�(((s/usr/lib64/python2.7/mailbox.pyRWscBseZd�Zd�ZRS(cCs<x5|jj�}|s!t�n|d dkrdSqdS(Nis
(R�RWR�(RRa((s/usr/lib64/python2.7/mailbox.pyR�]s	cCsRxK|jj�}|jj�}|s+dS|dkr|jj|�dSqdS(Ns
(R�R�RWRO(RR�Ra((s/usr/lib64/python2.7/mailbox.pyR�es(RcRdR�R�(((s/usr/lib64/python2.7/mailbox.pyR[s	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/usr/lib64/python2.7/mailbox.pyRrs	

cCst|jd�S(N(RR�RV(R((s/usr/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/usr/lib64/python2.7/mailbox.pyR��s	
(RcRdR�RRR1R�(((s/usr/lib64/python2.7/mailbox.pyRps	cBseZd�Zd�ZRS(cCs8x1|jj�}|s!t�n|dkrdSqdS(Ns
*** EOOH ***
(R�RWR�(RRa((s/usr/lib64/python2.7/mailbox.pyR��s	cCs^xW|jj�}|jj�}|s+dS|dksC|dkr|jj|�dSqdS(Ns
s(R�R�RWRO(RR�Ra((s/usr/lib64/python2.7/mailbox.pyR��s(RcRdR�R�(((s/usr/lib64/python2.7/mailbox.pyR�s	tErrorcBseZdZRS(s"Raised for module-specific errors.(RcRdRe(((s/usr/lib64/python2.7/mailbox.pyR��sRncBseZdZRS(s:The specified mailbox does not exist and won't be created.(RcRdRe(((s/usr/lib64/python2.7/mailbox.pyRn�sR�cBseZdZRS(s>The specified mailbox is not empty and deletion was requested.(RcRdRe(((s/usr/lib64/python2.7/mailbox.pyR��sR�cBseZdZRS(s)Another process caused an action to fail.(RcRdRe(((s/usr/lib64/python2.7/mailbox.pyR��sRcBseZdZRS(s)A file appears to have an invalid format.(RcRdRe(((s/usr/lib64/python2.7/mailbox.pyR�s(<RetsysRR�RzR�R�RLRJt
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/usr/lib64/python2.7/mailbox.pyt<module>s~	

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