AlkantarClanX12

Your IP : 3.142.212.153


Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/mailbox.cpython-312.opt-2.pyc

�

�Q�f?4���	ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
Z
ddlZddlm
Z
	ddlZgd�Zej"j%d�ZGd�d�ZGd�de�ZGd	�d
e�ZGd�de�ZGd
�de�ZGd�de�ZGd�de�ZGd�de�ZGd�dej6j8�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Z Gd�d e�Z!Gd!�d"e�Z"Gd#�d$�Z#Gd%�d&e#�Z$d7d'�Z%d(�Z&d)�Z'd*�Z(d+�Z)d,�Z*Gd-�d.e+�Z,Gd/�d0e,�Z-Gd1�d2e,�Z.Gd3�d4e,�Z/Gd5�d6e,�Z0y#e$rdZY��AwxYw)8�N)�GenericAlias)�Mailbox�Maildir�mbox�MH�Babyl�MMDF�Message�MaildirMessage�mboxMessage�	MHMessage�BabylMessage�MMDFMessage�Error�NoSuchMailboxError�
NotEmptyError�ExternalClashError�FormatError�asciic���eZdZ	d"d�Zd�Zd�Zd�Zd�Zd�Zd#d�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd#d�Zd�Zd#d�Zd�Zd�Zd�Zd�Zd�Z d Z!d$d!�Z"e#e$�Z%y)%rNc��	tjjtjj|��|_||_y�N)�os�path�abspath�
expanduser�_path�_factory��selfr�factory�creates    �./opt/alt/python312/lib64/python3.12/mailbox.py�__init__zMailbox.__init__%s/��,��W�W�_�_�R�W�W�%7�%7��%=�>��
���
�c��	td���Nz&Method must be implemented by subclass��NotImplementedError�r �messages  r#�addzMailbox.add*s��2�!�"J�K�Kr%c��	td��r'r(�r �keys  r#�removezMailbox.remove.s��K�!�"J�K�Kr%c�&�|j|�yr)r0r.s  r#�__delitem__zMailbox.__delitem__2s�����C�r%c�H�		|j|�y#t$rYywxYwr)r0�KeyErrorr.s  r#�discardzMailbox.discard5s(��5�	��K�K�����	��	�s��	!�!c��	td��r'r(�r r/r+s   r#�__setitem__zMailbox.__setitem__<s��L�!�"J�K�Kr%c�J�		|j|�S#t$r|cYSwxYwr)�__getitem__r4)r r/�defaults   r#�getzMailbox.get@s/��G�	��#�#�C�(�(���	��N�	�s��"�"c���	|js|j|�Stj|j	|��5}|j|�cddd�S#1swYyxYwr)r�get_message�
contextlib�closing�get_file)r r/�files   r#r:zMailbox.__getitem__GsS��K��}�}��#�#�C�(�(��#�#�D�M�M�#�$6�7�4��}�}�T�*�
+�
+�7�7�s�A�A'c��	td��r'r(r.s  r#r>zMailbox.get_messageOs��B�!�"J�K�Kr%c�h�	tj|j|��j�Sr��email�message_from_bytes�	get_bytes�	as_stringr.s  r#�
get_stringzMailbox.get_stringSs,��	*��'�'����s�(;�<�F�F�H�Hr%c��	td��r'r(r.s  r#rHzMailbox.get_bytesZs��F�!�"J�K�Kr%c��	td��r'r(r.s  r#rAzMailbox.get_file^s��D�!�"J�K�Kr%c��	td��r'r(�r s r#�iterkeyszMailbox.iterkeysbs��+�!�"J�K�Kr%c�6�	t|j��Sr)�listrOrNs r#�keyszMailbox.keysfs��$��D�M�M�O�$�$r%c#�jK�	|j�D]}	||}|���y#t$rY�wxYw�wr�rOr4�r r/�values   r#�
itervalueszMailbox.itervaluesjsA����3��=�=�?�C�
��S�	���K�#���
��
�s�3�$�3�	0�3�0�3c�"�|j�Sr)rWrNs r#�__iter__zMailbox.__iter__ss����� � r%c�6�	t|j��Sr)rQrWrNs r#�valueszMailbox.valuesvs��:��D�O�O�%�&�&r%c#�nK�	|j�D]}	||}||f���y#t$rY�wxYw�wrrTrUs   r#�	iteritemszMailbox.iteritemszsF����<��=�=�?�C�
��S�	����,��#���
��
�s�5�&�	5�	2�5�2�5c�6�	t|j��Sr)rQr]rNs r#�itemsz
Mailbox.items�s��G��D�N�N�$�%�%r%c��	td��r'r(r.s  r#�__contains__zMailbox.__contains__�s��G�!�"J�K�Kr%c��	td��r'r(rNs r#�__len__zMailbox.__len__�s��8�!�"J�K�Kr%c�R�	|j�D]}|j|��yr)rRr5r.s  r#�clearz
Mailbox.clear�s!��"��9�9�;�C��L�L���r%c�X�		||}|j|�|S#t$r|cYSwxYwr)r4r5)r r/r;�results    r#�popzMailbox.pop�s<��A�	��#�Y�F�	
���S���
���	��N�	�s��)�)c�l�	|j�D]}||j|�fcStd��)NzNo messages in mailbox)rOrhr4r.s  r#�popitemzMailbox.popitem�s6��D��=�=�?�C�����#��'�'�#��3�4�4r%c���	t|d�r|j�}nt|d�r|j�}n|}d}|D]\}}	|||<�
|rtd��y#t$rd}Y�)wxYw)Nr]r_FTzNo message with key(s))�hasattrr]r_r4)r �arg�source�bad_keyr/r+s      r#�updatezMailbox.update�s���B��3��$��]�]�_�F�
�S�'�
"��Y�Y�[�F��F���"�L�C��
�#��S�	�#�
��3�4�4����
���
�s�	A�A,�+A,c��	td��r'r(rNs r#�flushz
Mailbox.flush�s��4�!�"J�K�Kr%c��	td��r'r(rNs r#�lockzMailbox.lock�s���!�"J�K�Kr%c��	td��r'r(rNs r#�unlockzMailbox.unlock�s��1�!�"J�K�Kr%c��	td��r'r(rNs r#�closez
Mailbox.close�s��*�!�"J�K�Kr%c�V�	|jd�S#t$rtd��wxYw)Nrz?String input must be ASCII-only; use bytes or a Message instead)�encode�UnicodeError�
ValueErrorr*s  r#�_string_to_byteszMailbox._string_to_bytes�s7��	2��>�>�'�*�*���	2��1�2�
2�	2�s��(Fc��	t|tjj�r�t	j
�}tjj||d�}|j|�|jd�|j�}|jdt�}|j|�|jr,|jt�s|jt�yyyt|t t"tj$f�r�t|tj$�r+t'j(dt*d�|j-�}t|t �r|j/|�}|r|jdd�}|jdt�}|j|�|jr,|jt�s|jt�yyyt1|d�r�t1|d�r't'j(d	t*d�|j2}d}	|j5�}|jd
�r	|dddz}n|jd�r|dd
dz}|snE|r|j7d�rd|ddz}|jdt�}|j|�|}��|jr/|r,|jt�s|jt�yyyyt9dt;|�z��)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)�
isinstancerFr+r
�io�BytesIO�	generator�BytesGenerator�flatten�seekr��replace�linesep�write�_append_newline�endswith�str�bytes�StringIO�warnings�warn�DeprecationWarning�getvaluer}rlr��readline�
startswith�	TypeError�type)	r r+�target�mangle_from_r��gen�data�lastline�lines	         r#�
_dump_messagezMailbox._dump_message�sw��3��g�u�}�}�4�4�5��Z�Z�\�F��/�/�0�0���q�I�C��K�K�� ��K�K��N��;�;�=�D��<�<��w�/�D��L�L����#�#�D�M�M�'�,B����W�%�-C�#���#�u�b�k�k�!:�
;��'�2�;�;�/��
�
�*�+=�q�B�!�*�*�,���'�3�'��/�/��8���!�/�/�*�k�B���o�o�e�W�5�G��L�L��!��#�#�G�,<�,<�W�,E����W�%�-F�#��W�f�
%��w��)��
�
�5�6H�!�M�!�.�.���H���'�'�)���=�=��)����9�u�,�D��]�]�5�)����9�u�,�D����D�O�O�H�$=�$�t�A�B�x�/�D��|�|�E�7�3�����T�"�����#�#���9J�9J�7�9S����W�%�:T��#��6��g��F�G�Gr%�NTr�F)&�__name__�
__module__�__qualname__r$r,r0r2r5r8r<r:r>rJrHrArOrRrWrYr[r]r_rarcrerhrjrprrrtrvrxr}r�r��classmethodr�__class_getitem__�r%r#rr"s���4� �
L�L���L��+�L�I�L�L�L�%��!�'��&�L�L��
�5�5�"L�L�L�L�2��O�4H�l$�L�1�r%rc��eZdZ	dZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdZd�Zd�Zd�Zd�Zy)r�:Nc��	tj||||�tjj	|j
d�tjj	|j
d�tjj	|j
d�d�|_tjj|j
�sm|rVtj|j
d�|jj�D]}tj|d��nt|j
��i|_ddd�|_d|_
d|_y)	N�tmp�new�cur)r�r�r��r)r�r�g�������?)rr$rr�joinr�_paths�exists�mkdirr[r�_toc�_toc_mtimes�
_last_read�_skewfactor)r �dirnamer!r"rs     r#r$zMaildir.__init__s���,�����w���8��7�7�<�<��
�
�E�2��7�7�<�<��
�
�E�2��7�7�<�<��
�
�E�2����
�w�w�~�~�d�j�j�)��������U�+� �K�K�.�.�0�D��H�H�T�5�)�1�)����4�4���	�#$�Q�/��������r%c���	|j�}	|j||�t|�t|t�r?|j�}|j|j�z}||jk(rd}nd}d}tjj|j�j|j�d}tjj!|j"|||z�}t|t�rWt	j$|jtjj'|j�|j)�f�		t	j*|j|�t	j
|j�|S#t$r1|j�t	j
|j��wxYw#t,t.f$r$t	j0|j|�Y|SwxYw#t2$rP}t	j
|j�|j4t4j6k(rt9d|z���d}~wwxYw)N�r�rz$Name clash with existing message: %s)�_create_tmpr��
BaseExceptionrxrr0�name�_sync_closer�r�
get_subdir�colon�get_infor�basename�splitr�r�utime�getatime�get_date�link�AttributeError�PermissionError�rename�OSError�errno�EEXISTr)r r+�tmp_file�subdir�suffix�uniq�dest�es        r#r,zMaildir.add$s���2��#�#�%��	����w��1�
	�H���g�~�.��'�'�)�F��Z�Z�'�"2�"2�"4�4�F�����#����F��F��w�w����
�
�.�4�4�T�Z�Z�@��C���w�w�|�|�D�J�J���v�
�>���g�~�.��H�H�X�]�]��g�g�&�&�x�}�}�5�w�7G�7G�7I�J�
L�

	�
)�����
�
�t�,��	�	�(�-�-�(����G�	��N�N���I�I�h�m�m�$��	��0#�O�4�
/��	�	�(�-�-��.���
/���	��I�I�h�m�m�$��w�w�%�,�,�&�(�)O�+/�*0�1�1���
	�sB�F � G�?H� :G�/H�H�H�H�	I,�AI'�'I,c��	tjtjj|j|j|���yr)rr0rr�r�_lookupr.s  r#r0zMaildir.removeNs-��K�
�	�	�"�'�'�,�,�t�z�z�4�<�<��+<�=�>r%c�T�		|j|�y#ttf$rYywxYwr)r0r4�FileNotFoundErrorr.s  r#r5zMaildir.discardRs.��5�	��K�K�����+�,�	��	�s��'�'c���	|j|�}|j|�}|j|�}t|t�r|}n|}tj
j
|�}|j|vr,|j|j|j�dz}nd}|j|�tj
j|j|�}	tj
j|j|||z�}
t|t�rCt	j|	tj
j|	�|j�f�t	j|	|
�y)Nr�r�)r�r,r�rrrr�r�r�r5r�rr�r�r�r�)r r/r+�old_subpath�temp_key�temp_subpath�dominant_subpathr�r��tmp_path�new_paths           r#r8zMaildir.__setitem__Zs��L��l�l�3�'���8�8�G�$���|�|�H�-���g�~�.�+�� +�������!1�2���:�:�)�)��Z�Z�"2�"8�"8����"D�R�"H�H�F��F����S���7�7�<�<��
�
�L�9���7�7�<�<��
�
�F�C�&�L�A���g�~�.��H�H�X��g�g�&�&�x�0�'�2B�2B�2D�E�
G�
	�	�	�(�H�%r%c��	|j|�}ttjj	|j
|�d�5}|jr|j
|�}nt|�}ddd�tjj|�\}}j|�|j|vr-|j|j|j�d�|jtjjtjj	|j
|���|S#1swY��xYw)N�rbr�)r��openrrr�rrrr��
set_subdirr��set_info�set_date�getmtime)r r/�subpath�f�msgr�r�s       r#r>zMaildir.get_messageus���B��,�,�s�#��
�"�'�'�,�,�t�z�z�7�3�T�
:�a��}�}��m�m�A�&��$�Q�'��	;�
�w�w�}�}�W�-�������v���:�:����L�L����D�J�J�/��3�4����R�W�W�%�%�b�g�g�l�l�4�:�:�w�&G�H�I��
�;�
:�s�*D?�?Ec��	ttjj|j|j|��d�5}|j
�jtd�cddd�S#1swYyxYw)Nr�r)	r�rrr�rr�r�r�r��r r/r�s   r#rHzMaildir.get_bytes�sT��@�
�"�'�'�,�,�t�z�z�4�<�<��+<�=�t�
D���6�6�8�#�#�G�U�3�	4�	4�
D�
D�s�$A3�3A<c��	ttjj|j|j|��d�}t
|�S)Nr�)r�rrr�rr��
_ProxyFiler�s   r#rAzMaildir.get_file�s7��D�������d�j�j�$�,�,�s�*;�<�d�C���!�}�r%c#�K�	|j�|jD]}	|j|�|���y#t$rY�'wxYw�wr)�_refreshr�r�r4r.s  r#rOzMaildir.iterkeys�sK����+��
�
���9�9�C�
����S�!��I����
��
�s%�!A�<�A�	A�A�A�Ac�@�	|j�||jvSr)r�r�r.s  r#razMaildir.__contains__�s��G��
�
���d�i�i��r%c�N�	|j�t|j�Sr)r��lenr�rNs r#rczMaildir.__len__�s��8��
�
���4�9�9�~�r%c��	yrr�rNs r#rrz
Maildir.flush�s
��0�	
r%c��	yrr�rNs r#rtzMaildir.lock�s���r%c��	yrr�rNs r#rvzMaildir.unlock�s��1�r%c��	yrr�rNs r#rxz
Maildir.close�s��*�r%c�<�	g}tj|j�D]v}t|�dkDs�|ddk(s�tjjtjj
|j|��s�c|j|dd��x|S)N�r�.)r�listdirrr�r�isdirr��append�r rg�entrys   r#�list_folderszMaildir.list_folders�sr��,����Z�Z��
�
�+�E��5�z�A�~�%��(�c�/��w�w�}�}�R�W�W�\�\�$�*�*�e�<�=��
�
�e�A�B�i�(�,��
r%c��	ttjj|jd|z�|j
d��S)NrF�r!r")rrrr�rr�r �folders  r#�
get_folderzMaildir.get_folder�s5��=��r�w�w�|�|�D�J�J��f��=�#�}�}�#�%�	%r%c��	tjj|jd|z�}t	||j
��}tjj|d�}tjj
|�sItjtj|tjtjzd��|S)Nr�r!�
maildirfolder�)rrr�rrrr�rxr��O_CREAT�O_WRONLY)r rrrg�maildirfolder_paths     r#�
add_folderzMaildir.add_folder�s���L��w�w�|�|�D�J�J��f��5����t�}�}�5���W�W�\�\�$��@���w�w�~�~�0�1��H�H�R�W�W�/����b�k�k�1I���
��
r%c���	tjj|jd|z�}tjtjj|d��tjtjj|d��zD]&}t|�dks	|ddk7s�t
d|z��tj|�D]b}|dk7s�	|dk7s�|dk7s�tjjtjj||��s�St
d|�d	|����tj|d
��D]z\}}}|D]5}tjtjj||���7|D]5}tjtjj||���7�|tj|�y)Nrr�r�rrzFolder contains message(s): %sr�zFolder contains subdirectory 'z': F)�topdown)rrr�rrr�rr�walkr0�rmdir)r rrr�root�dirs�filess       r#�
remove_folderzMaildir.remove_folder�s\��;��w�w�|�|�D�J�J��f��5���Z�Z������T�5� 9�:��Z�Z������T�5� 9�:�;�E��5�z�A�~��q��S��#�$D�v�$M�N�N�;��Z�Z��%�E���~�%�5�.�U�e�^��w�w�}�}�R�W�W�\�\�$��6�7�#�%+�U�%4�5�5�&�
"$����u�!=��D�$�����	�	�"�'�'�,�,�t�U�3�4������������d�E�2�3��">�
	����r%c�~�	tj�}tjtjj	|j
d��D]h}tjj	|j
d|�}|tjj
|�z
dkDs�Ttj|��jy)Nr�i@�)�timerrrr�rr�r0)r �nowrrs    r#�cleanz
Maildir.clean�sx��(��i�i�k���Z�Z������T�Z�Z�� ?�@�E��7�7�<�<��
�
�E�5�9�D��R�W�W�%�%�d�+�+�f�4��	�	�$��Ar%rc	�d�	tj�}tj�}d|vr|jdd�}d|vr|jdd�}t	|��dt	|dzdz��dtj��d	tj�d
|��	}t
jj|jd|�}	tj|�t!d|z��#t$r9txjdz
c_	t|�cYS#t$rYnwxYwY�OwxYw)
N�/z\057r�z\072z.Mrg��.A�P�Qrr�z&Name clash prevented file creation: %s)r�socket�gethostnamer��intr�getpidr�_countrr�r�statr��_create_carefully�FileExistsErrorr)r r�hostnamer�rs     r#r�zMaildir._create_tmp�s��K��i�i�k���%�%�'���(�?��'�'��W�5�H��(�?��'�'��W�5�H�$'��H�c�#��'�C�-�.@�"�)�)�+�$+�N�N�H�>���w�w�|�|�D�J�J��t�4��	��G�G�D�M�!�!I�!%�"&�'�	'��!�	��N�N�a��N�
�(��.�.��"�
��
���	�s6�
C-�-"D/�
D�D/�	D)�&D/�(D)�)D/�.D/c��	tj�|jz
d|jzkDred}|jD]Q}tj
j
|j|�}||j|kDrd}||j|<�S|syi|_|jD]�}|j|}t	j|�D]�}tj
j||�}tj
j|�r�C|j|j�d}tj
j||�|j|<����tj�|_y)N�FTr)rr�r�r�rrr�r�r�rr�rr�r�)r �refreshr��mtimerr�pr�s        r#r�zMaildir._refreshs,��/��9�9�;����(�1�t�/?�/?�+?�?��G��*�*�����(�(����V�)<�=���4�+�+�F�3�3�"�G�+0�� � ��(�	+�
����	��&�&�F��;�;�v�&�D����D�)���G�G�L�L��u�-���7�7�=�=��#���{�{�4�:�:�.�q�1��"$�'�'�,�,�v�u�"=��	�	�$��*�'��)�)�+��r%c�d�		tjjtjj|j|j
|��r|j
|S	|j�	|j
|S#t$rY�+wxYw#t$rt
d|z�d�wxYw�N�No message with key: %s)rrr�r�rr�r4r�r.s  r#r�zMaildir._lookup&s���K�	��w�w�~�~�b�g�g�l�l�4�:�:�t�y�y��~�F�G��y�y��~�%�H�	
�
�
��	F��9�9�S�>�!��	�	��	��
�	F��4�s�:�;��E�	F�s�A"B�8B�	B�B�B/c��	t|d�s|j�|_		|t|j�S#t$rYyt
$rY�/wxYw)N�
_onetime_keys)rlrOr7�next�
StopIterationr4rNs r#r8zMaildir.next4sX��>��t�_�-�!%����D���
��D��!3�!3�4�5�5�� �
���
��
�s�=�	A�A�Ar�)r�r�r�r�r$r,r0r5r8r>rHrArOrarcrrrtrvrxrrrrr r)r�r�r�r8r�r%r#rrs���(��E��((�T?��&�6
�4�
�
� �
�

�����%���& ��F�'�0"&�HF�
r%rc�r�eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zdd�Zd�Zy)�_singlefileMailboxNc��	tj||||�	t|jd�}||_
d|_d|_d|_
d|_d|_d|_y#t$r�}|j
t
jk(r.|rt|jd�}nYt|j��|j
t
jt
jfvrt|jd�}n�Yd}~��d}~wwxYw)N�rb+zwb+r�rF)rr$r�rr�r��ENOENTr�EACCES�EROFS�_filer��	_next_key�_pending�
_pending_sync�_locked�_file_length)r rr!r"r�r�s      r#r$z_singlefileMailbox.__init__Ds���/�����t�W�f�5�	��T�Z�Z��'�A���
���	������
�"������ ����!�		��w�w�%�,�,�&���T�Z�Z��/�A�,�T�Z�Z�8�8����U�\�\�5�;�;�7�7�����T�*�����		�s�A#�#	D�,BD�Dc���	|j�|j|�|j|j<|xjdz
c_d|_|jdz
S)NrT)r��_append_messager�rBrDr*s  r#r,z_singlefileMailbox.add[sR��2�����$(�$8�$8��$A��	�	�$�.�.�!����!���"����~�~��!�!r%c�P�	|j|�|j|=d|_yr�)r�r�rCr.s  r#r0z_singlefileMailbox.removees#��K����S���I�I�c�N���
r%c�r�	|j|�|j|�|j|<d|_yr�)r�rHr�rCr7s   r#r8z_singlefileMailbox.__setitem__ks0��L����S���-�-�g�6��	�	�#����
r%c#�vK�	|j�|jj�Ed{���y7��wr)r�r�rRrNs r#rOz_singlefileMailbox.iterkeysqs&����+������9�9�>�>�#�#�#�s�/9�7�9c�@�	|j�||jvSr)r�r�r.s  r#raz_singlefileMailbox.__contains__vs��G������d�i�i��r%c�N�	|j�t|j�Sr)r�r�r�rNs r#rcz_singlefileMailbox.__len__{s��8������4�9�9�~�r%c�X�	|jst|j�d|_yyr�)rE�
_lock_filerArNs r#rtz_singlefileMailbox.lock�s$����|�|��t�z�z�"��D�L�r%c�X�	|jrt|j�d|_yy�NF)rE�_unlock_filerArNs r#rvz_singlefileMailbox.unlock�s$��1��<�<�����$� �D�L�r%c	��	|js)|jrt|j�d|_y|jj	dd�|jj�}||jk7rtd|j|fz��t|j�}	i}|j|�t|jj��D]�}|j|\}}|jj	|�|j|�|j�}	|jjt!d||jj�z
��}|sn|j#|��U||j�f||<|j%|���|j�|_t/|�|jj'�t)j0|j�}	t)j2|j,|	j4�	t)j6|j,|	j8|	j:�	t)j@|j,|j�tE|jd�|_||_d|_d|_|jFrtI|jd��yy#|j'�t)j*|j,��xYw#t<t>f$rY��wxYw#tB$rLt)j*|j�t)j@|j,|j�Y��wxYw)NFrr/z4Size of mailbox file changed (expected %i, found %i)�r=)�dotlock)%rCrD�_sync_flushrAr��tellrFr�_create_temporaryr�_pre_mailbox_hook�sortedr�rR�_pre_message_hookr��minr��_post_message_hookrxrr0r�r�r*�chmod�st_mode�chown�st_uid�st_gidr�r�r�r,r�rErO)
r �cur_len�new_file�new_tocr/�start�stop�	new_startr��infos
          r#rrz_singlefileMailbox.flush�s���0��}�}��!�!��D�J�J�'�%*��"��	
�
�
����1���*�*�/�/�#���d�'�'�'�$�&?�&*�&7�&7��%A�&B�C�
C�%�T�Z�Z�0��	��G��"�"�8�,��d�i�i�n�n�.�/��"�i�i��n���t��
�
����&��&�&�x�0�$�M�M�O�	��!�Z�Z�_�_�S��15��
�
���8I�1I�.K�L�F�!���N�N�6�*��!*�8�=�=�?�;�����'�'��1�0�!)�
�
��D��
	�H���
�
�����w�w�t�z�z�"��
���������-�	��H�H�X�]�]�D�K�K����=�	1��I�I�h�m�m�T�Z�Z�0��$�*�*�e�,��
���	���
�"����<�<��t�z�z�5�1���/	��N�N���I�I�h�m�m�$�����(�	��	���	1��I�I�d�j�j�!��I�I�h�m�m�T�Z�Z�0�	1�s2�,DK*�55L�+*L4�*2L�L1�0L1�4AN	�N	c��	yrr��r r�s  r#rYz$_singlefileMailbox._pre_mailbox_hook����:�r%c��	yrr�rks  r#r[z$_singlefileMailbox._pre_message_hook�s��;�r%c��	yrr�rks  r#r]z%_singlefileMailbox._post_message_hook�rlr%c��		|j�	|jr|j�|jj	�y#|jj	�wxYw#	|jr|j�|jj	�w#|jj	�wxYwxYwr)rrrErvrArxrNs r#rxz_singlefileMailbox.close�s��*�	#��J�J�L�
#��<�<��K�K�M��
�
� � �"���
�
� � �"��	
#��<�<��K�K�M��
�
� � �"���
�
� � �"�s.�A*�A�A'�*C�,B#�C�#B?�?Cc��	|j�|j�|�	|j|Sy#t$rtd|z�d�wxYwr4)r��
_generate_tocr4r.s  r#r�z_singlefileMailbox._lookup�s_��5��9�9����� ��?�
J��y�y��~�%����
J��8�3�>�?�T�I�
J�s	�1�A
c�F�	|jjdd�|jj�}t|j�dk(r'|j
s|j
|j�	|j|j�|j|�}|j|j�|jj�|jj�|_
|S#t$r|jj|��wxYw)Nrr/)rAr�rWr�r�rCrYr[�_install_messager]r��truncaterrrF)r r+�before�offsetss    r#rHz"_singlefileMailbox._append_message�s���I��
�
����1�������"���t�y�y�>�Q��t�}�}�

�"�"�4�:�:�.�	��"�"�4�:�:�.��+�+�G�4�G��#�#�D�J�J�/�	
�
�
���� �J�J�O�O�-�������	��J�J����'��	�s
�8AC:�:&D r�r)r�r�r�r$r,r0r8rOrarcrtrvrrrYr[r]rxr�rHr�r%r#r;r;AsX�� �!�."���$�
 �
�
 �!�B2�H���	#�J�r%r;c�6�eZdZ	dZd�Zdd�Zdd�Zdd�Zd�Zy)	�	_mboxMMDFTc���	|j|�\}}|jj|�|jj�j	t
d�j
d�}|jj||jj�z
�}|j|j	t
d��}|j|�|j|dd�|S)Nr%rrr�)r�rAr�r�r�r��decoder�rW�_message_factory�set_unixfrom�set_from)r r/rfrg�	from_line�stringr�s       r#r>z_mboxMMDF.get_message
s���B��l�l�3�'���t��
�
������J�J�'�'�)�1�1�'�3�?�F�F�w�O�	��������
�
���(9�!9�:���#�#�F�N�N�7�E�$B�C������#����Y�q�r�]�#��
r%c�n�	tj|j||��j|��S)N)�unixfromrE)r r/�from_s   r#rJz_mboxMMDF.get_strings3��A��'�'��N�N�3��&�(�(1�	�5�	�(A�	Br%c�2�	|j|�\}}|jj|�|s|jj�|jj	||jj�z
�}|j
td�S�Nr)r�rAr�r�r�rWr�r�)r r/r�rfrgrs      r#rHz_mboxMMDF.get_bytessm��A��l�l�3�'���t��
�
�������J�J���!��������
�
���(9�!9�:���~�~�g�u�-�-r%c��	|j|�\}}|jj|�|s|jj�t	|j|jj�|�Sr)r�rAr�r��_PartialFilerW)r r/r�rfrgs     r#rAz_mboxMMDF.get_file&sX��D��l�l�3�'���t��
�
�������J�J���!��D�J�J��
�
���(9�4�@�@r%c�L�	d}t|t�r|j|�}t|t�r:|j	d�r)|jd�}|dk7r|d|}||dzd}n�|}d}n|t|t�r%|j�jd�}d|z}nGt|tjj�r#|j�}|�|jd�}|�8dtjtj��j�z}|j j#�}|j j%|t&z�|j)||j |j*�|j j#�}||fS)Nr�rr�rr%rsFrom MAILER-DAEMON )r�r�r}r�r��find�_mboxMMDFMessage�get_fromrzrFr+r
�get_unixfromr�asctime�gmtimerArWr�r�r��
_mangle_from_)r r+r~�newline�authorrfrgs       r#rsz_mboxMMDF._install_message.sa��?��	��g�s�#��+�+�G�4�G��g�u�%�'�*<�*<�X�*F��l�l�5�)�G��"�}�#�H�W�-�	�!�'�A�+�,�/��#�	���
��!1�
2��%�%�'�.�.�w�7�F� �6�)�I�
�����!6�!6�
7��,�,�.�I��$�%�,�,�W�5�	���.����d�k�k�m�1L�1S�1S�1U�U�I��
�
���!���
�
����W�,�-����7�D�J�J��0B�0B�C��z�z��� ���t�}�r%Nr�)	r�r�r�r�r>rJrHrArsr�r%r#rxrxs%��"��M�	�B�
.�A�r%rxc�*�eZdZ	dZdZdd�Zd�Zd�Zy)rTNc�L�	t|_tj||||�yr)rr{rxr$rs    r#r$z
mbox.__init__T�!��)� +������4��w��7r%c�0�	|jt�yr�r�r�rks  r#r]zmbox._post_message_hookYs��:�	����r%c���	gg}}d}|jjd�	|jj�}|jj�}|j	d�r`t|�t|�kr5|r"|j
|tt�z
�n|j
|�|j
|�d}nF|s6|r"|j
|tt�z
�n|j
|�n|tk(rd}nd}��ttt||���|_t|j�|_|jj�|_
y)NFrTr�)rAr�rWr�r�r�rr��dict�	enumerate�zipr�rBrF)r �starts�stops�last_was_empty�line_posr�s      r#rqzmbox._generate_toc]s��>��B������
�
�������z�z���(�H��:�:�&�&�(�D����x�(��u�:��F��+�%����X��G��%<�=�
���X�.��
�
�h�'�!&���!��L�L��C��L�!8�9��L�L��*�����!%��!&��/�0��3�v�u�#5�6�7��	��T�Y�Y���� �J�J�O�O�-��r%r�)r�r�r�r�r�r$r]rqr�r%r#rrKs ��!��M��O�8�
�.r%rc�(�eZdZ	dd�Zd�Zd�Zd�Zy)r	Nc�L�	t|_tj||||�yr)rr{rxr$rs    r#r$z
MMDF.__init__�r�r%c�6�	|jdtz�y�N�r�rks  r#r[zMMDF._pre_message_hook�s��;�	���#�g�-�.r%c�D�	|jtdztz�yr�r�rks  r#r]zMMDF._post_message_hook�s��:�	����-�-��7�8r%c���	gg}}|jjd�d}	|}|jj�}|jj�}|j	dt
z�r�|j
|�	|}|jj�}|jj�}|dt
zk(r"|j
|tt
�z
�n|s|j
|�n�y|sn��ttt||���|_t|j�|_|jjdd�|jj�|_
y)Nrr�r/)rAr�r�rWr�r�rr�r�r�r�r�rBrF)r r�r��next_posr�r�s      r#rqzMMDF._generate_toc�s-��>��B����
�
���������H��:�:�&�&�(�D��z�z���(�H����2�W�<�=��
�
�h�'��'�H��:�:�.�.�0�D�#�z�z���0�H��2�W�<�<����X��G��%<�=��!����X�.�����#�$��3�v�u�#5�6�7��	��T�Y�Y�����
�
����1�� �J�J�O�O�-��r%r�)r�r�r�r$r[r]rqr�r%r#r	r	s���8�
/�9�.r%r	c��eZdZ	dd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)rNc��	tj||||�tjj	|j
�s�|r�tj|j
d�tjtjtjj|j
d�tjtjztjzd��d|_yt|j
��d|_y)Nr��
.mh_sequencesi�F)rr$rrr�rr�rxr�r�r�O_EXCLrrrErs    r#r$zMH.__init__�s���(�����t�W�f�5��w�w�~�~�d�j�j�)��������U�+������������d�j�j�/�!J�!#���b�i�i�!7�"�+�+�!E�u�N�O����)����4�4���r%c��	|j�}t|�dk(rd}nt|�dz}tjj|jt|��}t|�}d}	|jrt|�		|j||�t!|t"�r|j%||�|jrt|�	|st|�|S#t$r;|jrt|�t|�d}tj|��wxYw#|jrt|�wwxYw#|st|�wwxYw)NrrFT)rRr��maxrrr�rr�r+rErOr�r�rRr�r0r�r
�_dump_sequences)r r+rR�new_keyr�r��closeds       r#r,zMH.add�s ��2��y�y�{���t�9��>��G��$�i�!�m�G��7�7�<�<��
�
�C��L�9���h�'����	��|�|��1�
�
$�	��&�&�w��2��g�y�1��(�(��'�:��<�<� ��O���A�����!%���|�|�$�Q����N�!�F��I�I�h�'�����<�<� ��O� ����A���s7�2E
�C&�"D-�?E
�&AD*�*D-�-E�E
�
Ec�J�	tjj|jt	|��}	t|d�}|j
�tj|�y#t$r1}|jtjk(rtd|z���d}~wwxYw�Nr=r5)rrr�rr�r�rxr0r�r�r>r4)r r/rr�r�s     r#r0z	MH.remove�s~��K��w�w�|�|�D�J�J��C��1��		��T�5�!�A�
�G�G�I��I�I�d�O���	��w�w�%�,�,�&��8�3�>�?�?���		�s�A(�(	B"�1,B�B"c���	tjj|jt	|��}	t|d�}	|jrt|�	tjtj
|tjtjz��|j||�t!|t"�r|j%||�|jrt'|�	t)|�y#t$r1}|jtjk(rtd|z���d}~wwxYw#|jrt'|�wwxYw#t)|�wxYwr�)rrr�rr�r�r�r�r>r4rErOrxr�O_TRUNCr�r�r
r�rRr�)r r/r+rr�r�s      r#r8zMH.__setitem__�s��L��w�w�|�|�D�J�J��C��1��	��T�5�!�A�	��|�|��1�
�
$��������r�{�{�R�Z�Z�'?�@�A��"�"�7�A�.��g�y�1��(�(��#�6��<�<� ��O���N��#�	��w�w�%�,�,�&��8�3�>�?�?���		���<�<� ��O� ��
��N�s<�C;�E�A<D8�E�;	D5�,D0�0D5�8E�E�
E"c���		|jr>ttjj	|j
t
|��d�}n=ttjj	|j
t
|��d�}|5|jrt|�	t|�}|jrt|�	ddd�|j�j�D]\}}||vs�j!|��S#t$r1}|jtjk(rtd|z���d}~wwxYw#|jrt|�wwxYw#1swY��xYw)Nr=r�r5)rEr�rrr�rr�r�r�r>r4rOr
rR�
get_sequencesr_�add_sequence)r r/r�r�r�r��key_lists       r#r>zMH.get_messages��B�		��|�|�������d�j�j�#�c�(�;�U�C��������d�j�j�#�c�(�;�T�B����|�|��1�
�
$���l���<�<� ��O��#�0�0�2�8�8�:�N�D�(��h��� � ��&�;��
��!�	��w�w�%�,�,�&��8�3�>�?�?���		���<�<� ��O� ��
�Q�s<�BD�E(�%E�0E(�	E�,E�E�E%�%E(�(E1c��		|jr>ttjj	|j
t
|��d�}n=ttjj	|j
t
|��d�}|5|jrt|�	|j�jtd�|jrt|�cddd�S#t$r1}|jtjk(rtd|z���d}~wwxYw#|jrt|�wwxYw#1swYyxYw)Nr=r�r5r)rEr�rrr�rr�r�r�r>r4rOr�r�r�rR�r r/r�r�s    r#rHzMH.get_bytess���@�		��|�|�������d�j�j�#�c�(�;�U�C��������d�j�j�#�c�(�;�T�B����|�|��1�
�
$��v�v�x�'�'���7��<�<� ��O�	$�	$���	��w�w�%�,�,�&��8�3�>�?�?���		���<�<� ��O� ��
�Q�s<�BC)�E�%#D&�E�)	D#�2,D�D#�&E�E�Ec��		ttjj|jt|��d�}t|�S#t$r1}|jtjk(rtd|z���d}~wwxYw)Nr�r5)r�rrr�rr�r�r�r>r4r�r�s    r#rAzMH.get_file1so��D�	��R�W�W�\�\�$�*�*�c�#�h�7��>�A��!�}����	��w�w�%�,�,�&��8�3�>�?�?���		�s�=A�	B�,B�Bc�t�	ttd�tj|j�D���S)Nc3�RK�|]}|j�r
t|����!y�wr)�isdigitr')�.0rs  r#�	<genexpr>zMH.iterkeys.<locals>.<genexpr>>s%����:�3I�%�).�����u�:�3I�s�%')�iterrZrrrrNs r#rOzMH.iterkeys<s2��+��F�:�2�:�:�d�j�j�3I�:�:�;�	;r%c��	tjjtjj|jt|���Sr)rrr�r�rr�r.s  r#razMH.__contains__As/��G��w�w�~�~�b�g�g�l�l�4�:�:�s�3�x�@�A�Ar%c�H�	tt|j���Sr)r�rQrOrNs r#rcz
MH.__len__Es��8��4��
�
��(�)�)r%c���	|jsVttjj	|j
d�d�|_t|j�d|_yy)Nr�r=T)rEr�rrr�rrArOrNs r#rtzMH.lockIsE����|�|��b�g�g�l�l�4�:�:��G��O�D�J��t�z�z�"��D�L�r%c��	|jr4t|j�t|j�|`d|_yyrQ)rErRrAr�rNs r#rvz	MH.unlockPs5��1��<�<�����$���
�
�#��
� �D�L�	r%c��	yrr�rNs r#rrzMH.flushXs��4�r%c�@�	|jr|j�yyr)rErvrNs r#rxzMH.close\s��*��<�<��K�K�M�r%c��	g}tj|j�D][}tjj	tjj|j|��s�K|j
|��]|Sr)rrrrrr�rrs   r#rzMH.list_foldersasW��,����Z�Z��
�
�+�E��w�w�}�}�R�W�W�\�\�$�*�*�e�<�=��
�
�e�$�,��
r%c��	ttjj|j|�|j
d��S)NFr	�rrrr�rrr
s  r#rz
MH.get_folderis0��9��"�'�'�,�,�t�z�z�6�2��-�-��7�	7r%c��	ttjj|j|�|j
��S)Nrr�r
s  r#rz
MH.add_folderns.��H��"�'�'�,�,�t�z�z�6�2��-�-�)�	)r%c�^�	tjj|j|�}tj|�}|dgk(r4tj
tjj|d��n|gk(rnt
d|jz��tj|�y)Nr�zFolder not empty: %s)rrr�rrr0rr)r rr�entriess    r#rzMH.remove_folderss{��;��w�w�|�|�D�J�J��/���*�*�T�"����'�'��I�I�b�g�g�l�l�4��9�:�
��]��� 6���� C�D�D�
����r%c
���	i}ttjj|jd�dd��5}t|j
��}|D]�}	|jd�\}}t�}|j�D]f}|j�r|jt|���.d�|jd�D�\}	}
|jt|	|
dz���ht|�D�cgc]}||vr|��
c}||<t||�d	k(r||=��	ddd�|Scc}w#t$rt!d
|j#�z��wxYw#1swY|SxYw)Nr��r�ASCII��encodingr�c3�2K�|]}t|����y�wr)r')r��xs  r#r�z#MH.get_sequences.<locals>.<genexpr>�s����*K�?�a�3�q�6�?�s��-rrz"Invalid sequence specification: %s)r�rrr�r�setrRr�r�r,r'rp�rangerZr�r|r�rstrip)r �resultsr��all_keysr�r��contentsrR�specrfrgr/s            r#r�zMH.get_sequencessN��K���
�"�'�'�,�,�t�z�z�?�;�S�7�
S�WX��4�9�9�;�'�H���5�%)�Z�Z��_�N�D�(��5�D� (��� 0���<�<�>� �H�H�S��Y�/�*K�4�:�:�c�?�*K�K�E�4� �K�K��e�T�A�X�(>�?�!1�5;�4�L�%=�L�S�,/�8�O�&)�L�%=�G�D�M��7�4�=�)�Q�.�#�D�M���T�&���%=��"�5�%�&J�&*�k�k�m�'4�5�5�5��!T�&��s6�E �B$D7�>
D2�D7�%E �2D7�7&E�E � E*c��	ttjj|jd�dd��}	tj
tj|jtjtjz��|j�D]�\}}t|�dk(r�|j|dz�d}d}tt|��D]Q}|dz
|k(r|sCd	}|jd
�n/|rd}|j|�d|���n|jd|z�|}�S|r|jt|�d
z���|jd
���	t|�y#t|�wxYw)Nr�zr+r�r�rr�FrTr�� z %s�
)r�rrr�rrxr�rr�r_r�r�rZr�r�r�)r �	sequencesr�r�rR�prev�
completingr/s        r#�
set_sequenceszMH.set_sequences�s%��H�������d�j�j�/�:�D�7�S��	��H�H�R�W�W�Q�V�V�R�[�[�2�:�:�%=�>�?�'�o�o�/�
��d��t�9��>������s�
�#���"�
�!�#�d�)�,�C��Q�w�$��)�)-�J��G�G�C�L�#�%*�
����4�� 5�6�������,��D�-���G�G�C��I��,�-��G�G�D�M�)0�,
��N��K��N�s�D*E0�0
E=c��	|j�}d}g}|j�D]�}|dz
|k7r�|j||dzf�	tjtj
j
|jt|��tj
j
|jt|dz���tjtj
j
|jt|���|dz
}��|dz|_
t|�dk(ry|j�D](\}}|D]\}}||vs�|||j!|�<� �*|j#|�y#ttf$r~tjtj
j
|jt|��tj
j
|jt|dz���Y��wxYw)Nrr)r�rOrrr�rr�rr��unlinkr�r�r�rBr�r_�indexr�)	r r�r��changesr/r�r��oldr�s	         r#�packzMH.pack�s���M��&�&�(�	������=�=�?�C��Q�w�$������T�A�X��/�B��G�G�B�G�G�L�L����S��X�>��G�G�L�L����S����]�C�E��I�I�b�g�g�l�l�4�:�:�s�3�x�@�A��A�I�D�#�������w�<�1���'�o�o�/�N�D�(�#���S��(�?�47�H�X�^�^�C�0�1�$�0�	
���9�%��'��8�G��I�I�b�g�g�l�l�4�:�:�s�3�x�@� �g�g�l�l�4�:�:�s�4�!�8�}�E�G�G�s�A;E6�6B
H�Hc��	|j�}|j�}|j�D]2\}}||vr|j|��||vs�!||j|�=�4|D]
}||vs�|g||<�|j	|�yr)r�r_rr�r�)r r+r/�pending_sequences�
all_sequencesr�r��sequences        r#r�zMH._dump_sequences�s���I�#�1�1�3���*�*�,�
�+�1�1�3�N�D�(��(�(�����$�����X�^�^�C�0�1�	4�
*�H��}�,�+.�%�
�h�'�*�	
���=�)r%r�)r�r�r�r$r,r0r8r>rHrArOrarcrtrvrrrxrrrrr�r�r�r�r�r%r#rr�su���
� �D��0�2$�*	�;�
B�*� �!���
�7�
)�

��0�:&�4*r%rc�r�eZdZ	ehd��Zdd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zy)r>�filed�edited�resent�unseen�deleted�answered�	forwardedNc�D�	tj||||�i|_yr)r;r$�_labelsrs    r#r$zBabyl.__init__�s ��)��#�#�D�$���@���r%c��	tj||�}t|t�r|j	�|j
|<|Sr)r;r,r�r�
get_labelsr�)r r+r/s   r#r,z	Babyl.add�s=��2� �$�$�T�7�3���g�|�,� '� 2� 2� 4�D�L�L����
r%c�j�	tj||�||jvr|j|=yyr)r;r0r�r.s  r#r0zBabyl.remove�s2��K��!�!�$��,��$�,�,�����S�!�r%c��	tj|||�t|t�r|j	�|j
|<yyr)r;r8r�rr�r�r7s   r#r8zBabyl.__setitem__�s=��L��&�&�t�S�'�:��g�|�,� '� 2� 2� 4�D�L�L���-r%c��	|j|�\}}|jj|�|jj�t	j
�}	|jj�}|dtzk(s|sn&|j|jtd���Ot	j
�}	|jj�}|tk(s|sn&|j|jtd���L||jj�z
}|jj|�}|jtd�}t|j�|z�}	|	j|j��||jvr|	j|j|�|	S�N�*** EOOH ***r)r�rAr�r�r�r�r�r�r�rWr�rr��set_visibler��
set_labels)
r r/rfrg�original_headersr��visible_headers�n�bodyr�s
          r#r>zBabyl.get_message�sa��B��l�l�3�'���t��
�
������
�
�����:�:�<����:�:�&�&�(�D����0�0����"�"�4�<�<���#?�@�	�
�*�*�,����:�:�&�&�(�D��w��d���!�!�$�,�,�w��">�?�	�
�4�:�:�?�?�$�$���z�z���q�!���|�|�G�U�+���+�4�4�6��=�>������0�0�2�3��$�,�,���N�N�4�<�<��,�-��
r%c�t�	|j|�\}}|jj|�|jj�t	j
�}	|jj�}|dtzk(s|sn&|j|jtd���O	|jj�}|tk(s|sn�'|j�}||jj�z
}|jj|�}|jtd�}||zSr�)r�rAr�r�r�r�r�r�r�r�rWr�)	r r/rfrgr�r��headersrr�s	         r#rHzBabyl.get_bytess��A��l�l�3�'���t��
�
������
�
�����:�:�<����:�:�&�&�(�D����0�0����"�"�4�<�<���#?�@�	�
��:�:�&�&�(�D��w��d���#�+�+�-���4�:�:�?�?�$�$���z�z���q�!���|�|�G�U�+����~�r%c�t�	tj|j|�jdt��Sr�)r�r�rHr�r�r.s  r#rAzBabyl.get_file-s*��D��z�z�$�.�.��-�5�5�e�W�E�F�Fr%c���	|j�t�}|jj�D]}|j	|��|j|j�t|�Sr)r�r�r�r[rp�difference_update�_special_labelsrQ)r �labels�
label_lists   r#r�zBabyl.get_labels1sV��B���������,�,�-�-�/�J��M�M�*�%�0�� � ��!5�!5�6��F�|�r%c�B�	gg}}|jjd�d}g}	|}|jj�}|jj�}|dtzk(r�t|�t|�kr!|j
|tt�z
�|j
|�|jj�ddjd�D�cgc]"}|j�r|j���$}}|j
|�nn|dk(s|dtzk(r9t|�t|�krF|j
|tt�z
�n$|s"|j
|tt�z
�n��dttt||���|_tt|��|_
t|j�|_|jjdd�|jj�|_ycc}w)Nrsr�,�r/)rAr�r�rWr�r�rr��stripr�r�r�r�r�rBrF)	r r�r�r��label_listsr�r��labelr	s	         r#rqzBabyl._generate_toc:s���>��B����
�
�����������H��:�:�&�&�(�D��z�z���(�H��{�W�,�,��u�:��F��+��L�L��C��L�!8�9��
�
�h�'�+/�:�:�+>�+>�+@���+D�+J�+J�4�+P�:�+P�-2�+0�;�;�=� �+�+�-�+P��:��"�"�6�*����D�G�g�,=�$=��u�:��F��+��L�L��C��L�!8�9�����X��G��4�5��#�$��3�v�u�#5�6�7��	��I�k�2�3����T�Y�Y�����
�
����1�� �J�J�O�O�-����:s�'Hc���	dtz}|dtzz
}|j�}d�|D�}|ddj|�ztzz
}|dz
}|j|�y)NsBABYL OPTIONS:s
Version: 5c3�<K�|]}|j����y�wr)rz)r�rs  r#r�z*Babyl._pre_mailbox_hook.<locals>.<genexpr>]s����5�f�U�%�,�,�.�f�s�sLabels:rr
)r�r�r�r�)r r��babylr	s    r#rYzBabyl._pre_mailbox_hookXsf��:�!�G�+��
���(�(�����"��5�f�5��
��d�i�i��/�/�'�9�9��
����	����r%c�6�	|jdtz�y)N�r�rks  r#r[zBabyl._pre_message_hookbs��;�	����'�!�"r%c�6�	|jtdz�y)Nr
r�rks  r#r]zBabyl._post_message_hookfs��:�	����'�!�"r%c��	|jj�}t|t��r	g}g}|j	�D]3}||j
vr|j
|��#|j
|��5|jjd�|D].}|jjd|j�z��0|jjd�|D]1}|jjd|j�zdz��3|jjt�n"|jjdtz�t|tjj��rtj�}tjj!|dd�}|j#|�|j%d�	|j'�}|jj|j)d
t��|d
k(s|sn�H|jjdtz�t|t�r�tj�}	tjj!|	dd�}
|
j#|j+��	|	j'�}|jj|j)d
t��|d
k(s|sn[�H|j%d�	|j'�}|jj|j)d
t��|d
k(s|sn�H	|j-d�}|s�n�|jj|j)d
t���Et|t.t0tj2f��r�t|tj2�r+t5j6d
t8d�|j;�}t|t0�r|j=|�}|j?d�dz}|dz
dk7r�|jj|d|j)d
t��|jjdtz�|jj|d|j)d
t��|jj||dj)d
t���n|jjdtztz�|jj|j)d
t���n�tA|d��r�tA|d�r't5j6dt8d�|jB}|j�}
d	}	|j'�}|jEd�r	|ddd
z}n|jEd�r|ddd
z}|jj|j)d
t��|d
k(s|s9|r6d}|jjdtz�|j%|
�nn��	|j'�}|sn�|jEd�r
|ddtz}n;|jEd�r
|ddtz}n|jEd
�r|ddtz}|jj|���tGdtI|�z��|jj�}||fS)N�1s, s,,� rs1,,FrTrr�rTr�r�s

r/r�r�r�r�r�r�r�r�)%rArWr�rr�rrr�rzr�rFr+r
r�r�r�r�r�r�r�r��get_visibler�r�r�r�r�r�r�r�r}r�rlr�r�r�r�)r r+rf�special_labelsr	r�orig_buffer�orig_generatorr��
vis_buffer�
vis_generatorr��
body_start�original_pos�
first_passrgs                r#rszBabyl._install_messagejs���>��
�
���!���g�|�,��N��F� �+�+�-���D�0�0�0�"�)�)�%�0��M�M�%�(�	.�

�J�J���T�"�'���
�
� � ������!7�8�(��J�J���U�#����
�
� � ������!6��!=�>� ��J�J���W�%��J�J���V�g�-�.��g�u�}�}�4�4�5��*�*�,�K�"�_�_�;�;�K��PQ�R�N��"�"�7�+����Q���"�+�+�-���
�
� � ����e�W�!=�>��5�=���	�

�J�J���_�w�6�7��'�<�0��Z�Z�\�
� %��� >� >�z�5�RS� T�
��%�%�g�&9�&9�&;�<��%�.�.�0�D��J�J�$�$�T�\�\�%��%A�B��u�}�D��	�� � ��#��&�/�/�1�D��J�J�$�$�T�\�\�%��%A�B��u�}�D��	�
�$�)�)�$�/�����
�
� � �����w�!?�@�	�
��%��b�k�k�!:�
;��'�2�;�;�/��
�
�*�+=�q�B�!�*�*�,���'�3�'��/�/��8�� ���g�.��2�J��A�~��#��
�
� � ���*�!5�!=�!=�e�W�!M�N��
�
� � ��7�!:�;��
�
� � ���*�!5�!=�!=�e�W�!M�N��
�
� � ����!5�!=�!=�e�W�!M�N��
�
� � ��7�!:�W�!D�E��
�
� � ������!@�A�
�W�j�
)��w��)��
�
�5�6H�!�M�!�.�.��"�<�<�>�L��J���'�'�)���=�=��)����9�u�,�D��]�]�5�)����9�u�,�D��
�
� � ����e�W�!=�>��5�=��!�%*�
��
�
�(�(��7�)B�C����\�2�����'�'�)�����=�=��)����9�w�.�D��]�]�5�)����9�w�.�D��]�]�5�)����9�w�.�D��
�
� � ��&���6��g��F�G�G��z�z��� ���t�}�r%r�)r�r�r��	frozensetrr$r,r0r8r>rHrAr�rqrYr[r]rsr�r%r#rr�sY��'��!B�C�O��
�"�5��8�,G��.�<�#�#�ir%rc�"�eZdZ	dd�Zd�Zd�Zy)r
Nc��	t|tjj�rG|j	tj|��t|t�r|j|�yyt|t�r%|j	tj|��yt|t�r%|j	tj|��yt|tj�r%|j	tj|��yt|d�r%|j	tj |��y|�*tjjj#|�yt%dt'|�z��)Nr�r�)r�rFr+r
�_become_message�copy�deepcopy�_explain_tor�rGr��message_from_stringr��
TextIOWrapper�message_from_filerl�message_from_binary_filer$r�r�r*s  r#r$zMessage.__init__�s��,��g�u�}�}�4�4�5�� � ����w�!7�8��'�7�+��#�#�D�)�,�
���
'�� � ��!9�!9�'�!B�C�
���
%�� � ��!:�!:�7�!C�D�
���!1�!1�
2�� � ��!8�!8��!A�B�
�W�f�
%�� � ��!?�!?��!H�I�
�_��M�M�!�!�*�*�4�0��6��g��F�G�Gr%c��	t|dg�}|jD]#}||vs�|j||j|<�%y)N�_type_specific_attributes)�getattr�__dict__)r r+�
type_specificr�s    r#r&zMessage._become_message�sE��>���)D�b�I�
��$�$�D��=�(�&-�&6�&6�t�&<��
�
�d�#�%r%c�<�	t|t�rytd��)Nz Cannot convert to specified type)r�r
r�r*s  r#r)zMessage._explain_to�s��H��g�w�'���>�?�?r%r)r�r�r�r$r&r)r�r%r#r
r
�s��:�H�&=�@r%r
c�`�eZdZ	gd�Zdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zy)r)�_subdir�_info�_dateNc��	d|_d|_tj�|_tj||�y)Nr�r�)r5r6rr7r
r$r*s  r#r$zMaildirMessage.__init__s0��3������
��Y�Y�[��
�����w�'r%c��	|jSr)r5rNs r#r�zMaildirMessage.get_subdirs��$��|�|�r%c�D�	|dk(s|dk(r||_ytd|z��)Nr�r�z!subdir must be 'new' or 'cur': %s)r5r|)r r�s  r#r�zMaildirMessage.set_subdirs*��+��U�?�f��o�!�D�L��@�6�I�J�Jr%c�Z�	|jjd�r|jddSy)N�2,r/r�)r6r�rNs r#�	get_flagszMaildirMessage.get_flagss*��8��:�:� � ��&��:�:�a�b�>�!�r%c�J�	ddjt|��z|_y)Nr<r�)r�rZr6)r �flagss  r#�	set_flagszMaildirMessage.set_flagss��7��B�G�G�F�5�M�2�2��
r%c��	|jdjt|j��t|�z��y�Nr��r@r�r�r=�r �flags  r#�add_flagzMaildirMessage.add_flag�/��<����r�w�w�s�4�>�>�#3�4�s�4�y�@�A�Br%c��	|j�rD|jdjt|j��t|�z
��yyrB)r=r@r�r�rDs  r#�remove_flagzMaildirMessage.remove_flag!s>��E��>�>���N�N�2�7�7�3�t�~�~�'7�#8�3�t�9�#D�E�F�r%c��	|jSr)r7rNs r#r�zMaildirMessage.get_date&s��J��z�z�r%c�`�		t|�|_y#t$rtd|z�d�wxYw)Nzcan't convert to float: %s)�floatr7r|r�)r �dates  r#r�zMaildirMessage.set_date*s:��G�	K��t��D�J���	K��8�4�?�@�d�J�	K�s��-c��	|jSr)r6rNs r#r�zMaildirMessage.get_info1s��3��z�z�r%c�b�	t|t�r||_ytdt	|�z��)Nzinfo must be a string: %s)r�r�r6r�r�)r ris  r#r�zMaildirMessage.set_info5s+��.��d�C� ��D�J��7�$�t�*�D�E�Er%c��	t|t�r^|j|j��|j	|j��|j
|j��yt|t�r�t|j��}d|vr|jd�|j�dk(r|jd�d|vr|jd�d|vr|jd�d|vr|jd�|jd	tj|j���yt|t�rZt|j��}d|vr|jd
�d|vr|jd�d|vr|jd�yyt|t �rot|j��}d|vr|j#d
�d|vr|j#d
�d|vr|j#d�d|vr|j#d�yyt|t$�ryt'dt)|�z��)N�S�Rr��O�T�D�F�A�
MAILER-DAEMONr��replied�flaggedr�r�r#r��$Cannot convert to specified type: %s)r�rr@r=r�r�r�r�r�r�rFr}rr�r
r�r�	add_labelr
r�r�)r r+r?s   r#r)zMaildirMessage._explain_to<s���I��g�~�.����d�n�n�.�/����t���0�1����T�]�]�_�-�
��!1�
2�����(�)�E��e�|�� � ��%���� �E�)�� � ��%��e�|�� � ��%��e�|�� � ��%��e�|�� � ��%����_�d�k�k�$�-�-�/�.J�K�
���
+�����(�)�E��%���$�$�X�.��e�|��$�$�Y�/��e�|��$�$�Y�/��
���
.�����(�)�E��%���!�!�(�+��e�|��!�!�)�,��e�|��!�!�*�-��e�|��!�!�+�.��
���
)���B� ��M�*�+�
+r%r)r�r�r�r/r$r�r�r=r@rFrIr�r�r�r�r)r�r%r#rr�sL��3� =��(��K��3�C�G�
�K��F�)+r%rc�H�eZdZ	dgZdd�Zd�Zdd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)r��_fromNc��	|jdd�t|tjj�r7|j�}|�%|j
d�r|j|dd�tj||�y)NrXTzFrom r�)r}r�rFr+r
r�r�r$)r r+r�s   r#r$z_mboxMMDFMessage.__init__msj��5��
�
�o�t�,��g�u�}�}�4�4�5��+�+�-�H��#��(;�(;�G�(D��
�
�h�q�r�l�+�����w�'r%c��	|jSr)r^rNs r#r�z_mboxMMDFMessage.get_fromvs��.��z�z�r%c�~�	|�3|durtj�}|dtj|�zz
}||_y)NTr�)rr�r�r^)r r��time_s   r#r}z_mboxMMDFMessage.set_fromzs<��L�����}����
���S�4�<�<��.�.�.�E���
r%c�N�	|jdd�|jdd�zS)N�Statusr��X-Status)r<rNs r#r=z_mboxMMDFMessage.get_flags�s&��8��x�x��"�%�����R�(@�@�@r%c��	t|�}d\}}dD]}||vs�||z
}|j|��dD]}||vs�||z
}|j|��|djt|��z
}	|j	d|�	|j	d|�y#t
$r|j
d|�Y�1wxYw#t
$r|j
d|�YywxYw)N)r�r�)rRrS)rUrVrWr�rdre)r�r0r�rZ�replace_headerr4�
add_header)r r?�status_flags�
xstatus_flagsrEs     r#r@z_mboxMMDFMessage.set_flags�s���7��E�
��&,�#��m��D��u�}���$�����T�"��$�D��u�}���%�
����T�"�$�	�������/�/�
�	4�����,�7�	7����
�M�:���	4��O�O�H�l�3�	4���	7��O�O�J�
�6�	7�s$�4B�B;�B8�7B8�;C�Cc��	|jdjt|j��t|�z��yrBrCrDs  r#rFz_mboxMMDFMessage.add_flag�rGr%c��	d|vsd|vrD|jdjt|j��t|�z
��yy)Nrdrer�rCrDs  r#rIz_mboxMMDFMessage.remove_flag�sC��E��t��z�T�1��N�N�2�7�7�3�t�~�~�'7�#8�3�t�9�#D�E�F� 2r%c���	t|t�r�t|j��}d|vr|j	d�d|vr|jd�d|vr|jd�d|vr|jd�d|vr|jd�|d	=|d
=dj
|j�j�dd�}	|jtjtj|d
���yt|t �r?|j#|j��|j%|j��yt|t&�r_t|j��}d|vr|j)d�d|vr|j)d�d|vr|j)d�|d	=|d
=yt|t*�r_t|j��}d|vr|j-d�d|vr|j-d�d|vr|j-d�|d	=|d
=yt|t.�ryt1dt3|�z��#ttf$rYywxYw)NrSr�rVrWrRrQrUrT�statuszx-statusr����z%a %b %d %H:%M:%S %Yr�rYrZr�r�r[)r�rr�r=r�rFr�r�r�r��calendar�timegmr�strptimer|�
OverflowErrorr�r@r}r
r�rr\r
r�r�)r r+r?�
maybe_dates    r#r)z_mboxMMDFMessage._explain_to�s<��O��g�~�.�����(�)�E��e�|��"�"�5�)��e�|�� � ��%��e�|�� � ��%��e�|�� � ��%��e�|�� � ��%���!��
�#����$�-�-�/�"7�"7�"9�"�#�">�?�J�
�� � �������z�6L�2N�"O�P���!1�
2����d�n�n�.�/����T�]�]�_�-�
���
+�����(�)�E��%���$�$�X�.��e�|��$�$�Y�/��e�|��$�$�Y�/���!��
�#�
���
.�����(�)�E��%���!�!�(�+��e�|��!�!�)�,��e�|��!�!�*�-���!��
�#�
���
)���B� ��M�*�+�
+��9�
�.�
��
�s�8I�I+�*I+r)r�r�r�r/r$r�r}r=r@rFrIr)r�r%r#r�r�hs8��9�!(�	��(���A�7�,C�G�
1+r%r�c��eZdZy)rN�r�r�r�r�r%r#rr����0r%rc�:�eZdZ	dgZd	d�Zd�Zd�Zd�Zd�Zd�Z	y)
r
�
_sequencesNc�@�	g|_tj||�yr)ryr
r$r*s  r#r$zMHMessage.__init__�s��/��������w�'r%c�"�	|jddSr)ryrNs r#r�zMHMessage.get_sequences�s��B����q�!�!r%c�&�	t|�|_yr)rQry)r r�s  r#r�zMHMessage.set_sequences�s��A��y�/��r%c��	t|t�r+||jvr|jj|�yyt	dt|�z��)Nzsequence type must be str: %s)r�r�ryrr�r��r r�s  r#r�zMHMessage.add_sequence�sI��F��h��$��t���.����&�&�x�0�/��;�d�8�n�L�M�Mr%c�\�		|jj|�y#t$rYywxYwr)ryr0r|r~s  r#�remove_sequencezMHMessage.remove_sequence�s.��O�	��O�O�"�"�8�,���	��	����	+�+c�~�	t|t�r}t|j��}d|vr|j	d�n"|j	d�|jd�d|vr|jd�d|vr|jd�yyt|t�rlt|j��}d|vr|jd�n|jd	�d|vr|jd�d|vr|jd
�yyt|t�r'|j�D]}|j|��yt|t�rEt|j��}d|vr|jd�d|vr|jd�yyt|t�rytdt|�z��)
Nr�r�rQrZrVrYrR�ROrSrWr�r[)r�rr�r�r�rFr�r
r�rr\r
r�r�)r r+r�r�s    r#r)zMHMessage._explain_to�s���D��g�~�.��D�.�.�0�1�I��9�$��"�"�5�)��"�"�5�)�� � ��%��I�%�� � ��%��I�%�� � ��%�&�
��!1�
2��D�.�.�0�1�I��y�(�� � ��&�� � ��%��I�%�� � ��%��I�%�� � ��%�&�
���
+� �.�.�0���$�$�X�.�1�
���
.��D�.�.�0�1�I��9�$��!�!�(�+��I�%��!�!�*�-�&�
���
)���B� ��M�*�+�
+r%r)
r�r�r�r/r$r�r�r�r�r)r�r%r#r
r
�s,��.�!-���(�
"�*�N��$+r%r
c�N�eZdZ	ddgZd
d�Zd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zy)rr��_visibleNc�^�	g|_t�|_tj||�yr)r�r
r�r$r*s  r#r$zBabylMessage.__init__*s%��1�����	��
�����w�'r%c�"�	|jddSr)r�rNs r#r�zBabylMessage.get_labels0s��5��|�|�A��r%c�&�	t|�|_yr)rQr�)r r	s  r#r�zBabylMessage.set_labels4s��4��F�|��r%c��	t|t�r+||jvr|jj|�yyt	dt|�z��)Nzlabel must be a string: %s)r�r�r�rr�r��r rs  r#r\zBabylMessage.add_label8sI��9��e�S�!��D�L�L�(����#�#�E�*�)��8�4��;�F�G�Gr%c�\�		|jj|�y#t$rYywxYwr)r�r0r|r�s  r#�remove_labelzBabylMessage.remove_label@s.��B�	��L�L����&���	��	�r�c�.�	t|j�Sr�r
r�rNs r#rzBabylMessage.get_visibleGs��A��t�}�}�%�%r%c�&�	t|�|_yrr�)r �visibles  r#r�zBabylMessage.set_visibleKs��@���(��
r%c��	|jj�D]3}||vr |jj|||��'|j|=�5dD](}||vs�||jvs�|||j|<�*y)N)�Date�FromzReply-To�To�CC�Subject)r�rRrg)r �headers  r#�update_visiblezBabylMessage.update_visibleOsy��G��m�m�(�(�*�F���~��
�
�,�,�V�T�&�\�B��M�M�&�)�	+�
J�F���~�&��
�
�"=�(,�V���
�
�f�%�Jr%c���	t|t�r�t|j��}d|vr|j	d�n"|j	d�|jd�d|vsd|vr|jd�d|vr|jd�d	|vr|jd
�yyt|t�rlt|j��}d|vr|jd�n|jd�d	|vr|jd
�d|vr|jd�yyt|t�rEt|j��}d|vr|jd�d|vr|jd�yyt|t�rF|j|j��|j�D]}|j|��yt|t�rytdt|�z��)Nr�r�rQr�r�r#r�rRr�rTr�rSrUrWrYr[)r�rr�r�r�rFr�r
r�rr�rr\r
r�r�)r r+r	rs    r#r)zBabylMessage._explain_toZs���G��g�~�.�����*�+�F��6�!��"�"�5�)��"�"�5�)�� � ��%��f�$��F�(:�� � ��%��V�#�� � ��%��F�"�� � ��%�#�
��!1�
2�����*�+�F��v�%�� � ��&�� � ��%��F�"�� � ��%��V�#�� � ��%�$�
���
+�����*�+�F��6�!��$�$�X�.��V�#��$�$�Y�/�$�
���
.����� 0� 0� 2�3����*���!�!�%�(�+�
���
)���B� ��M�*�+�
+r%r)
r�r�r�r/r$r�r�r\r�rr�r�r)r�r%r#rr%s>��1�!*�J� 7��(��$�H��&�)�	5�'+r%rc��eZdZy)rNrvr�r%r#rr�rwr%rc��eZdZ	dd�Zdd�Zdd�Zdd�Zdd�Zd�Zd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zed��Zee�Zy)r�Nc�R�	||_|�|j�|_y||_yr)rArW�_pos)r r��poss   r#r$z_ProxyFile.__init__�s%��&���
��;�����D�I��D�Ir%c�P�	|j||jj�Sr)�_readrAr��r �sizes  r#r�z_ProxyFile.read�s����z�z�$��
�
���0�0r%c�P�	|j||jj�Sr)r�rA�read1r�s  r#r�z_ProxyFile.read1�s ����z�z�$��
�
� 0� 0�1�1r%c�P�	|j||jj�Sr)r�rAr�r�s  r#r�z_ProxyFile.readline�s ����z�z�$��
�
� 3� 3�4�4r%c�n�	g}|D],}|j|�|��|t|�z}|dks�+|S|S)Nr)rr�)r �sizehintrgr�s    r#�	readlinesz_ProxyFile.readlines�sJ��"����D��M�M�$���#��C��I�%���q�=���
�
��
r%c#�bK�	|j�x}r|��|j�x}r�yy�wr)r�)r r�s  r#rYz_ProxyFile.__iter__�s2����!��m�m�o�%�d�%��J��m�m�o�%�d�%�s�*/�/c��	|jSr)r�rNs r#rWz_ProxyFile.tell�s��"��y�y�r%c���	|dk(r%|jj|j�|jj||�|jj�|_y)Nr�rAr�r�rW�r �offset�whences   r#r�z_ProxyFile.seek�sD����Q�;��J�J�O�O�D�I�I�&��
�
�����'��J�J�O�O�%��	r%c��	t|d�r4	t|jd�r|jj�|`yy#|`wxYw)NrArx)rlrArxrNs r#rxz_ProxyFile.close�sE����4��!�
��4�:�:�w�/��J�J�$�$�&��J�"��
�J�s�0A�Ac��	|�d}|jj|j�||�}|jj�|_|S)Nr�r�)r r��read_methodrgs    r#r�z_ProxyFile._read�sD��0��<��D��
�
����	�	�"��T�"���J�J�O�O�%��	��
r%c��	|Srr�rNs r#�	__enter__z_ProxyFile.__enter__�s
��2��r%c�$�|j�yr)rx)r �excs  r#�__exit__z_ProxyFile.__exit__�s���
�
�r%c�6�|jj�Sr)rA�readablerNs r#r�z_ProxyFile.readable�����z�z�"�"�$�$r%c�6�|jj�Sr)rA�writablerNs r#r�z_ProxyFile.writable�r�r%c�6�|jj�Sr)rA�seekablerNs r#r�z_ProxyFile.seekable�r�r%c�6�|jj�Sr)rArrrNs r#rrz_ProxyFile.flush�s���z�z���!�!r%c�v�t|d�syt|jd�sy|jjS)NrATr�F)rlrAr�rNs r#r�z_ProxyFile.closed�s0���t�W�%���t�z�z�8�,���z�z� � � r%r�r)r�r�r�r$r�r�r�r�rYrWr�rxr�r�r�r�r�r�rr�propertyr�r�rr�r�r%r#r�r��sv��(��1�2�5�	��
�&�����%�%�%�"��!��!�$�L�1�r%r�c�0�eZdZ	dd�Zd�Zdd�Zd�Zd�Zy)	r�Nc�P�	tj|||�||_||_yr)r�r$�_start�_stop)r r�rfrgs    r#r$z_PartialFile.__init__�s%��(����D�!�U�+������
r%c�H�	tj|�|jz
Sr)r�rWr�rNs r#rWz_PartialFile.tell�s��8����t�$�t�{�{�2�2r%c��	|dk(r|j|_d}n|dk(r|j|_d}tj	|||�y)Nrrr/)r�r�r�r�r�r�s   r#r�z_PartialFile.seek�sC��F��Q�;����D�I��F�
�q�[��
�
�D�I��F�����f�f�-r%c��	|j|jz
}|dkry|�
|dks||kDr|}tj|||�S)Nrr%)r�r�r�r�)r r�r��	remainings    r#r�z_PartialFile._readsM��I��J�J����*�	���>���<�4�!�8�t�i�'7��D�����d�K�8�8r%c�"�t|d�r|`yy)NrA)rlrArNs r#rxz_PartialFile.close
s���4��!��
�"r%)NNr�)r�r�r�r$rWr�r�rxr�r%r#r�r��s��0��3�.�9�r%r�c��	d}	tr6	tj|tjtjz�|r{	t|jdz�}|j�		tj|j|jdz�d}tj|j�yyy#t$rY}|j
t
jt
jt
jfvrtd|jz���d}~wwxYw#t$r7}|j
t
jt
jfvrYd}~y�d}~wwxYw#t t"f$r2tj$|j|jdz�d}Y��wxYw#t&$r8tj(|j�td|jz��wxYw#tr$tj|tj*�|r"tj(|jdz��xYw)NFzlockf: lock unavailable: %s�.lockTzdot lock unavailable: %s)�fcntl�lockf�LOCK_EX�LOCK_NBr�r��EAGAINr?r@rr�rXrxrr�r�r�r�r�r,r0�LOCK_UN)r�rU�dotlock_doner��pre_locks     r#rOrOs���2��L�%��
����A�u�}�}�u�}�}�<�=��
�,�Q�V�V�g�-=�>����� �
1�-��G�G�H�M�M�1�6�6�G�+;�<�#'�L�
�I�I�h�m�m�,�!���
�
��7�7�u�|�|�U�\�\�5�;�;�G�G�,�-J�-.�V�V�.4�5�5���
���
��7�7�u�|�|�U�[�[�9�9����	
��'��8�(��I�I�h�m�m�Q�V�V�g�-=�>�#'�L�(��
#�
1��	�	�(�-�-�(�(�)C�)*���*0�1�1�
1�����K�K��5�=�=�)���I�I�a�f�f�w�&�'�
�s��G/�5B?�G/�(D$�./E'�F+�?	D!�AD�D!�!G/�$	E$�-,E�G/�E�E$�$G/�'>F(�%F+�'F(�(F+�+AG,�,G/�/AIc��	tr$tj|tj�tjj|jdz�r#tj|jdz�yy)Nr�)r�r�r�rrr�r�r0�r�s r#rRrR;sM��4��
���A�u�}�}�%�	�w�w�~�~�a�f�f�w�&�'�
�	�	�!�&�&�7�"�#�(r%c�
�	tj|tjtjztjzd�}	t|d�tj
|�S#tj
|�wxYw)Nrr=)rr�rr��O_RDWRrx)r�fds  r#r+r+BsS��M�	����r�z�z�B�I�I�-��	�	�9�5�	A�B���D�%� �
�����������s�
A+�+Bc
��	t|�dttj���dtj��dtj����S)Nr)r+r'rr%r&rr()rs r#rXrXJs;��L��d�C��	�	��4D�.4�.@�.@�.B�.0�i�i�k�;�<�<r%c��	|j�ttd�r$tj|j	��yy)N�fsync)rrrlrr��filenor�s r#rVrVPs/��:��G�G�I��r�7��
��������r%c�<�	t|�|j�yr)rVrxr�s r#r�r�Vs��D���N��G�G�Ir%c��eZdZy)rNrvr�r%r#rr\s��,r%rc��eZdZy)rNrvr�r%r#rr_s��Dr%rc��eZdZy)rNrvr�r%r#rrbs��Hr%rc��eZdZy)rNrvr�r%r#rre���3r%rc��eZdZy)rNrvr�r%r#rrhr�r%r)T)1rrrpr%r�r'r�rF�
email.message�email.generatorr�r?�typesrr��ImportError�__all__r�rzrrr;rxrr	rrr+r
rr�rr
rrr�r�rOrRr+rXrVr��	Exceptionrrrrrr�r%r#�<module>r�s���J�
���
�������	�����A��

�*�*�
�
�G�
$��f2�f2�Rs�g�s�l	C��C�N@�"�@�F1.�9�1.�h*.�9�*.�Zn*��n*�b	v��v�r"@�e�m�m�#�#�"@�Jj+�W�j+�Zn+�w�n+�b1�"�1�E+��E+�P\+�7�\+�~1�"�1�_2�_2�D$�:�$�N(�T$��<���-�I�-�E��E�I�E�I�4��4�4�%�4��aB���E��s�E4�4E?�>E?