Hacked By AnonymousFox

Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/mailbox.cpython-39.opt-2.pyc

a

R�f�3�@s:ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
Z
ddlZddlm
Z
zddlZWney�dZYn0gd�Zej�d�ZGdd�d�ZGdd�de�ZGd	d
�d
e�ZGdd�de�ZGd
d�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dejj�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Z Gdd �d e�Z!Gd!d"�d"e�Z"Gd#d$�d$�Z#Gd%d&�d&e#�Z$d>d(d)�Z%d*d+�Z&d,d-�Z'd.d/�Z(d0d1�Z)d2d3�Z*Gd4d5�d5e+�Z,Gd6d7�d7e,�Z-Gd8d9�d9e,�Z.Gd:d;�d;e,�Z/Gd<d=�d=e,�Z0dS)?�N)�GenericAlias)�Mailbox�Maildir�mbox�MH�Babyl�MMDF�Message�MaildirMessage�mboxMessage�	MHMessage�BabylMessage�MMDFMessage�Error�NoSuchMailboxError�
NotEmptyError�ExternalClashError�FormatError�asciic@seZdZdBdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdCdd�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.�ZdDd/d0�Zd1d2�ZdEd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?Z!dFd@dA�Z"e#e$�Z%dS)GrNTcCs tj�tj�|��|_||_dS�N)�os�path�abspath�
expanduser�_path�_factory��selfr�factory�create�r �,/opt/alt/python39/lib64/python3.9/mailbox.py�__init__%szMailbox.__init__cCstd��dS�Nz&Method must be implemented by subclass��NotImplementedError�r�messager r r!�add*szMailbox.addcCstd��dSr#r$�r�keyr r r!�remove.szMailbox.removecCs|�|�dSr)r+r)r r r!�__delitem__2szMailbox.__delitem__cCs&z|�|�Wnty Yn0dSr)r+�KeyErrorr)r r r!�discard5szMailbox.discardcCstd��dSr#r$�rr*r'r r r!�__setitem__<szMailbox.__setitem__cCs(z|�|�WSty"|YS0dSr)�__getitem__r-)rr*�defaultr r r!�get@szMailbox.getcCsN|js|�|�St�|�|���}|�|�Wd�S1s@0YdSr)r�get_message�
contextlib�closing�get_file)rr*�filer r r!r1Gs
zMailbox.__getitem__cCstd��dSr#r$r)r r r!r4OszMailbox.get_messagecCst�|�|����Sr��email�message_from_bytes�	get_bytesZ	as_stringr)r r r!�
get_stringSszMailbox.get_stringcCstd��dSr#r$r)r r r!r<ZszMailbox.get_bytescCstd��dSr#r$r)r r r!r7^szMailbox.get_filecCstd��dSr#r$�rr r r!�iterkeysbszMailbox.iterkeyscCst|���Sr)�listr?r>r r r!�keysfszMailbox.keysc	cs<|��D].}z||}Wnty.YqYn0|VqdSr�r?r-�rr*�valuer r r!�
itervaluesjs
zMailbox.itervaluescCs|��Sr)rEr>r r r!�__iter__sszMailbox.__iter__cCst|���Sr)r@rEr>r r r!�valuesvszMailbox.valuesc	cs@|��D]2}z||}Wnty.YqYn0||fVqdSrrBrCr r r!�	iteritemszs
zMailbox.iteritemscCst|���Sr)r@rHr>r r r!�items�sz
Mailbox.itemscCstd��dSr#r$r)r r r!�__contains__�szMailbox.__contains__cCstd��dSr#r$r>r r r!�__len__�szMailbox.__len__cCs|��D]}|�|�qdSr)rAr.r)r r r!�clear�sz
Mailbox.clearcCs2z||}Wnty"|YS0|�|�|Sr)r-r.)rr*r2�resultr r r!�pop�s

zMailbox.popcCs*|��D]}||�|�fStd��dS)NzNo messages in mailbox)r?rNr-r)r r r!�popitem�szMailbox.popitemc	Csrt|d�r|��}nt|d�r(|��}n|}d}|D],\}}z|||<Wq4ty^d}Yq40q4|rntd��dS)NrHrIFTzNo message with key(s))�hasattrrHrIr-)r�arg�sourceZbad_keyr*r'r r r!�update�s



zMailbox.updatecCstd��dSr#r$r>r r r!�flush�sz
Mailbox.flushcCstd��dSr#r$r>r r r!�lock�szMailbox.lockcCstd��dSr#r$r>r r r!�unlock�szMailbox.unlockcCstd��dSr#r$r>r r r!�close�sz
Mailbox.closecCs,z|�d�WSty&td��Yn0dS)Nrz?String input must be ASCII-only; use bytes or a Message instead)�encode�UnicodeError�
ValueErrorr&r r r!�_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�}|�
|�|j�r�|�t��s�|�
t�n�t|d��r�t|d��r2t�d	td�|j}d}|��}|�d
��r\|dd�d}n|�d��rx|dd
�d}|�s��q�|�r�|�d��r�d|dd�}|�dt�}|�
|�|}�q6|j�r�|�r�|�t��s�|�
t�ntdt|���dS)Nr�
�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 instead�
����
����From s>From ��Invalid message type: %s)�
isinstancer:r'r	�io�BytesIO�	generator�BytesGenerator�flatten�seekr_�replace�linesep�write�_append_newline�endswith�str�bytes�StringIO�warnings�warn�DeprecationWarning�getvaluer[rPr`�readline�
startswith�	TypeError�type)	rr'�targetZmangle_from_r`�gen�dataZlastline�liner r r!�
_dump_message�s\


�


�
zMailbox._dump_message)NT)N)N)N)F)&�__name__�
__module__�__qualname__r"r(r+r,r.r0r3r1r4r=r<r7r?rArErFrGrHrIrJrKrLrNrOrSrTrUrVrWr[rsr��classmethodr�__class_getitem__r r r r!r"sB

		
	

6rc@s�eZdZdZd5dd�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,Zd-d.�Zd/d0�Zd1d2�Zd3d4�ZdS)6r�: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|_dS)	N�tmp�new�cur)r�r�r��r)r�r�g�������?)rr"rr�joinr�_paths�exists�mkdirrGr�_toc�_toc_mtimes�
_last_read�_skewfactor)r�dirnamerrrr r r!r"s�
zMaildir.__init__c
Cs||��}z|�||�Wn(ty@|��t�|j��Yn0t|�t|t	�rz|�
�}|j|��}||jkr�d}nd}d}tj
�|j��|j�d}tj
�|j|||�}t|t	�r�t�|jtj
�|j�|��f�zJzt�|j|�Wn&ttf�yt�|j|�Yn0t�|j�WnPt�yv}z6t�|j�|jtjk�r`td|��n�WYd}~n
d}~00|S)N�r�rz$Name clash with existing message: %s)�_create_tmpr��
BaseExceptionrWrr+�name�_sync_closerir
�
get_subdir�colon�get_infor�basename�splitr�r�utime�getatime�get_date�link�AttributeError�PermissionError�rename�OSError�errnoZEEXISTr)rr'Ztmp_file�subdir�suffix�uniq�dest�er r r!r($sF


��zMaildir.addcCs t�tj�|j|�|���dSr)rr+rr�r�_lookupr)r r r!r+NszMaildir.removec	Cs*z|�|�Wnttfy$Yn0dSr)r+r-�FileNotFoundErrorr)r r r!r.RszMaildir.discardcCs�|�|�}|�|�}|�|�}t|t�r.|}n|}tj�|�}|j|vr`|j|�|j�d}nd}|�	|�tj�
|j|�}	tj�
|j|||�}
t|t�r�t�|	tj�
|	�|��f�t�|	|
�dS)Nrer�)r�r(rir
rrr�r�r�r.r�rr�r�r�r�)rr*r'Zold_subpathZtemp_keyZtemp_subpathZdominant_subpathr�r�Ztmp_path�new_pathr r r!r0Zs$






�zMaildir.__setitem__cCs�|�|�}ttj�|j|�d��*}|jr4|�|�}nt|�}Wd�n1sP0Ytj�|�\}}|�	|�|j
|vr�|�|�|j
�d�|�tj�
tj�|j|���|S)N�rbre)r��openrrr�rrr
r��
set_subdirr��set_info�set_date�getmtime)rr*Zsubpath�f�msgr�r�r r r!r4us
&

zMaildir.get_messagecCsPttj�|j|�|��d�� }|���td�Wd�S1sB0YdS)Nr�r\)	r�rrr�rr�r_rprq�rr*r�r r r!r<�szMaildir.get_bytescCs$ttj�|j|�|��d�}t|�S)Nr�)r�rrr�rr��
_ProxyFiler�r r r!r7�szMaildir.get_filec	csD|��|jD]0}z|�|�Wnty6YqYn0|VqdSr)�_refreshr�r�r-r)r r r!r?�s

zMaildir.iterkeyscCs|��||jvSr)r�r�r)r r r!rJ�szMaildir.__contains__cCs|��t|j�Sr)r��lenr�r>r r r!rK�szMaildir.__len__cCsdSrr r>r r r!rT�sz
Maildir.flushcCsdSrr r>r r r!rU�szMaildir.lockcCsdSrr r>r r r!rV�szMaildir.unlockcCsdSrr r>r r r!rW�sz
Maildir.closecCs\g}t�|j�D]F}t|�dkr|ddkrtj�tj�|j|��r|�|dd��q|S)N�r�.)r�listdirrr�r�isdirr��append�rrM�entryr r r!�list_folders�s�zMaildir.list_folderscCs ttj�|jd|�|jdd�S)Nr�F�rr)rrrr�rr�r�folderr r r!�
get_folder�s�zMaildir.get_foldercCs\tj�|jd|�}t||jd�}tj�|d�}tj�|�sXt�t�|tj	tj
Bd��|S)Nr��rZ
maildirfolder�)rrr�rrrr�rWr��O_CREAT�O_WRONLY)rr�rrMZmaildirfolder_pathr r r!�
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)Nr�r�r�r�rzFolder contains message(s): %sr�z%Folder contains subdirectory '%s': %sF)�topdown)rrr�rr�r�rr��walkr+�rmdir)rr�rr��root�dirs�filesr r r!�
remove_folder�s&���zMaildir.remove_foldercCsXt��}t�tj�|jd��D]4}tj�|jd|�}|tj�|�dkrt�|�qdS)Nr�i@�)�timerr�rr�rr�r+)r�nowr�rr r r!�clean�s
z
Maildir.cleanr�cCs�t��}t��}d|vr$|�dd�}d|vr8|�dd�}dt|�t|dd�t��tj|f}tj	�
|jd|�}zt�|�WnBt
y�tjd7_zt|�WYSty�Yn0Yn0td	|��dS)
N�/z\057r�z\072z%s.M%sP%sQ%s.%sr�g��.Ar�z&Name clash prevented file creation: %s)r��socket�gethostnamerp�intr�getpidr�_countrr�r�statr��_create_carefully�FileExistsErrorr)rr�Zhostnamer�rr r r!r��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)N�FTr)r�r�r�r�rrr�r�r�r�r�r�r�r�)rZrefreshr��mtimerr��pr�r r r!r�s&


zMaildir._refreshcCs|z.tj�tj�|j|j|��r,|j|WSWnty@Yn0|��z|j|WStyvtd|�d�Yn0dS�N�No message with key: %s)rrr�r�rr�r-r�r)r r r!r�&szMaildir._lookupcCsTt|d�s|��|_z|t|j�WSty8YdStyLYqYq0qdS)N�
_onetime_keys)rPr?r��next�
StopIterationr-r>r r r!r�4s

zMaildir.next)NT)r�r�r�r�r"r(r+r.r0r4r<r7r?rJrKrTrUrVrWr�r�r�r�r�r�r�r�r�r�r r r r!rs4
*
	
$rc@s�eZdZd#dd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd$dd �Zd!d"�ZdS)%�_singlefileMailboxNTc
Cs�t�||||�zt|jd�}Wnpty�}zX|jtjkrZ|rNt|jd�}q|t|j��n"|jtjtj	fvrzt|jd�}n�WYd}~n
d}~00||_
d|_d|_d|_
d|_d|_d|_dS)N�rb+zwb+r�rF)rr"r�rr�r��ENOENTr�EACCES�EROFS�_filer��	_next_key�_pending�
_pending_sync�_locked�_file_length)rrrrr�r�r r r!r"Ds$z_singlefileMailbox.__init__cCs8|��|�|�|j|j<|jd7_d|_|jdS)Nr�T)r��_append_messager�r�r�r&r r r!r([s
z_singlefileMailbox.addcCs|�|�|j|=d|_dS�NT)r�r�r�r)r r r!r+es
z_singlefileMailbox.removecCs$|�|�|�|�|j|<d|_dSr�)r�r�r�r�r/r r r!r0ks
z_singlefileMailbox.__setitem__ccs|��|j��EdHdSr)r�r�rAr>r r r!r?qsz_singlefileMailbox.iterkeyscCs|��||jvSr)r�r�r)r r r!rJvsz_singlefileMailbox.__contains__cCs|��t|j�Sr)r�r�r�r>r r r!rK{sz_singlefileMailbox.__len__cCs|jst|j�d|_dSr�)r��
_lock_filer�r>r r r!rU�s
z_singlefileMailbox.lockcCs|jrt|j�d|_dS�NF)r��_unlock_filer�r>r r r!rV�s
z_singlefileMailbox.unlockc
Cs�|js |jrt|j�d|_dS|j�dd�|j��}||jkrTtd|j|f��t|j	�}z�i}|�
|�t|j�
��D]x}|j|\}}|j�|�|�|�|��}|j�td||j����}|s�q�|�|�q�||��f||<|�|�q||��|_Wn"|��t�|j��Yn0t|�|j��t�|j	�j}	t�|j|	�zt�|j|j	�Wn0t�y�t�|j	�t�|j|j	�Yn0t|j	d�|_||_d|_d|_|j�r�t|jdd�dS)NFrr�z4Size of mailbox file changed (expected %i, found %i)�r�)�dotlock) r�r��_sync_flushr�ro�tellr�r�_create_temporaryr�_pre_mailbox_hook�sortedr�rA�_pre_message_hookr_�minrr�_post_message_hookrWrr+r�r�r��st_mode�chmodr�r�r�r�r�)
rZcur_lenZnew_fileZnew_tocr*�start�stopZ	new_startr`�moder r r!rT�s`
	

�



�
z_singlefileMailbox.flushcCsdSrr �rr�r r r!r�sz$_singlefileMailbox._pre_mailbox_hookcCsdSrr r
r r r!r�sz$_singlefileMailbox._pre_message_hookcCsdSrr r
r r r!r�sz%_singlefileMailbox._post_message_hookcCshz6|��Wz|jr|��W|j��qd|j��0n,z|jrH|��W|j��n|j��00dSr)rTr�rVr�rWr>r r r!rW�s

�
z_singlefileMailbox.closecCsL|jdur|��|durHz|j|WStyFtd|�d�Yn0dSr�)r��
_generate_tocr-r)r r r!r��s
z_singlefileMailbox._lookupcCs�|j�dd�|j��}t|j�dkr8|js8|�|j�z&|�|j�|�|�}|�	|j�Wn t
y~|j�|��Yn0|j��|j��|_
|S)Nrr�)r�ror�r�r�r�rr�_install_messagerr��truncaterTr�)rr'ZbeforeZoffsetsr r r!r��s


z"_singlefileMailbox._append_message)NT)N)r�r�r�r"r(r+r0r?rJrKrUrVrTrrrrWr�r�r r r r!r�As 

@

r�c@s>eZdZdZdd�Zddd�Zddd�Zdd	d
�Zdd�Zd
S)�	_mboxMMDFTcCsp|�|�\}}|j�|�|j���td�}|j�||j���}|�|�td��}|�	|dd��
d��|S)N�r\rgr)r�r�ror|rprqr_r��_message_factory�set_from�decode)rr*rr�	from_line�stringr�r r r!r4	sz_mboxMMDF.get_messageFcCst�|�||��j|d�S)N)�unixfromr9)rr*�from_r r r!r=s

��z_mboxMMDF.get_stringcCsJ|�|�\}}|j�|�|s(|j��|j�||j���}|�td�S�Nr\)r�r�ror|r_r�rprq)rr*rrrrr r r!r<s
z_mboxMMDF.get_bytescCs<|�|�\}}|j�|�|s(|j��t|j|j��|�Sr)r�r�ror|�_PartialFiler�)rr*rrrr r r!r7!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�|��}|dur�|�d�}|dur�dt
�t
�����}|j��}|j�|t�|�||j|j�|j��}||fS)Nrfr\rer�rrsFrom MAILER-DAEMON )rirur[rvr}�find�_mboxMMDFMessage�get_fromrXr:r'r	�get_unixfromr��asctime�gmtimer�r�rrrqr��
_mangle_from_)rr'r�newlineZauthorrrr r r!r)s0







z_mboxMMDF._install_messageN)F)F)F)	r�r�r�rr4r=r<r7rr r r r!rs


	
rc@s.eZdZdZdZd	dd�Zdd�Zdd�ZdS)
rTNcCst|_t�||||�dSr)rrrr"rr r r!r"Osz
mbox.__init__cCs|�t�dSr�rrrqr
r r r!rTszmbox._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)NFrrfT)r�ror�r|r}r�r�rq�dict�	enumerate�zipr�r�r�)r�starts�stopsZlast_was_empty�line_posr�r r r!rXs.






zmbox._generate_toc)NT)r�r�r�rrsr"rrr r r r!rFs

rc@s.eZdZddd�Zdd�Zdd�Zd	d
�ZdS)rNTcCst|_t�||||�dSr)rrrr"rr r r!r"}sz
MMDF.__init__cCs|�dt�dS�N�r!r
r r r!r�szMMDF._pre_message_hookcCs|�tdt�dSr(r!r
r r r!r�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)Nrr)r�)r�ror|r�r}rqr�r�r"r#r$r�r�r�)rr%r&�next_posr'r�r r r!r�s.






zMMDF._generate_toc)NT)r�r�r�r"rrrr r r r!rzs
rc@s�eZdZd/dd�Zdd�Zdd�Zd	d
�Zdd�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.�ZdS)0rNTcCstt�||||�tj�|j�sj|r`t�|jd�t�t�tj�	|jd�tj
tjBtjBd��n
t
|j��d|_dS)Nr��
.mh_sequencesi�F)rr"rrr�rr�rWr�r�r��O_EXCLr�rr�rr r r!r"�s�
zMH.__init__cCs�|��}t|�dkrd}nt|�d}tj�|jt|��}t|�}d}z�|j	rVt
|�zrz|�||�Wn8ty�|j	r�t
|�t|�d}t�|��Yn0t|t�r�|�||�W|j	r�t
|�n|j	r�t
|�0W|s�t|�n|s�t|�0|S)Nrr�FT)rAr��maxrrr�rrur�r�r�r�r�r�r�r+rir�_dump_sequences)rr'rAZnew_keyr�r��closedr r r!r(�s>


�
�
zMH.addc
Csztj�|jt|��}zt|d�}Wn@tyb}z(|jtjkrLt	d|��n�WYd}~nd}~00|�
�t�|�dS�Nr�r�)rrr�rrur�r�r�r�r-rWr+)rr*rr�r�r r r!r+�sz	MH.removec
Cs�tj�|jt|��}zt|d�}Wn@tyb}z(|jtjkrLt	d|��n�WYd}~n
d}~00zz|j
rtt|�zNt�t�|tj
tjB��|�||�t|t�r�|�||�W|j
r�t|�n|j
r�t|�0Wt|�n
t|�0dSr0)rrr�rrur�r�r�r�r-r�r�rWr��O_TRUNCr�rirr.r�r�)rr*r'rr�r�r r r!r0�s(

�zMH.__setitem__c
Csz@|jr$ttj�|jt|��d�}nttj�|jt|��d�}Wn@ty�}z(|jtj	krjt
d|��n�WYd}~n
d}~00|�J|jr�t|�zt|�}W|jr�t
|�n|jr�t
|�0Wd�n1s�0Y|����D]\}}||vr�|�|�q�|S)Nr�r�r�)r�r�rrr�rrur�r�r�r-r�rr��
get_sequencesrI�add_sequence)rr*r�r�r�r��key_listr r r!r4�s*

�(zMH.get_messagec
Cs�z@|jr$ttj�|jt|��d�}nttj�|jt|��d�}Wn@ty�}z(|jtj	krjt
d|��n�WYd}~n
d}~00|�`|jr�t|�z0|���
td�W|jr�t|�Wd�Sn|jr�t|�0Wd�n1s�0YdS)Nr�r�r�r\)r�r�rrr�rrur�r�r�r-r�r_rprqr��rr*r�r�r r r!r<s(��zMH.get_bytesc
Cshzttj�|jt|��d�}Wn@ty^}z(|jtjkrHt	d|��n�WYd}~n
d}~00t
|�S)Nr�r�)r�rrr�rrur�r�r�r-r�r5r r r!r7,szMH.get_filecCsttdd�t�|j�D���S)Ncss|]}|��rt|�VqdSr)�isdigitr�)�.0r�r r r!�	<genexpr>9s�zMH.iterkeys.<locals>.<genexpr>)�iterrrr�rr>r r r!r?7szMH.iterkeyscCstj�tj�|jt|���Sr)rrr�r�rrur)r r r!rJ<szMH.__contains__cCstt|����Sr)r�r@r?r>r r r!rK@sz
MH.__len__cCs2|js.ttj�|jd�d�|_t|j�d|_dS)Nr+r�T)r�r�rrr�rr�r�r>r r r!rUDs
zMH.lockcCs(|jr$t|j�t|j�|`d|_dSr�)r�r�r�r�r>r r r!rVKs


z	MH.unlockcCsdSrr r>r r r!rTSszMH.flushcCs|jr|��dSr)r�rVr>r r r!rWWszMH.closecCs<g}t�|j�D]&}tj�tj�|j|��r|�|�q|Sr)rr�rrr�r�r�r�r r r!r�\s
zMH.list_folderscCsttj�|j|�|jdd�S)NFr��rrrr�rrr�r r r!r�ds�z
MH.get_foldercCsttj�|j|�|jd�S)Nr�r:r�r r r!r�is�z
MH.add_foldercCs`tj�|j|�}t�|�}|dgkr:t�tj�|d��n|gkrDntd|j��t�|�dS)Nr+zFolder not empty: %s)rrr�rr�r+rr�)rr�r�entriesr r r!r�ns

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�||=Wq0ty�td
|����Yq00q0Wd�n1�s
0Y|S)Nr+�r�ASCII��encodingr�css|]}t|�VqdSr)r�)r7�xr r r!r8�rz#MH.get_sequences.<locals>.<genexpr>�-r�csg|]}|�vr|�qSr r )r7r*�Zall_keysr r!�
<listcomp>�s�z$MH.get_sequences.<locals>.<listcomp>rz"Invalid sequence specification: %s)r�rrr�r�setrAr�r6r(r�rS�rangerr�rZr�rstrip)
rZresultsr�r�r��contentsrA�specrrr rBr!r2zs(
�.zMH.get_sequencescCs
ttj�|jd�ddd�}z�t�t�|jtjtjB��|�	�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@Wt|�n
t|�0dS)Nr+zr+r=r>rr�Fr�TrAz%s %sz %s�
)r�rrr�rrWr�r�r1rIr�rrrrDrur�)r�	sequencesr�r�rA�prevZ
completingr*r r r!�
set_sequences�s.zMH.set_sequencesc	
Cs<|��}d}g}|��D]�}|d|kr�|�||df�z4t�tj�|jt|��tj�|jt|d���WnFt	t
fy�t�tj�|jt|��tj�|jt|d���Yn0t�tj�|jt|���|d7}q|d|_
t|�dkr�dS|��D]0\}}|D]"\}}||v�r|||�|�<�qq�|�|�dS)Nrr�)r2r?r�rr�rr�rrur�r�r��unlinkr�r�rI�indexrL)	rrJrKZchangesr*r�r4�oldr�r r r!�pack�s0��



zMH.packcCst|��}|��}|��D]0\}}||vr4|�|�q||vr||�|�=q|D]}||vrN|g||<qN|�|�dSr)r2rIr�rNrL)rr'r*Zpending_sequencesZ
all_sequencesr�r4�sequencer r r!r.�szMH._dump_sequences)NT)r�r�r�r"r(r+r0r4r<r7r?rJrKrUrVrTrWr�r�r�r�r2rLrPr.r r r r!r�s,
"rc@s�eZdZehd��Zddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�ZdS)r>�	forwarded�deletedZedited�resentZfiled�unseen�answeredNTcCst�||||�i|_dSr)r�r"�_labelsrr r r!r"�szBabyl.__init__cCs(t�||�}t|t�r$|��|j|<|Sr)r�r(rir
�
get_labelsrW)rr'r*r r r!r(�s
z	Babyl.addcCs"t�||�||jvr|j|=dSr)r�r+rWr)r r r!r+�s
zBabyl.removecCs*t�|||�t|t�r&|��|j|<dSr)r�r0rir
rXrWr/r r r!r0�s
zBabyl.__setitem__c
Cs�|�|�\}}|j�|�|j��t��}|j��}|dtks\|sHq\|�|�td��q,t��}|j��}|tks�|s|q�|�|�td��qd||j�	�}|j�
|�}|�td�}t|��|�}	|	�
|���||jvr�|	�|j|�|	S�N�*** EOOH ***r\)r�r�ror|rjrkrqrrrpr�r_r
r{�set_visiblerW�
set_labels)
rr*rr�original_headersr�Zvisible_headers�n�bodyr�r r r!r4�s*



zBabyl.get_messagec	Cs�|�|�\}}|j�|�|j��t��}|j��}|dtks\|sHq\|�|�td��q,|j��}|tksv|s\qvq\|�	�}||j�
�}|j�|�}|�td�}||SrY)r�r�ror|rjrkrqrrrpr{r�r_)	rr*rrr]r�Zheadersr^r�r r r!r<s 


zBabyl.get_bytescCst�|�|��dt��Sr)rjrkr<rprqr)r r r!r7(szBabyl.get_filecCs<|��t�}|j��D]}|�|�q|�|j�t|�Sr)r�rDrWrGrS�difference_update�_special_labelsr@)r�labelsZ
label_listr r r!rX,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)	NrscSsg|]}|��r|���qSr )�strip�r7�labelr r r!rCCs�z'Babyl._generate_toc.<locals>.<listcomp>r��,�r�)r�ror|r�rqr�r�r�r"r#r$r�rWr�r�)rr%r&r*Zlabel_listsr'r�rbr r r!r5s4



�zBabyl._generate_toccCsVdt}|dt7}|��}dd�|D�}|dd�|�t7}|d7}|�|�dS)NsBABYL OPTIONS:s
Version: 5css|]}|��VqdSr)rXrdr r r!r8Xrz*Babyl._pre_mailbox_hook.<locals>.<genexpr>sLabels:rfrg)rqrXr�rr)rr�Zbabylrbr r r!rSszBabyl._pre_mailbox_hookcCs|�dt�dS)N�r!r
r r r!r]szBabyl._pre_message_hookcCs|�td�dS)Nrgr!r
r r r!raszBabyl._post_message_hookcCsx|j��}t|t�r�g}g}|��D]$}||jvr>|�|�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	k�s,|s��q,q�|j�d
t	�t|t��r�t
��}	t
j�|	dd�}
|
�|���|	��}|j�|�d	t	��|d	k�s�|�sn�q�qnn>|�d�|��}|j�|�d	t	��|d	k�s�|�s��q�q�|�d�}|�s��qf|j�|�d	t	���q�nTt|ttt
jf��rt|t
j��rJt�dtd
�|��}t|t��r`|�|�}|�d�d}|ddk�r�|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	k�s�|�sF|�r�d}|j�d
t	�|�|
�n�qڐqF|��}|�s�qf|�"d��r
|dd�t	}n:|�"d��r(|dd�t	}n|�"d	��rD|dd�t	}|j�|��q�nt#dt$|���|j��}||fS)N�1s, s,,� rfs1,,Frr\rZr�r]r^s

r�rer|r`raTrbrcrdrh)%r�r�rir
rXrar�rrrXrqr:r'r	rjrkrlrmrnror|rp�get_visibler_rvrurwrxryrzr{r[rrPr`rtr~r)rr'rZspecial_labelsrbreZorig_bufferZorig_generatorr�Z
vis_bufferZ
vis_generatorr`Z
body_startZoriginal_posZ
first_passrr r r!res�







�
�
zBabyl._install_message)NT)r�r�r��	frozensetrar"r(r+r0r4r<r7rXrrrrrr r r r!r�s
	
rc@s&eZdZddd�Zdd�Zdd�ZdS)	r	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(|dur�tjj�|�ntdt|���dS)Nr_rh)rir:r'r	�_become_message�copyZdeepcopy�_explain_torvr;ruZmessage_from_stringrj�
TextIOWrapperZmessage_from_filerPZmessage_from_binary_filer"r~rr&r r r!r"�s



zMessage.__init__cCs4t|dg�}|jD]}||vr|j||j|<qdS)N�_type_specific_attributes)�getattr�__dict__)rr'Z
type_specificr�r r r!rm�s
zMessage._become_messagecCst|t�rdStd��dS)Nz Cannot convert to specified type)rir	r~r&r r r!ro�s
zMessage._explain_to)N)r�r�r�r"rmror r r r!r	�s
r	c@sveZdZgd�Zddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)r
)�_subdir�_info�_dateNcCs&d|_d|_t��|_t�||�dS)Nr�r�)rtrur�rvr	r"r&r r r!r"�s
zMaildirMessage.__init__cCs|jSr)rtr>r r r!r�szMaildirMessage.get_subdircCs(|dks|dkr||_ntd|��dS)Nr�r�z!subdir must be 'new' or 'cur': %s)rtrZ)rr�r r r!r�szMaildirMessage.set_subdircCs"|j�d�r|jdd�SdSdS)N�2,r�r�)rur}r>r r r!�	get_flags
szMaildirMessage.get_flagscCsdd�t|��|_dS)Nrwr�)r�rru)r�flagsr r r!�	set_flagsszMaildirMessage.set_flagscCs$|�d�t|���t|�B��dS�Nr��rzr�rDrx�r�flagr r r!�add_flagszMaildirMessage.add_flagcCs,|��r(|�d�t|���t|���dSr{)rxrzr�rDr}r r r!�remove_flagszMaildirMessage.remove_flagcCs|jSr)rvr>r r r!r�!szMaildirMessage.get_datecCs4zt|�|_Wn ty.td|�d�Yn0dS)Nzcan't convert to float: %s)�floatrvrZr~)r�dater r r!r�%szMaildirMessage.set_datecCs|jSr)rur>r r r!r�,szMaildirMessage.get_infocCs&t|t�r||_ntdt|���dS)Nzinfo must be a string: %s)rirurur~r)r�infor r r!r�0s
zMaildirMessage.set_infocCs�t|t�r8|�|���|�|���|�|����nht|t�r�t	|���}d|vr`|�
d�|��dkrv|�
d�d|vr�|�
d�d|vr�|�
d�d|vr�|�
d�|�d	t�
|����n�t|t��rt	|���}d|vr�|�d
�d|v�r|�d�d|v�r�|�d�n�t|t��r�t	|���}d|v�rD|�d
�d|v�rX|�d
�d|v�rl|�d�d|v�r�|�d�nt|t��r�ntdt|���dS)N�S�Rr��O�T�D�F�A�
MAILER-DAEMONrU�replied�flaggedrSrV�PrR�$Cannot convert to specified type: %s)rir
rzrxr�r�r�r�rrDrrr�rrr3r
�	add_labelr	r~r)rr'ryr r r!ro7sP

















�zMaildirMessage._explain_to)N)r�r�r�rqr"r�r�rxrzrr�r�r�r�r�ror r r r!r
�s
r
c@sVeZdZdgZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)r�_fromNcCsV|�dd�t|tjj�rF|��}|durF|�d�rF|�|dd��t�||�dS)Nr�TzFrom rg)rrir:r'r	rr}r")rr'rr r r!r"hsz_mboxMMDFMessage.__init__cCs|jSr)r�r>r r r!rqsz_mboxMMDFMessage.get_fromcCs4|dur*|durt��}|dt�|�7}||_dS)NT� )r�rrr�)rrZtime_r r r!rus
z_mboxMMDFMessage.set_fromcCs|�dd�|�dd�S)N�Statusr��X-Status)r3r>r r r!rx}sz_mboxMMDFMessage.get_flagscCs�t|�}d\}}dD]}||vr||7}|�|�qdD]}||vr8||7}|�|�q8|d�t|��7}z|�d|�Wnty�|�d|�Yn0z|�d|�Wnty�|�d|�Yn0dS)N)r�r�)r�r�)r�r�r�r�r�r�)rDr+r�r�replace_headerr-Z
add_header)rryZstatus_flagsZ
xstatus_flagsr~r r r!rz�s&z_mboxMMDFMessage.set_flagscCs$|�d�t|���t|�B��dSr{r|r}r r r!r�sz_mboxMMDFMessage.add_flagcCs4d|vsd|vr0|�d�t|���t|���dS)Nr�r�r�r|r}r r r!r��sz_mboxMMDFMessage.remove_flagc	Cs�t|t�r�t|���}d|vr(|�d�d|vr:|�d�d|vrL|�d�d|vr^|�d�d|vrp|�d�|d	=|d
=d�|����dd��}z|�	t
�t�
|d
���Wnttfy�Yn0�n
t|t�r�|�|���|�|���n�t|t��rXt|���}d|v�r"|�d�d|v�r6|�d�d|v�rJ|�d�|d	=|d
=n�t|t��r�t|���}d|v�r�|�d�d|v�r�|�d�d|v�r�|�d�|d	=|d
=nt|t��r�ntdt|���dS)Nr�r�r�r�r�r�r�r�Zstatuszx-statusr����z%a %b %d %H:%M:%S %YrUr�r�rSrVr�)rir
rDrxr�rr�rr�r��calendarZtimegmr��strptimerZ�
OverflowErrorrrzrrr3r
r�r	r~r)rr'ryZ
maybe_dater r r!ro�sb





�













�z_mboxMMDFMessage._explain_to)N)N)r�r�r�rqr"rrrxrzrr�ror r r r!rcs
	
rc@seZdZdS)rN�r�r�r�r r r r!r�src@sDeZdZdgZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)r�
_sequencesNcCsg|_t�||�dSr)r�r	r"r&r r r!r"�szMHMessage.__init__cCs|jdd�Sr)r�r>r r r!r2�szMHMessage.get_sequencescCst|�|_dSr)r@r�)rrJr r r!rL�szMHMessage.set_sequencescCs6t|t�r"||jvr2|j�|�ntdt|���dS)Nzsequence type must be str: %s)rirur�r�r~r�rrQr r r!r3�s

zMHMessage.add_sequencecCs(z|j�|�Wnty"Yn0dSr)r�r+rZr�r r r!�remove_sequence�szMHMessage.remove_sequencecCsFt|t�rdt|���}d|vr*|�d�n|�d�|�d�d|vrP|�d�d|vrb|�d�n�t|t�r�t|���}d|vr�|�d�n
|�d	�d|vr�|�d�d|vr�|�d
�n�t|t�r�|��D]}|�|�q�n`t|t	��r$t|���}d|v�r|�
d�d|v�rB|�
d�nt|t��r2ntdt
|���dS)
NrUr�r�r�r�r�r��ROr�r�rVr�)rir
rDr2r�rrrr3r
r�r	r~r)rr'rJrQr r r!ro�sB










�zMHMessage._explain_to)N)
r�r�r�rqr"r2rLr3r�ror r r r!r�s
rc@s^eZdZddgZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�ZdS)r
rW�_visibleNcCsg|_t�|_t�||�dSr)rWr	r�r"r&r r r!r"%szBabylMessage.__init__cCs|jdd�Sr)rWr>r r r!rX+szBabylMessage.get_labelscCst|�|_dSr)r@rW)rrbr r r!r\/szBabylMessage.set_labelscCs6t|t�r"||jvr2|j�|�ntdt|���dS)Nzlabel must be a string: %s)rirurWr�r~r�rrer r r!r�3s

zBabylMessage.add_labelcCs(z|j�|�Wnty"Yn0dSr)rWr+rZr�r r r!�remove_label;szBabylMessage.remove_labelcCs
t|j�Sr�r	r�r>r r r!rkBszBabylMessage.get_visiblecCst|�|_dSrr�)rZvisibler r r!r[FszBabylMessage.set_visiblecCsb|j��D](}||vr*|j�|||�q
|j|=q
dD]$}||vr8||jvr8|||j|<q8dS)N)ZDateZFromzReply-ToZToZCCZSubject)r�rAr�)r�headerr r r!�update_visibleJs
zBabylMessage.update_visiblecCsrt|t�r~t|���}d|vr*|�d�n|�d�|�d�d|vsNd|vrX|�d�d|vrj|�d�d	|vr||�d
�n�t|t�r�t|���}d|vr�|�d�n
|�d�d	|vr�|�d
�d|vr�|�d�n�t|t��rt|���}d|v�r|�d�d|v�rn|�d�nTt|t	��rP|�
|���|��D]}|�|��q<nt|t
��r^ntdt|���dS)NrUr�r�rRrTr�rVr�rSr�r�r�r�r�r�r�)rir
rDrXr�rrrr3r
r[rkr�r	r~r)rr'rbrer r r!roUsH










�zBabylMessage._explain_to)N)
r�r�r�rqr"rXr\r�r�rkr[r�ror r r r!r
 s
r
c@seZdZdS)rNr�r r r r!rsrc@s�eZdZd%dd�Zd&dd�Zd'dd�Zd(dd	�Zd)d
d�Zdd
�Zdd�Z	d*dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd �Zd!d"�Zed#d$��Zee�ZdS)+r�NcCs$||_|dur|��|_n||_dSr)r�r��_pos)rr��posr r r!r"�sz_ProxyFile.__init__cCs|�||jj�Sr)�_readr�r_�r�sizer r r!r_�sz_ProxyFile.readcCs|�||jj�Sr)r�r��read1r�r r r!r��sz_ProxyFile.read1cCs|�||jj�Sr)r�r�r|r�r r r!r|�sz_ProxyFile.readlinecCs<g}|D].}|�|�|dur|t|�8}|dkrq8q|S)Nr)r�r�)r�sizehintrMr�r r r!�	readlines�s
z_ProxyFile.readlinesccs|��}|sdS|VqdSr)r|)rr�r r r!rF�sz_ProxyFile.__iter__cCs|jSr)r�r>r r r!r��sz_ProxyFile.tellrcCs4|dkr|j�|j�|j�||�|j��|_dS)Nr��r�ror�r��r�offset�whencer r r!ro�sz_ProxyFile.seekcCs4t|d�r0zt|jd�r"|j��W|`n|`0dS)Nr�rW)rPr�rWr>r r r!rW�s

z_ProxyFile.closecCs2|durd}|j�|j�||�}|j��|_|S)Nrer�)rr��read_methodrMr r r!r��sz_ProxyFile._readcCs|Srr r>r r r!�	__enter__�sz_ProxyFile.__enter__cGs|��dSr)rW)r�excr r r!�__exit__�sz_ProxyFile.__exit__cCs
|j��Sr)r��readabler>r r r!r��sz_ProxyFile.readablecCs
|j��Sr)r��writabler>r r r!r��sz_ProxyFile.writablecCs
|j��Sr)r��seekabler>r r r!r��sz_ProxyFile.seekablecCs
|j��Sr)r�rTr>r r r!rT�sz_ProxyFile.flushcCs&t|d�sdSt|jd�sdS|jjS)Nr�Tr/F)rPr�r/r>r r r!r/�s

z_ProxyFile.closed)N)N)N)N)N)r)r�r�r�r"r_r�r|r�rFr�rorWr�r�r�r�r�r�rT�propertyr/r�rr�r r r r!r��s&





		
r�c@s8eZdZd
dd�Zdd�Zddd�Zd	d
�Zdd�ZdS)rNcCst�|||�||_||_dSr)r�r"�_start�_stop)rr�rrr r r!r"�sz_PartialFile.__init__cCst�|�|jSr)r�r�r�r>r r r!r��sz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}t�|||�dS)Nrr�r�)r�r�r�r�ror�r r r!ro�sz_PartialFile.seekcCsB|j|j}|dkrdS|dus0|dks0||kr4|}t�|||�S)Nrr)r�r�r�r�)rr�r�Z	remainingr r r!r��sz_PartialFile._readcCst|d�r|`dS)Nr�)rPr�r>r r r!rWs
z_PartialFile.close)NN)r)r�r�r�r"r�ror�rWr r r r!r�s



	rTc
Cs�d}�zftrrzt�|tjtjB�WnLtyp}z4|jtjtjtjfvrZt	d|j
��n�WYd}~n
d}~00|�rjzt|j
d�}|��WnHty�}z0|jtjtjfvr�WYd}~WdS�WYd}~n
d}~00z^zt
�|j
|j
d�d}Wn0ttf�y*t
�|j
|j
d�d}Yn0t
�|j
�Wn.t�yht
�|j
�t	d|j
��Yn0Wn8t�r�t�|tj�|�r�t
�|j
d��Yn0dS)NFzlockf: lock unavailable: %s�.lockTzdot lock unavailable: %s)�fcntl�lockfZLOCK_EXZLOCK_NBr�r�ZEAGAINr�r�rr�r�rWrr�r�r�r�rMr�r+�LOCK_UN)r�r�Zdotlock_doner�Zpre_lockr r r!r�sL�
�r�cCs8trt�|tj�tj�|jd�r4t�|jd�dS)Nr�)r�r�r�rrr�r�r+�r�r r r!r�9sr�c	CsDt�|tjtjBtjBd�}zt|d�Wt�|�St�|�0dS)Nr�r�)rr�r�r,�O_RDWRrW)r�fdr r r!r�@s

�r�cCs$td|tt���t��t��f�S)Nz%s.%s.%s.%s)r�r�r�r�r�rr�)rr r r!r�Hs�r�cCs$|��ttd�r t�|���dS)N�fsync)rTrPrr��filenor�r r r!r�Ns
r�cCst|�|��dSr)r�rWr�r r r!r�Tsr�c@seZdZdS)rNr�r r r r!rZsrc@seZdZdS)rNr�r r r r!r]src@seZdZdS)rNr�r r r r!r`src@seZdZdS)rNr�r r r r!rcsrc@seZdZdS)rNr�r r r r!rfsr)T)1rr�r�r�r�rnrxr:Z
email.messageZemail.generatorrjr5�typesrr��ImportError�__all__rqrXrrr�rrrrrr'r	r
rrrr
rr�rr�r�r�r�r�r��	Exceptionrrrrrr r r r!�<module>	sj
j8DB4-3z%mqH_e'
*

Hacked By AnonymousFox1.0, Coded By AnonymousFox