MMCT TEAM
Server IP : 103.53.40.154  /  Your IP : 18.189.170.227
Web Server : Apache
System : Linux md-in-35.webhostbox.net 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : ppcad7no ( 715)
PHP Version : 8.2.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /../lib64/fipscheck/../python3.6/__pycache__/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //../lib64/fipscheck/../python3.6/__pycache__/mailbox.cpython-36.opt-2.pyc
3


 \ 3�@sNddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
Z
ddlZyddlZWne
k
r�dZYnXdddddddd	d
ddd
dddddgZejjd�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�dejj�ZGdd	�d	e�ZGd d!�d!e�ZGd"d
�d
e�ZGd#d�de�ZGd$d�de�ZGd%d
�d
e�Z Gd&d'�d'�Z!Gd(d)�d)e!�Z"d<d+d,�Z#d-d.�Z$d/d0�Z%d1d2�Z&d3d4�Z'd5d6�Z(Gd7d�de)�Z*Gd8d�de*�Z+Gd9d�de*�Z,Gd:d�de*�Z-Gd;d�de*�Z.dS)=�N�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"dS)GrNTcCs tjjtjj|��|_||_dS)N)�os�path�abspath�
expanduser�_path�_factory)�selfr�factory�create�r�/usr/lib64/python3.6/mailbox.py�__init__$szMailbox.__init__cCstd��dS)Nz&Method must be implemented by subclass)�NotImplementedError)r�messagerrr�add)szMailbox.addcCstd��dS)Nz&Method must be implemented by subclass)r )r�keyrrr�remove-szMailbox.removecCs|j|�dS)N)r$)rr#rrr�__delitem__1szMailbox.__delitem__cCs(y|j|�Wntk
r"YnXdS)N)r$�KeyError)rr#rrr�discard4szMailbox.discardcCstd��dS)Nz&Method must be implemented by subclass)r )rr#r!rrr�__setitem__;szMailbox.__setitem__cCs$y
|j|�Stk
r|SXdS)N)�__getitem__r&)rr#�defaultrrr�get?s
zMailbox.getc	Cs6|js|j|�Stj|j|���}|j|�SQRXdS)N)r�get_message�
contextlib�closing�get_file)rr#�filerrrr)Fs
zMailbox.__getitem__cCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrrr,NszMailbox.get_messagecCstj|j|��j�S)N)�email�message_from_bytes�	get_bytes�	as_string)rr#rrr�
get_stringRszMailbox.get_stringcCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrrr3YszMailbox.get_bytescCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrrr/]szMailbox.get_filecCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�iterkeysaszMailbox.iterkeyscCst|j��S)N)�listr6)rrrr�keyseszMailbox.keysccs@x:|j�D].}y||}Wntk
r0w
YnX|Vq
WdS)N)r6r&)rr#�valuerrr�
itervaluesiszMailbox.itervaluescCs|j�S)N)r:)rrrr�__iter__rszMailbox.__iter__cCst|j��S)N)r7r:)rrrr�valuesuszMailbox.valuesccsDx>|j�D]2}y||}Wntk
r0w
YnX||fVq
WdS)N)r6r&)rr#r9rrr�	iteritemsyszMailbox.iteritemscCst|j��S)N)r7r=)rrrr�items�sz
Mailbox.itemscCstd��dS)Nz&Method must be implemented by subclass)r )rr#rrr�__contains__�szMailbox.__contains__cCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�__len__�szMailbox.__len__cCs x|j�D]}|j|�q
WdS)N)r8r')rr#rrr�clear�sz
Mailbox.clearcCs0y||}Wntk
r |SX|j|�|S)N)r&r')rr#r*�resultrrr�pop�s
zMailbox.popcCs*x$|j�D]}||j|�fSWtd��dS)NzNo messages in mailbox)r6rCr&)rr#rrr�popitem�szMailbox.popitemcCsxt|d�r|j�}nt|d�r(|j�}n|}d}x6|D].\}}y|||<Wq6tk
rbd}Yq6Xq6W|rttd��dS)Nr=r>FTzNo message with key(s))�hasattrr=r>r&)r�arg�sourceZbad_keyr#r!rrr�update�s



zMailbox.updatecCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�flush�sz
Mailbox.flushcCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�lock�szMailbox.lockcCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�unlock�szMailbox.unlockcCstd��dS)Nz&Method must be implemented by subclass)r )rrrr�close�sz
Mailbox.closecCs,y
|jd�Stk
r&td��YnXdS)Nrz?String input must be ASCII-only; use bytes or a Message instead)�encode�UnicodeError�
ValueError)rr!rrr�_string_to_bytes�s
zMailbox._string_to_bytesFc	Cst|tjj�rxtj�}tjj||d�}|j|�|j	d�|j
�}|jdt�}|j
|�|jrt|jt�rt|j
t��n�t|tttjf��rt|tj�r�tjdtd�|j�}t|t�r�|j|�}|r�|jdd�}|jdt�}|j
|�|jo�|jt��r�|j
t�n�t|d��r�t|d��r4tjd	td�|j}d}x�|j�}|jd
��r`|dd�d}n|jd��r||dd�d}|�s�P|�r�|jd��r�d|dd�}|jdt�}|j
|�|}�q:W|j�r�|�r�|jt��r�|j
t�ntdt|���dS)Nr�
z8Use of StringIO input is deprecated, use BytesIO instead�s
From s
>From �read�bufferzDUse of text mode files is deprecated, use a binary mode file insteads
��
�sFrom s>From �zInvalid message type: %s������)�
isinstancer1r!r�io�BytesIO�	generator�BytesGenerator�flatten�seekrS�replace�linesep�write�_append_newline�endswith�str�bytes�StringIO�warnings�warn�DeprecationWarning�getvaluerPrErT�readline�
startswith�	TypeError�type)	rr!�targetZmangle_from_rT�gen�dataZlastline�linerrr�
_dump_message�sZ







zMailbox._dump_message)NT)N)N)N)F)#�__name__�
__module__�__qualname__rr"r$r%r'r(r+r)r,r5r3r/r6r8r:r;r<r=r>r?r@rArCrDrHrIrJrKrLrPrervrrrrr!s@

		
	
c@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�tj||||�tjj|jd�tjj|jd�tjj|jd�d�|_tjj|j�s�|r�tj|jd�x*|jj	�D]}tj|d�qnWn
t
|j��i|_ddd�|_d|_
d|_dS)	N�tmp�new�cur)r{r|r}i�r)r}r|g�������?)rrrr�joinr�_paths�exists�mkdirr<r�_toc�_toc_mtimes�
_last_read�_skewfactor)r�dirnamerrrrrrr
s
zMaildir.__init__cCs~|j�}y|j||�Wn*tk
rB|j�tj|j��YnXt|�t|t	�r||j
�}|j|j�}||jkr�d}nd}d}tj
j|j�j|j�d}tj
j|j|||�}t|t	�r�tj|jtj
j|j�|j�f�yLytj|j|�Wn(ttfk
�rtj|j|�YnXtj|j�WnNtk
�rx}z0tj|j�|jtjk�rftd|��n�WYdd}~XnX|S)N�r|rz$Name clash with existing message: %s)�_create_tmprv�
BaseExceptionrLrr$�name�_sync_closer[r	�
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�errrr"!sB



zMaildir.addcCs tjtjj|j|j|���dS)N)rr$rr~r�_lookup)rr#rrrr$KszMaildir.removecCs,y|j|�Wnttfk
r&YnXdS)N)r$r&�FileNotFoundError)rr#rrrr'OszMaildir.discardcCs�|j|�}|j|�}|j|�}t|t�r.|}n|}tjj|�}|j|kr`|j|j|j�d}nd}|j	|�tjj
|j|�}	tjj
|j|||�}
t|t�r�tj|	tjj
|	�|j�f�tj|	|
�dS)NrWr�rZ)r�r"r[r	rrr�r�r�r'r~rr�r�r�r�)rr#r!Zold_subpathZtemp_keyZtemp_subpathZdominant_subpathr�r�Ztmp_path�new_pathrrrr(Ws"






zMaildir.__setitem__cCs�|j|�}ttjj|j|�d�� }|jr4|j|�}nt|�}WdQRXtjj|�\}}|j	|�|j
|kr�|j|j|j
�d�|jtjj
tjj|j|���|S)N�rbrWrZ)r��openrrr~rrr	r��
set_subdirr��set_info�set_date�getmtime)rr#Zsubpath�f�msgr�r�rrrr,rs


zMaildir.get_messagec
Cs8ttjj|j|j|��d��}|j�jtd�SQRXdS)Nr�rQ)	r�rrr~rr�rSrbrc)rr#r�rrrr3�szMaildir.get_bytescCs$ttjj|j|j|��d�}t|�S)Nr�)r�rrr~rr��
_ProxyFile)rr#r�rrrr/�szMaildir.get_fileccsH|j�x:|jD]0}y|j|�Wntk
r8wYnX|VqWdS)N)�_refreshr�r�r&)rr#rrrr6�szMaildir.iterkeyscCs|j�||jkS)N)r�r�)rr#rrrr?�szMaildir.__contains__cCs|j�t|j�S)N)r��lenr�)rrrrr@�szMaildir.__len__cCsdS)Nr)rrrrrI�sz
Maildir.flushcCsdS)Nr)rrrrrJ�szMaildir.lockcCsdS)Nr)rrrrrK�szMaildir.unlockcCsdS)Nr)rrrrrL�sz
Maildir.closecCs`g}xVtj|j�D]F}t|�dkr|ddkrtjjtjj|j|��r|j|dd��qW|S)NrWr�.)r�listdirrr�r�isdirr~�append)rrB�entryrrr�list_folders�szMaildir.list_folderscCs ttjj|jd|�|jdd�S)Nr�F)rr)rrrr~rr)r�folderrrr�
get_folder�szMaildir.get_foldercCs\tjj|jd|�}t||jd�}tjj|d�}tjj|�sXtjtj|tj	tj
Bd��|S)Nr�)rZ
maildirfolderi�)rrr~rrrr�rLr��O_CREAT�O_WRONLY)rr�rrBZmaildirfolder_pathrrr�
add_folder�szMaildir.add_foldercCs,tjj|jd|�}xTtjtjj|d��tjtjj|d��D](}t|�dksZ|ddkr>td|��q>WxPtj|�D]B}|dkrv|dkrv|dkrvtjjtjj||��rvtd||f��qvWx`tj|d	d
�D]N\}}}x |D]}tj	tjj||��q�Wx |D]}tj
tjj||��q�Wq�Wtj
|�dS)Nr�r|r}rWrzFolder contains message(s): %sr{z%Folder contains subdirectory '%s': %sF)�topdown)rrr~rr�r�rr��walkr$�rmdir)rr�rr��root�dirs�filesrrr�
remove_folder�s 

zMaildir.remove_foldercCs\tj�}xNtjtjj|jd��D]4}tjj|jd|�}|tjj|�dkr tj|�q WdS)Nr{i@�)�timerr�rr~rr�r$)r�nowr�rrrr�clean�s
z
Maildir.cleanrWcCs�tj�}tj�}d|kr$|jdd�}d|kr8|jdd�}dt|�t|dd�tj�tj|f}tj	j
|jd|�}ytj|�Wn@t
k
r�tjd7_yt|�Stk
r�YnXYnXtd	|��dS)
N�/z\057rzz\072z%s.M%sP%sQ%s.%srWg��.Ar{z&Name clash prevented file creation: %s)r��socket�gethostnamerb�intr�getpidr�_countrr~r�statr��_create_carefully�FileExistsErrorr)rr�Zhostnamer�rrrrr��s&zMaildir._create_tmpcCs�tj�|jd|jkrbd}x<|jD]2}tjj|j|�}||j|krLd}||j|<q$W|sbdSi|_xl|jD]b}|j|}xRtj	|�D]D}tjj
||�}tjj|�r�q�|j|j
�d}tjj
||�|j|<q�WqpWtj�|_dS)NrUFTr)r�r�r�r�rrr�rr�r�r~r�r�r�)rZrefreshr��mtimerr��pr�rrrr��s&
zMaildir._refreshcCszy,tjjtjj|j|j|��r*|j|SWntk
r@YnX|j�y
|j|Stk
rttd|��YnXdS)NzNo message with key: %s)rrr�r~rr�r&r�)rr#rrrr�#s
zMaildir._lookupcCsVt|d�s|j�|_x<y|t|j�Stk
r8dStk
rLwYqXqWdS)N�
_onetime_keys)rEr6r��next�
StopIterationr&)rrrrr�1s

zMaildir.next)NT)rwrxryr�rr"r$r'r(r,r3r/r6r?r@rIrJrKrLr�r�r�r�r�r�r�r�r�r�rrrrrs4
*
	
$c@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)%�_singlefileMailboxNTcCs�tj||||�yt|jd�}Wnntk
r�}zR|jtjkr\|rPt|jd�}q~t|j��n"|jtjtj	fkr|t|jd�}n�WYdd}~XnX||_
d|_d|_d|_
d|_d|_d|_dS)Nzrb+zwb+r�rF)rrr�rr�r��ENOENTr�EACCES�EROFS�_filer��	_next_key�_pending�
_pending_sync�_locked�_file_length)rrrrr�r�rrrrAs$z_singlefileMailbox.__init__cCs8|j�|j|�|j|j<|jd7_d|_|jdS)NrWT)r��_append_messager�r�r�)rr!rrrr"Xs
z_singlefileMailbox.addcCs|j|�|j|=d|_dS)NT)r�r�r�)rr#rrrr$bs
z_singlefileMailbox.removecCs$|j|�|j|�|j|<d|_dS)NT)r�r�r�r�)rr#r!rrrr(hs
z_singlefileMailbox.__setitem__ccs|j�|jj�EdHdS)N)r�r�r8)rrrrr6nsz_singlefileMailbox.iterkeyscCs|j�||jkS)N)r�r�)rr#rrrr?ssz_singlefileMailbox.__contains__cCs|j�t|j�S)N)r�r�r�)rrrrr@xsz_singlefileMailbox.__len__cCs|jst|j�d|_dS)NT)r��
_lock_filer�)rrrrrJ}s
z_singlefileMailbox.lockcCs|jrt|j�d|_dS)NF)r��_unlock_filer�)rrrrrK�s
z_singlefileMailbox.unlockc
Cs�|js |jrt|j�d|_dS|jjdd�|jj�}||jkrTtd|j|f��t|j	�}y�i}|j
|�x�t|jj
��D]|}|j|\}}|jj|�|j|�|j�}x0|jjtd||jj���}|s�P|j|�q�W||j�f||<|j|�q~W|j�|_Wn"|j�tj|j��YnXt|�|jj�tj|j	�j}	tj|j|	�ytj|j|j	�Wn2tk
�r�tj|j	�tj|j|j	�YnXt|j	d�|_||_d|_d|_|j�r�t|jdd�dS)NFrrUz4Size of mailbox file changed (expected %i, found %i)izrb+)�dotlock) r�r��_sync_flushr�ra�tellr�r�_create_temporaryr�_pre_mailbox_hook�sortedr�r8�_pre_message_hookrS�minrd�_post_message_hookrLrr$r�r�r��st_mode�chmodr�r�r�r�r�)
rZcur_lenZnew_fileZnew_tocr#�start�stopZ	new_startrT�moderrrrI�s^
	






z_singlefileMailbox.flushcCsdS)Nr)rr�rrrr��sz$_singlefileMailbox._pre_mailbox_hookcCsdS)Nr)rr�rrrr��sz$_singlefileMailbox._pre_message_hookcCsdS)Nr)rr�rrrr��sz%_singlefileMailbox._post_message_hookcCs4z|j�Wdz|jr|j�Wd|jj�XXdS)N)rIr�rKr�rL)rrrrrL�sz_singlefileMailbox.closecCsJ|jdkr|j�|dk	rFy
|j|Stk
rDtd|��YnXdS)NzNo message with key: %s)r��
_generate_tocr&)rr#rrrr��s

z_singlefileMailbox._lookupcCs�|jjdd�|jj�}t|j�dkr:|jr:|j|j�y&|j|j�|j|�}|j	|j�Wn"t
k
r�|jj|��YnX|jj�|jj�|_
|S)NrrU)r�rar�r�r�r�r�r��_install_messager�r��truncaterIr�)rr!ZbeforeZoffsetsrrrr��s


z"_singlefileMailbox._append_message)NT)N)rwrxryrr"r$r(r6r?r@rJrKrIr�r�r�rLr�r�rrrrr�>s 

@

r�c@s>eZdZdZdd�Zddd�Zddd�Zdd	d
�Zdd�Zd
S)�	_mboxMMDFTcCsp|j|�\}}|jj|�|jj�jtd�}|jj||jj��}|j|jtd��}|j	|dd�j
d��|S)N�rQrXr)r�r�rarnrbrcrSr��_message_factory�set_from�decode)rr#r�r��	from_line�stringr�rrrr,sz_mboxMMDF.get_messageFcCstj|j|��j|d�S)N)�unixfrom)r1r2r3r4)rr#�from_rrrr5sz_mboxMMDF.get_stringcCsJ|j|�\}}|jj|�|s(|jj�|jj||jj��}|jtd�S)NrQ)r�r�rarnrSr�rbrc)rr#r�r�r�r�rrrr3s
z_mboxMMDF.get_bytescCs<|j|�\}}|jj|�|s(|jj�t|j|jj�|�S)N)r�r�rarn�_PartialFiler�)rr#r�r�r�rrrr/s

z_mboxMMDF.get_filecCsd}t|t�r|j|�}t|t�rf|jd�rf|jd�}|dkr\|d|�}||dd�}q�|}d}nJt|t�r�|j�jd�}d|}n(t|t	j
j�r�|j�}|dk	r�|jd�}|dkr�dt
jt
j��j�}|jj�}|jj|t�|j||j|j�|jj�}||fS)NsFrom rQrWr�rsFrom MAILER-DAEMON rZ)r[rgrPrhro�find�_mboxMMDFMessage�get_fromrMr1r!r�get_unixfromr��asctime�gmtimer�r�rdrcrv�
_mangle_from_)rr!r��newlineZauthorr�r�rrrr�&s0







z_mboxMMDF._install_messageN)F)F)F)	rwrxryr�r,r5r3r/r�rrrrr�s


	
r�c@s.eZdZdZdZd	dd�Zdd�Zdd�ZdS)
rTNcCst|_tj||||�dS)N)r
r�r�r)rrrrrrrrLsz
mbox.__init__cCs|jt�dS)N)rdrc)rr�rrrr�Qszmbox._post_message_hookcCs�gg}}d}|jjd�x�|jj�}|jj�}|jd�r|t|�t|�krl|rb|j|tt��n
|j|�|j|�d}q|s�|r�|j|tt��n
|j|�Pq|tkr�d}qd}qWtt	t
||���|_t|j�|_|jj�|_
dS)NFrsFrom T)r�rar�rnror�r�rc�dict�	enumerate�zipr�r�r�)r�starts�stopsZlast_was_empty�line_posrurrrr�Us0






zmbox._generate_toc)NT)rwrxryr�rerr�r�rrrrrCs

c@s.eZdZddd�Zdd�Zdd�Zd	d
�ZdS)rNTcCst|_tj||||�dS)N)r
r�r�r)rrrrrrrrzsz
MMDF.__init__cCs|jdt�dS)Ns)rdrc)rr�rrrr�szMMDF._pre_message_hookcCs|jtdt�dS)Ns)rdrc)rr�rrrr��szMMDF._post_message_hookcCs�gg}}|jjd�d}x�|}|jj�}|jj�}|jdt�r�|j|�xV|}|jj�}|jj�}|dtkr�|j|tt��PqN|sN|j|�PqNWq|sPqWtt	t
||���|_t|j�|_|jjdd�|jj�|_
dS)NrsrU)r�rarnr�rorcr�r�rrrr�r�r�)rrr�next_posrrurrrr��s2






zMMDF._generate_toc)NT)rwrxryrr�r�r�rrrrrws
c@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)0rNTcCsttj||||�tjj|j�sj|r`tj|jd�tjtjtjj	|jd�tj
tjBtjBd��n
t
|j��d|_dS)Ni�z
.mh_sequencesi�F)rrrrr�rr�rLr�r~r��O_EXCLr�rr�)rrrrrrrr�s
zMH.__init__cCs�|j�}t|�dkrd}nt|�d}tjj|jt|��}t|�}d}z�|j	rVt
|�zfy|j||�Wn:tk
r�|j	r�t
|�t|�d}tj|��YnXt|t�r�|j||�Wd|j	r�t
|�XWd|s�t|�X|S)NrrWFT)r8r��maxrrr~rrgr�r�r�rvr�r�r�r$r[r�_dump_sequences)rr!r8Znew_keyr�r��closedrrrr"�s6


zMH.addcCsxtjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnX|j
�tj|�dS)Nzrb+zNo message with key: %s)rrr~rrgr�r�r�r�r&rLr$)rr#rr�r�rrrr$�sz	MH.removecCs�tjj|jt|��}yt|d�}Wn>tk
r`}z"|jtjkrNt	d|��n�WYdd}~XnXzd|j
rrt|�z@tjtj|tj
tjB��|j||�t|t�r�|j||�Wd|j
r�t|�XWdt|�XdS)Nzrb+zNo message with key: %s)rrr~rrgr�r�r�r�r&r�r�rLr��O_TRUNCrvr[rr	r�r�)rr#r!rr�r�rrrr(�s$
zMH.__setitem__c Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�2|jr�t|�zt|�}Wd|jr�t
|�XWdQRXx*|j�j�D]\}}||kr�|j|�q�W|S)Nzrb+r�zNo message with key: %s)r�r�rrr~rrgr�r�r�r&r�rr��
get_sequencesr>�add_sequence)rr#r�r�r�r��key_listrrrr,�s&zMH.get_messagec Cs�y@|jr$ttjj|jt|��d�}nttjj|jt|��d�}Wn>tk
r~}z"|jtj	krlt
d|��n�WYdd}~XnX|�6|jr�t|�z|j�j
td�S|jr�t|�XWdQRXdS)Nzrb+r�zNo message with key: %srQ)r�r�rrr~rrgr�r�r�r&r�rSrbrcr�)rr#r�r�rrrr3szMH.get_bytescCsfyttjj|jt|��d�}Wn>tk
r\}z"|jtjkrJt	d|��n�WYdd}~XnXt
|�S)Nr�zNo message with key: %s)r�rrr~rrgr�r�r�r&r�)rr#r�r�rrrr/)szMH.get_filecCsttdd�tj|j�D���S)Ncss|]}|j�rt|�VqdS)N)�isdigitr�)�.0r�rrr�	<genexpr>6szMH.iterkeys.<locals>.<genexpr>)�iterr�rr�r)rrrrr64szMH.iterkeyscCstjjtjj|jt|���S)N)rrr�r~rrg)rr#rrrr?9szMH.__contains__cCstt|j���S)N)r�r7r6)rrrrr@=sz
MH.__len__cCs2|js.ttjj|jd�d�|_t|j�d|_dS)Nz
.mh_sequenceszrb+T)r�r�rrr~rr�r�)rrrrrJAs
zMH.lockcCs(|jr$t|j�t|j�|`d|_dS)NF)r�r�r�r�)rrrrrKHs


z	MH.unlockcCsdS)Nr)rrrrrIPszMH.flushcCs|jr|j�dS)N)r�rK)rrrrrLTszMH.closecCs@g}x6tj|j�D]&}tjjtjj|j|��r|j|�qW|S)N)rr�rrr�r~r�)rrBr�rrrr�Ys
zMH.list_folderscCsttjj|j|�|jdd�S)NF)rr)rrrr~rr)rr�rrrr�asz
MH.get_foldercCsttjj|j|�|jd�S)N)r)rrrr~rr)rr�rrrr�fsz
MH.add_foldercCs`tjj|j|�}tj|�}|dgkr:tjtjj|d��n|gkrDntd|j��tj|�dS)Nz
.mh_sequenceszFolder not empty: %s)rrr~rr�r$rr�)rr�rZentriesrrrr�ks

zMH.remove_folderc
si}ttjj|jd�ddd���}t|j���x�|D]�}y�|jd�\}}t�}xT|j�D]H}|j�rr|j	t
|��qVdd�|jd�D�\}}	|jt||	d	��qVW�fd
d�t
|�D�||<t||�dkr�||=Wq2tk
r�td
|j���Yq2Xq2WWdQRX|S)Nz
.mh_sequences�r�ASCII)�encodingrzcss|]}t|�VqdS)N)r�)r�xrrrr�sz#MH.get_sequences.<locals>.<genexpr>�-rWcsg|]}|�kr|�qSrr)rr#)�all_keysrr�
<listcomp>�sz$MH.get_sequences.<locals>.<listcomp>rz"Invalid sequence specification: %s)r�rrr~r�setr8r�rr"r�rH�ranger�r�rOr�rstrip)
rZresultsr�rur��contentsr8�specr�r�r)rrrws&

 zMH.get_sequencescCs
ttjj|jd�ddd�}z�tjtj|jtjtjB��x�|j	�D]�\}}t
|�dkrXqB|j|d�d}d}xbtt
|��D]R}|d|kr�|s�d	}|jd
�n*|r�d}|jd||f�n|jd|�|}q|W|r�|jt|�d
�qB|jd
�qBWWdt|�XdS)Nz
.mh_sequenceszr+r)rrrzFrWTrz%s %sz %s�
)r�rrr~rrLr�r�rr>r�rdr�rrgr�)r�	sequencesr�r�r8�prevZ
completingr#rrr�
set_sequences�s.zMH.set_sequencesc	CsL|j�}d}g}x�|j�D]�}|d|kr�|j||df�y4tjtjj|jt|��tjj|jt|d���WnHt	t
fk
r�tjtjj|jt|��tjj|jt|d���YnXtjtjj|jt|���|d7}qW|d|_
t|�dkr�dSxB|j�D]6\}}x*|D]"\}}||k�r|||j|�<�qW�qW|j|�dS)NrrW)rr6r�rr�rr~rrgr�r�r��unlinkr�r�r>�indexr")	rr r!Zchangesr#r�r�oldr|rrr�pack�s, 

zMH.packcCs||j�}|j�}x<|j�D]0\}}||kr6|j|�q||kr||j|�=qWx|D]}||krT|g||<qTW|j|�dS)N)rr>r�r$r")rr!r#Zpending_sequencesZ
all_sequencesr�r�sequencerrrr	�s
zMH._dump_sequences)NT)rwrxryrr"r$r(r,r3r/r6r?r@rJrKrIrLr�r�r�r�rr"r&r	rrrrr�s,
"c@s�eZdZedddddddh�Zd$d
d�Zdd
�Zdd�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zd d!�Zd"d#�ZdS)%r�unseen�deletedZfiled�answered�	forwardedZedited�resentNTcCstj||||�i|_dS)N)r�r�_labels)rrrrrrrr�szBabyl.__init__cCs(tj||�}t|t�r$|j�|j|<|S)N)r�r"r[r�
get_labelsr-)rr!r#rrrr"�s
z	Babyl.addcCs"tj||�||jkr|j|=dS)N)r�r$r-)rr#rrrr$�s
zBabyl.removecCs*tj|||�t|t�r&|j�|j|<dS)N)r�r(r[rr.r-)rr#r!rrrr(�s
zBabyl.__setitem__c
Cs�|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wtj�}x0|jj�}|tks�|r�P|j|jtd��qlW||jj	�}|jj
|�}|jtd�}t|j�|�}	|	j
|j��||jkr�|	j|j|�|	S)Ns*** EOOH ***rQ)r�r�rarnr\r]rcrdrbr�rSrrm�set_visibler-�
set_labels)
rr#r�r��original_headersruZvisible_headers�nZbodyr�rrrr,�s.



zBabyl.get_messagec	Cs�|j|�\}}|jj|�|jj�tj�}x4|jj�}|dtksJ|rLP|j|jtd��q.Wx|jj�}|tks||rdPqdW|j	�}||jj
�}|jj|�}|jtd�}||S)Ns*** EOOH ***rQ)r�r�rarnr\r]rcrdrbrmr�rS)	rr#r�r�r1ruZheadersr2rtrrrr3s$


zBabyl.get_bytescCstj|j|�jdt��S)NrQ)r\r]r3rbrc)rr#rrrr/%szBabyl.get_filecCs@|j�t�}x|jj�D]}|j|�qW|j|j�t|�S)N)r�rr-r<rH�difference_update�_special_labelsr7)r�labelsZ
label_listrrrr.)szBabyl.get_labelscCs>gg}}|jjd�d}g}x�|}|jj�}|jj�}|dtkr�t|�t|�krf|j|tt��|j|�dd�|jj�dd�jd�D�}|j|�q |dks�|dtkr�t|�t|�kr�|j|tt��q |s |j|tt��Pq Wtt	t
||���|_tt	|��|_t|j�|_
|jjdd�|jj�|_dS)	NrscSsg|]}|j�r|j��qSr)�strip)r�labelrrrr@sz'Babyl._generate_toc.<locals>.<listcomp>rW�,�rU)r�rarnr�rcr�r�r�rrrr�r-r�r�)rrrrZlabel_listsrrur5rrrr�2s4



zBabyl._generate_toccCsVdt}|dt7}|j�}dd�|D�}|ddj|�t7}|d7}|j|�dS)NsBABYL OPTIONS:s
Version: 5css|]}|j�VqdS)N)rM)rr7rrrrUsz*Babyl._pre_mailbox_hook.<locals>.<genexpr>sLabels:r8r9)rcr.r~rd)rr�Zbabylr5rrrr�PszBabyl._pre_mailbox_hookcCs|jdt�dS)N�)rdrc)rr�rrrr�ZszBabyl._pre_message_hookcCs|jtd�dS)Nr9)rdrc)rr�rrrr�^szBabyl._post_message_hookcCs�|jj�}t|t�r�g}g}x0|j�D]$}||jkr@|j|�q&|j|�q&W|jjd�x |D]}|jjd|j��q`W|jjd�x$|D]}|jjd|j�d�q�W|jjt	�n|jjdt	�t|t
jj��r0t
j�}t
jj|dd�}|j|�|jd�x6|j�}|jj|jd	t	��|d	k�s8|�r
P�q
W|jjd
t	�t|t��r�t
j�}	t
jj|	dd�}
|
j|j��xz|	j�}|jj|jd	t	��|d	k�s�|�r�P�q�WnB|jd�x6|j�}|jj|jd	t	��|d	k�s�|�r�P�q�Wx,|jd�}|�sP|jj|jd	t	���qW�nZt|ttt
jf��r,t|t
j��rhtjdtd
�|j�}t|t��r~|j|�}|jd�d}|ddk�r|jj|d|�jd	t	��|jjd
t	�|jj|d|�jd	t	��|jj||d�jd	t	��n(|jjd
t	t	�|jj|jd	t	���n^t |d��rzt |d��rXtjdtd
�|j!}|j�}
d}x�|j�}|j"d��r�|dd�d	}n|j"d��r�|dd�d	}|jj|jd	t	��|d	k�s�|�rf|�r�d}|jjd
t	�|j|
�nP�qfWx�|j�}|�sP|j"d��r,|dd�t	}n:|j"d��rJ|dd�t	}n|j"d	��rf|dd�t	}|jj|��q�Wnt#dt$|���|jj�}||fS)N�1s, s,,� r8s1,,FrrQs*** EOOH ***iz8Use of StringIO input is deprecated, use BytesIO insteadrRs

rUrWrnrTzDUse of text mode files is deprecated, use a binary mode file insteadTs
rVzInvalid message type: %srZrYrZrYrZrZ)%r�r�r[rr.r4r�rdrMrcr1r!rr\r]r^r_r`rarnrb�get_visiblerSrhrgrirjrkrlrmrPr�rErTrfrprq)rr!r�Zspecial_labelsr5r7Zorig_bufferZorig_generatorruZ
vis_bufferZ
vis_generatorrTZ
body_startZoriginal_posZ
first_passr�rrrr�bs�











zBabyl._install_message)NT)rwrxry�	frozensetr4rr"r$r(r,r3r/r.r�r�r�r�r�rrrrr�s

	
c@s&eZdZddd�Zdd�Zdd�ZdS)	rNcCs�t|tjj�r4|jtj|��t|t�r�|j|�n�t|t�rP|jtj	|��n~t|t
�rl|jtj|��nbt|tj
�r�|jtj|��nDt|d�r�|jtj|��n(|dkr�tjjj|�ntdt|���dS)NrSzInvalid message type: %s)r[r1r!r�_become_message�copy�deepcopy�_explain_torhr2rgZmessage_from_stringr\�
TextIOWrapperZmessage_from_filerEZmessage_from_binary_filerrprq)rr!rrrr�s



zMessage.__init__cCs8t|dg�}x&|jD]}||kr|j||j|<qWdS)N�_type_specific_attributes)�getattr�__dict__)rr!Z
type_specificr�rrrr?�szMessage._become_messagecCst|t�rdStd��dS)Nz Cannot convert to specified type)r[rrp)rr!rrrrB�s
zMessage._explain_to)N)rwrxryrr?rBrrrrr�s
c@sxeZdZdddgZddd�Zdd�Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�ZdS)r	�_subdir�_info�_dateNcCs&d|_d|_tj�|_tj||�dS)Nr|r�)rGrHr�rIrr)rr!rrrr�s
zMaildirMessage.__init__cCs|jS)N)rG)rrrrr��szMaildirMessage.get_subdircCs(|dks|dkr||_ntd|��dS)Nr|r}z!subdir must be 'new' or 'cur': %s)rGrO)rr�rrrr�szMaildirMessage.set_subdircCs"|jjd�r|jdd�SdSdS)Nz2,rUr�)rHro)rrrr�	get_flags
szMaildirMessage.get_flagscCsddjt|��|_dS)Nz2,r�)r~r�rH)r�flagsrrr�	set_flagsszMaildirMessage.set_flagscCs$|jdjt|j��t|�B��dS)Nr�)rLr~rrJ)r�flagrrr�add_flagszMaildirMessage.add_flagcCs,|j�r(|jdjt|j��t|���dS)Nr�)rJrLr~r)rrMrrr�remove_flagszMaildirMessage.remove_flagcCs|jS)N)rI)rrrrr�szMaildirMessage.get_datecCs4yt|�|_Wn tk
r.td|��YnXdS)Nzcan't convert to float: %s)�floatrIrOrp)rZdaterrrr�"szMaildirMessage.set_datecCs|jS)N)rH)rrrrr�)szMaildirMessage.get_infocCs&t|t�r||_ntdt|���dS)Nzinfo must be a string: %s)r[rgrHrprq)r�inforrrr�-s
zMaildirMessage.set_infocCs�t|t�r8|j|j��|j|j��|j|j���nht|t�r�t	|j��}d|kr`|j
d�|j�dkrv|j
d�d|kr�|j
d�d|kr�|j
d�d|kr�|j
d�|jd	tj
|j���n�t|t��rt	|j��}d|kr�|jd
�d|k�r|jd�d|k�r�|jd�n�t|t��r�t	|j��}d|k�rD|jd
�d|k�rX|jd
�d|k�rl|jd�d|k�r�|jd�nt|t��r�ntdt|���dS)N�S�Rr}�O�T�D�F�Az
MAILER-DAEMONr(�replied�flaggedr)r*�Pr+z$Cannot convert to specified type: %s)r[r	rLrJr�r�r�r�r�rrNr�r�r�rr
r�	add_labelrrprq)rr!rKrrrrB4sN

















zMaildirMessage._explain_to)N)rwrxryrDrr�r�rJrLrNrOr�r�r�r�rBrrrrr	�s

c@sVeZdZdgZddd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�ZdS)r��_fromNcCsV|jdd�t|tjj�rF|j�}|dk	rF|jd�rF|j|dd��tj||�dS)Nz
MAILER-DAEMONTzFrom rX)r�r[r1r!rr�ror)rr!r�rrrresz_mboxMMDFMessage.__init__cCs|jS)N)r])rrrrr�nsz_mboxMMDFMessage.get_fromcCs4|dk	r*|dkrtj�}|dtj|�7}||_dS)NT� )r�r�r�r])rr�Ztime_rrrr�rs
z_mboxMMDFMessage.set_fromcCs|jdd�|jdd�S)N�Statusr�zX-Status)r+)rrrrrJzsz_mboxMMDFMessage.get_flagscCs�t|�}d	\}}x&d
D]}||kr||7}|j|�qWx&dD]}||kr>||7}|j|�q>W|djt|��7}y|jd|�Wn tk
r�|jd|�YnXy|jd|�Wn tk
r�|jd|�YnXdS)Nr�rSrTrVrWrXr_zX-Status)r�r�)rSrT)rVrWrX)rr$r~r��replace_headerr&Z
add_header)rrKZstatus_flagsZ
xstatus_flagsrMrrrrL~s&

z_mboxMMDFMessage.set_flagscCs$|jdjt|j��t|�B��dS)Nr�)rLr~rrJ)rrMrrrrN�sz_mboxMMDFMessage.add_flagcCs4d|ksd|kr0|jdjt|j��t|���dS)Nr_zX-Statusr�)rLr~rrJ)rrMrrrrO�sz_mboxMMDFMessage.remove_flagcCs�t|t�r�t|j��}d|kr(|jd�d|kr:|jd�d|krL|jd�d|kr^|jd�d|krp|jd�|d	=|d
=dj|j�j�dd��}y|j	t
jtj
|d
���Wnttfk
r�YnX�n
t|t�r�|j|j��|j|j��n�t|t��rZt|j��}d|k�r$|jd�d|k�r8|jd�d|k�rL|jd�|d	=|d
=n�t|t��r�t|j��}d|k�r�|jd�d|k�r�|jd�d|k�r�|jd�|d	=|d
=nt|t��r�ntdt|���dS)NrTr}rWrXrSrRrVrUZstatuszx-statusr^rXz%a %b %d %H:%M:%S %Yr(rYrZr)r*z$Cannot convert to specified type: %s���)r[r	rrJr�rNr~r�r�r��calendarZtimegmr�ZstrptimerO�
OverflowErrorr�rLr�rr
rr\rrprq)rr!rKZ
maybe_daterrrrB�s^



















z_mboxMMDFMessage._explain_to)N)N)rwrxryrDrr�r�rJrLrNrOrBrrrrr�`s
	
r�c@seZdZdS)r
N)rwrxryrrrrr
�sc@sDeZdZdgZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)r�
_sequencesNcCsg|_tj||�dS)N)rdrr)rr!rrrr�szMHMessage.__init__cCs|jdd�S)N)rd)rrrrr�szMHMessage.get_sequencescCst|�|_dS)N)r7rd)rr rrrr"�szMHMessage.set_sequencescCs6t|t�r"||jkr2|jj|�ntdt|���dS)Nzsequence type must be str: %s)r[rgrdr�rprq)rr'rrrr
�s

zMHMessage.add_sequencecCs*y|jj|�Wntk
r$YnXdS)N)rdr$rO)rr'rrr�remove_sequence�szMHMessage.remove_sequencecCsJt|t�rdt|j��}d|kr*|jd�n|jd�|jd�d|krP|jd�d|krb|jd�n�t|t�r�t|j��}d|kr�|jd�n
|jd	�d|kr�|jd�d|kr�|jd
�n�t|t�r�x||j�D]}|j|�q�Wn`t|t	��r(t|j��}d|k�r|j
d�d|k�rF|j
d�nt|t��r6ntdt
|���dS)
Nr(r}rRrZrWrYrS�ROrTrXr*z$Cannot convert to specified type: %s)r[r	rrr�rNr�rr
rr\rrprq)rr!r r'rrrrB�s@










zMHMessage._explain_to)N)
rwrxryrDrrr"r
rerBrrrrr�s
c@s^eZdZddgZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�ZdS)rr-�_visibleNcCsg|_t�|_tj||�dS)N)r-rrgr)rr!rrrr"szBabylMessage.__init__cCs|jdd�S)N)r-)rrrrr.(szBabylMessage.get_labelscCst|�|_dS)N)r7r-)rr5rrrr0,szBabylMessage.set_labelscCs6t|t�r"||jkr2|jj|�ntdt|���dS)Nzlabel must be a string: %s)r[rgr-r�rprq)rr7rrrr\0s

zBabylMessage.add_labelcCs*y|jj|�Wntk
r$YnXdS)N)r-r$rO)rr7rrr�remove_label8szBabylMessage.remove_labelcCs
t|j�S)N)rrg)rrrrr=?szBabylMessage.get_visiblecCst|�|_dS)N)rrg)rZvisiblerrrr/CszBabylMessage.set_visiblecCsjx6|jj�D](}||kr,|jj|||�q|j|=qWx,dD]$}||kr>||jkr>|||j|<q>WdS)N�Date�From�Reply-To�To�CC�Subject)rirjrkrlrmrn)rgr8r`)r�headerrrr�update_visibleGs
zBabylMessage.update_visiblecCsvt|t�r~t|j��}d|kr*|jd�n|jd�|jd�d|ksNd|krX|jd�d|krj|jd�d	|kr||jd
�n�t|t�r�t|j��}d|kr�|jd�n
|jd�d	|kr�|jd
�d|kr�|jd�n�t|t��rt|j��}d|k�r|jd�d|k�rr|jd�nXt|t	��rT|j
|j��x<|j�D]}|j|��q>Wnt|t
��rbntdt|���dS)Nr(r}rRr+r,r[r*rSr)rUrfrTrVrXrYz$Cannot convert to specified type: %s)r[r	rr.r�rNr�rr
rr/r=r\rrprq)rr!r5r7rrrrBRsF










zBabylMessage._explain_to)N)
rwrxryrDrr.r0r\rhr=r/rprBrrrrrs
c@seZdZdS)r
N)rwrxryrrrrr
|sc@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$��ZdS)+r�NcCs$||_|dkr|j�|_n||_dS)N)r�r��_pos)rr��posrrrr�sz_ProxyFile.__init__cCs|j||jj�S)N)�_readr�rS)r�sizerrrrS�sz_ProxyFile.readcCs|j||jj�S)N)rsr��read1)rrtrrrru�sz_ProxyFile.read1cCs|j||jj�S)N)rsr�rn)rrtrrrrn�sz_ProxyFile.readlinecCs>g}x4|D],}|j|�|dk	r
|t|�8}|dkr
Pq
W|S)Nr)r�r�)r�sizehintrBrurrr�	readlines�s

z_ProxyFile.readlinesccs x|j�}|sdS|VqWdS)N)rn)rrurrrr;�s
z_ProxyFile.__iter__cCs|jS)N)rq)rrrrr��sz_ProxyFile.tellrcCs4|dkr|jj|j�|jj||�|jj�|_dS)NrW)r�rarqr�)r�offset�whencerrrra�sz_ProxyFile.seekc
Cs0t|d�r,zt|jd�r"|jj�Wd|`XdS)Nr�rL)rEr�rL)rrrrrL�s

z_ProxyFile.closecCs2|dkrd}|jj|j�||�}|jj�|_|S)NrWrZ)r�rarqr�)rrt�read_methodrBrrrrs�sz_ProxyFile._readcCs|S)Nr)rrrr�	__enter__�sz_ProxyFile.__enter__cGs|j�dS)N)rL)r�excrrr�__exit__�sz_ProxyFile.__exit__cCs
|jj�S)N)r��readable)rrrrr~�sz_ProxyFile.readablecCs
|jj�S)N)r��writable)rrrrr�sz_ProxyFile.writablecCs
|jj�S)N)r��seekable)rrrrr��sz_ProxyFile.seekablecCs
|jj�S)N)r�rI)rrrrrI�sz_ProxyFile.flushcCs&t|d�sdSt|jd�sdS|jjS)Nr�Tr
F)rEr�r
)rrrrr
�s

z_ProxyFile.closed)N)N)N)N)N)r)rwrxryrrSrurnrwr;r�rarLrsr{r}r~rr�rI�propertyr
rrrrr��s"





		r�c@s8eZdZd
dd�Zdd�Zddd�Zd	d
�Zdd�ZdS)r�NcCstj|||�||_||_dS)N)r�r�_start�_stop)rr�r�r�rrrr�sz_PartialFile.__init__cCstj|�|jS)N)r�r�r�)rrrrr��sz_PartialFile.tellrcCs<|dkr|j|_d}n|dkr*|j|_d}tj|||�dS)NrrWrU)r�rqr�r�ra)rrxryrrrra�sz_PartialFile.seekcCsB|j|j}|dkrdS|dks0|dks0||kr4|}tj|||�S)Nrr�)r�rqr�rs)rrtrzZ	remainingrrrrs�sz_PartialFile._readcCst|d�r|`dS)Nr�)rEr�)rrrrrLs
z_PartialFile.close)NN)r)rwrxryrr�rarsrLrrrrr��s



	r�Tc4Cs�d}�yZtrpytj|tjtjB�WnJtk
rn}z.|jtjtjtjfkr\t	d|j
��n�WYdd}~XnX|�r^yt|j
d�}|j�Wn:tk
r�}z|jtjtjfkr�dS�WYdd}~XnXy`yt
j|j
|j
d�d}Wn2ttfk
�rt
j|j
|j
d�d}YnXt
j|j
�Wn0tk
�r\t
j|j
�t	d|j
��YnXWn8t�r|tj|tj�|�r�t
j|j
d��YnXdS)NFzlockf: lock unavailable: %sz.lockTzdot lock unavailable: %s)�fcntl�lockfZLOCK_EXZLOCK_NBr�r�ZEAGAINr�r�rr�r�rLrr�r�r�r�r#r�r$�LOCK_UN)r�r�Zdotlock_doner�Zpre_lockrrrr�
sH
r�cCs8trtj|tj�tjj|jd�r4tj|jd�dS)Nz.lock)r�r�r�rrr�r�r$)r�rrrr�4sr�cCs8tj|tjtjBtjBd�}z
t|d�Stj|�XdS)Ni�zrb+)rr�r�r�O_RDWRrL)r�fdrrrr�;s
r�cCs$td|ttj��tj�tj�f�S)Nz%s.%s.%s.%s)r�r�r�r�r�rr�)rrrrr�Csr�cCs$|j�ttd�r tj|j��dS)N�fsync)rIrErr��fileno)r�rrrr�Is
r�cCst|�|j�dS)N)r�rL)r�rrrr�Osr�c@seZdZdS)rN)rwrxryrrrrrUsc@seZdZdS)rN)rwrxryrrrrrXsc@seZdZdS)rN)rwrxryrrrrr[sc@seZdZdS)rN)rwrxryrrrrr^sc@seZdZdS)rN)rwrxryrrrrras)T)/rr�rbr�r�r@rjr1Z
email.messageZemail.generatorr\r-r��ImportError�__all__rcrMrrr�r�rrrrr!rr	r�r
rrr
r�r�r�r�r�r�r�r��	Exceptionrrrrrrrrr�<module>	sn

h8DB4-3z%mqH_c'
*

MMCT - 2023