AlkantarClanX12

Your IP : 18.191.178.16


Current Path : /opt/alt/python311/lib64/python3.11/email/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/email/__pycache__/message.cpython-311.opt-2.pyc

�

c��f�����	ddgZddlZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZmZddlm
Zdd	lmZejZd
Zejd��Zd�Zdd�Zd�Zd�Zd�ZGd�d��ZGd�de��ZGd�de��ZdS)�Message�EmailMessage�N)�BytesIO�StringIO)�utils)�errors)�Policy�compat32��charset)�decode_bz; z[ \(\)<>@,;:\\"/\[\]\?=]c���t|���d��\}}}|s|���dfS|���|���fS)N�;)�str�	partition�strip)�param�a�sep�bs    �4/opt/alt/python311/lib64/python3.11/email/message.py�_splitparamrsX��
�E�
�
�$�$�S�)�)�I�A�s�A����w�w�y�y�$����7�7�9�9�a�g�g�i�i���Tc���	|��t|��dkr�t|t��r4|dz
}tj|d|d|d��}|�d|��S	|�d��n2#t$r%|dz
}tj|dd��}|�d|��cYSwxYw|st�|��r|�d	tj	|���d
�S|�d|��S|S)Nr�*���=�asciizutf-8�z="�")
�len�
isinstance�tupler�encode_rfc2231�encode�UnicodeEncodeError�	tspecials�search�quote)r�valuer*s   r�_formatparamr,'s(���
��S��Z�Z�!�^�^��e�U�#�#�	0��S�L�E��(��q��5��8�U�1�X�F�F�E�#�e�e�U�U�+�+�
0����W�%�%�%�%��%�
0�
0�
0������,�U�G�R�@�@��"'�%�%���/�/�/�/�
0�����	,�I�$�$�U�+�+�	,� %���u�{�5�'9�'9�'9�'9�:�:�#�e�e�U�U�+�+��s�!A7�7,B&�%B&c�.�dt|��z}g}|dd�dk�rq|dd�}|�d��}|dkr�|�dd|��|�dd|��z
dzrQ|�d|dz��}|dkr2|�dd|��|�dd|��z
dz�Q|dkrt|��}|d|�}d|vrf|�d��}|d|�������dz||dzd����z}|�|�����||d�}|dd�dk��q|S)Nrrrr!z\"rr)r�find�countr"�indexr�lower�append)�s�plist�end�f�is     r�_parseparamr8Is����c�!�f�f��A��E�
�B�Q�B�%�3�,�,�
�a�b�b�E���f�f�S�k�k���A�g�g�1�7�7�3��3�/�/�!�'�'�%��C�2H�2H�H�A�M�g��&�&��c�A�g�&�&�C��A�g�g�1�7�7�3��3�/�/�!�'�'�%��C�2H�2H�H�A�M�g���7�7��a�&�&�C�
�d�s�d�G���!�8�8�������A��"�1�"����
�
�#�#�%�%��+�a��!����g�m�m�o�o�=�A�
���Q�W�W�Y�Y����
�c�d�d�G���B�Q�B�%�3�,�,��Lrc��t|t��r)|d|dtj|d��fStj|��S)Nrrr)r#r$r�unquote)r+s r�
_unquotevaluer;]sI��
�%����$��Q�x��q��5�=��q��#:�#:�:�:��}�U�#�#�#rc��	g}t|�����}|D]g}|�d��rP|�d���d��\}}}	t|d���n #t$rY�cwxYw�ht
d���|D]�}|st
d���|�d��dkrnt	tj	|��}nH#tj
$r6|d	d
z
dzdzd
zdz}tj	|d|���}YnwxYw|�|����d�|��S)Nsbegin � �)�basez`begin` line not foundzTruncated inputs 	
sendr� �?���r)
�iter�
splitlines�
startswith�removeprefixr�int�
ValueErrorr�binascii�a2b_uu�Errorr2�join)	�encoded�
decoded_lines�encoded_lines_iter�line�mode�_�path�decoded_line�nbytess	         r�
_decode_uurXhs��� ��M��g�0�0�2�2�3�3��"�
3�
3���?�?�9�%�%�	� �-�-�i�8�8�B�B�4�H�H�M�D�!�T�
��D�q�!�!�!�!�����
�
�
���
����		��1�2�2�2�"�+�+���	��.�/�/�/�
�Z�Z��
%�
%��
/�
/��E�	:�#�?�4�0�0�L�L���~�	:�	:�	:��Q���
�b�(�A�-��1�a�7�F�#�?�4����=�9�9�L�L�L�	:����	���\�*�*�*�*��8�8�M�"�"�"s%�+A>�>
B�
B�C$�$AD)�(D)c�T�eZdZ	efd�Zd�Zd6d�Zd�Zd7d�Zd	�Z	d
�Z
d�Zd�Zd8d
�Z
d9d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd9d�Zd�Zd�Zd9d�Zd�Zd�Zd �Z d!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d:d(�Z&		d:d)�Z'		d;d,�Z(d<d-�Z)d=d.�Z*d9d/�Z+d9d0�Z,d1�Z-d9d2�Z.d9d3�Z/d4�Z0dd5l1m2Z2dS)>rc��||_g|_d|_d|_d|_dx|_|_g|_d|_dS)N�
text/plain)	�policy�_headers�	_unixfrom�_payload�_charset�preamble�epilogue�defects�
_default_type)�selfr\s  r�__init__zMessage.__init__�sH�������
������
���
�(,�,��
��
����)����rc�,�	|���S�N)�	as_string�res r�__str__zMessage.__str__�s��	��~�~���rFrNc��	ddlm}|�|jn|}t��}||d||���}|�||���|���S)Nr)�	GeneratorF)�mangle_from_�maxheaderlenr\��unixfrom)�email.generatorrmr\r�flatten�getvalue)rerqror\rm�fp�gs       rrizMessage.as_string�sz��	�	.�-�-�-�-�-� &�����F��
�Z�Z���I�b�#(�#/�#�
%�
%�
%��	
�	�	�$��	�*�*�*��{�{�}�}�rc�,�	|���Srh)�as_bytesrjs r�	__bytes__zMessage.__bytes__�s��	��}�}���rc��	ddlm}|�|jn|}t��}||d|���}|�||���|���S)Nr)�BytesGeneratorF)rnr\rp)rrr{r\rrsrt)rerqr\r{rurvs      rrxzMessage.as_bytes�sm��	�	3�2�2�2�2�2� &�����F��
�Y�Y���N�2�E�&�A�A�A��	�	�	�$��	�*�*�*��{�{�}�}�rc�8�	t|jt��Srh)r#r_�listrjs r�is_multipartzMessage.is_multipart�s��D��$�-��.�.�.rc��||_dSrh�r^)rerqs  r�set_unixfromzMessage.set_unixfrom�s
��!����rc��|jSrhr�rjs r�get_unixfromzMessage.get_unixfrom�s
���~�rc��	|j�
|g|_dS	|j�|��dS#t$rtd���wxYw)Nz=Attach is not valid on a message with a non-multipart payload)r_r2�AttributeError�	TypeError)re�payloads  r�attachzMessage.attach�sq��	��=� �$�I�D�M�M�M�
:��
�$�$�W�-�-�-�-�-��!�
:�
:�
:��!9�:�:�:�
:���s	�0�A
c��	|���r|rdS|�|jS|j|S|�>t|jt��s$t	dt|j��z���|j}t
|�dd�������}|s�t|t��r�tj
|��rz	|�dd��}	|�|�
dd��d��}n&#t$r|�dd��}YnwxYwn#t$rYnwxYw|St|t��r=	|�dd��}n%#t$r|�d��}YnwxYw|d	krt!j|��S|d
krYt%d�|�������\}}|D]}|j�||���|S|dvr"	t/|��S#t0$r|cYSwxYwt|t��r|S|S)
NzExpected list, got %szcontent-transfer-encodingr r�surrogateescaper�replace�raw-unicode-escapezquoted-printable�base64r)z
x-uuencode�uuencode�uuezx-uue)r~r_r#r}r��typer�getr1r�_has_surrogatesr&�decode�	get_param�LookupErrorr'�quopri�decodestringr
rNrFr\�
handle_defectrXrJ)	rer7r�r��cte�bpayloadr+rc�defects	         r�get_payloadzMessage.get_payload�s���	�B�����	(��
��t��y��}�$��}�Q�'�'�
�=��D�M�4�!@�!@�=��3�d�4�=�6I�6I�I�J�J�J��-���$�(�(�6��;�;�<�<�B�B�D�D���
	��'�3�'�'�
�E�,A�'�,J�,J�
��&�~�~�g�7H�I�I�H�F�"*�/�/�$�.�.��G�2T�2T�V_�"`�"`����&�F�F�F�"*�/�/�'�9�"E�"E����F������)�����D������N��g�s�#�#�	@�
@�"�>�>�'�3D�E�E����%�
@�
@�
@�
#�>�>�*>�?�?����
@�����$�$�$��&�x�0�0�0�
�H�_�_�&�c�h�h�x�/B�/B�/D�/D�&E�&E�F�F�N�E�7�!�
8�
8����)�)�$��7�7�7�7��L�
�>�
>�
>�
 �!�(�+�+�+���
 �
 �
 �����
 �����g�s�#�#�	��O��sZ�E�/*D�E� D=�:E�<D=�=E�
E�
E�)F�F"�!F"�#H2�2I�Ic�T�	t|d��rJ|�	||_dSt|t��st|��}|�|jd��}t|d��r|�dd��|_n||_|�|�|��dSdS)Nr&r�r�r)�hasattrr_r#�Charsetr&�output_charsetr��set_charset)rer�rs   r�set_payloadzMessage.set_payloadKs���	�
�7�H�%�%�	P��� '��
����g�w�/�/�
+�!�'�*�*���n�n�W�%;�=N�O�O�G��7�H�%�%�	$�#�N�N�7�4E�F�F�D�M�M�#�D�M������W�%�%�%�%�%��rc�R�	|�|�d��d|_dSt|t��st|��}||_d|vr|�dd��d|vr+|�dd|������n(|�d|�����||���kr|�|j��|_d|vr�|�	��}	||��dS#t$r|j}|rB	|�dd	��}n*#t$r|�|j
��}YnwxYw|�|��|_|�d|��YdSwxYwdS)
Nr�MIME-Version�1.0�Content-Typer[rzContent-Transfer-Encodingrr�)�	del_paramr`r#r��
add_header�get_output_charset�	set_param�body_encoder_�get_body_encodingr�r&�UnicodeErrorr�)rerr�r�s    rr�zMessage.set_charset_s���	��?��N�N�9�%�%�%� �D�M��F��'�7�+�+�	'��g�&�&�G���
���%�%��O�O�N�E�2�2�2���%�%��O�O�N�L�$+�$>�$>�$@�$@�
�
B�
B�
B�
B�
�N�N�9�g�&@�&@�&B�&B�C�C�C��g�0�0�2�2�2�2�#�/�/��
�>�>�D�M�&�d�2�2��+�+�-�-�C�

B���D�	�	�	�	�	���
B�
B�
B��-���I�I�")�.�.��:K�"L�"L����'�I�I�I�")�.�.��1G�"H�"H����I���� '� 3� 3�G� <� <��
���� ;�S�A�A�A�A�A�A�
B����	3�2s6�D�F$�/E�F$�$E-�*F$�,E-�-3F$�#F$c��	|jSrh)r`rjs r�get_charsetzMessage.get_charset�s��	��}�rc�,�	t|j��Srh)r"r]rjs r�__len__zMessage.__len__�s��G��4�=�!�!�!rc�.�	|�|��Srh)r��re�names  r�__getitem__zMessage.__getitem__�s��	��x�x��~�~�rc�x�	|j�|��}|ri|���}d}|jD]K\}}|���|kr.|dz
}||kr#t	d�||������L|j�|j�||����dS)Nrrz/There may be at most {} {} headers in a message)r\�header_max_countr1r]rJ�formatr2�header_store_parse)rer��val�	max_count�lname�found�k�vs        r�__setitem__zMessage.__setitem__�s���	�
�K�0�0��6�6�	��	Q��J�J�L�L�E��E��
�
Q�
Q���1��7�7�9�9��%�%��Q�J�E��	�)�)�(�*8�8>��y�$�8O�8O�Q�Q�Q���
���T�[�;�;�D�#�F�F�G�G�G�G�Grc��	|���}g}|jD]4\}}|���|kr|�||f���5||_dSrh)r1r]r2)rer��
newheadersr�r�s     r�__delitem__zMessage.__delitem__�sg��	��z�z�|�|���
��M�	*�	*�D�A�q��w�w�y�y�D� � ��!�!�1�a�&�)�)�)��"��
�
�
rc�L�|���d�|jD��vS)Nc�<�g|]\}}|�����S�)r1��.0r�r�s   r�
<listcomp>z(Message.__contains__.<locals>.<listcomp>�s$��D�D�D�d�a�����	�	�D�D�Dr)r1r]r�s  r�__contains__zMessage.__contains__�s&���z�z�|�|�D�D�d�m�D�D�D�D�Drc#�,K�|jD]	\}}|V��
dSrh�r])re�fieldr+s   r�__iter__zMessage.__iter__�s0���� �M�	�	�L�E�5��K�K�K�K�	�	rc�&�	d�|jD��S)Nc��g|]\}}|��Sr�r�r�s   rr�z Message.keys.<locals>.<listcomp>�s��,�,�,�d�a���,�,�,rr�rjs r�keyszMessage.keys�s��	�-�,�d�m�,�,�,�,rc�,��	�fd��jD��S)Nc�L��g|] \}}�j�||����!Sr��r\�header_fetch_parse�r�r�r�res   �rr�z"Message.values.<locals>.<listcomp>�s?���+�+�+��A�q���.�.�q�!�4�4�+�+�+rr�rjs`r�valueszMessage.values��5���	�+�+�+�+� �M�+�+�+�	+rc�,��	�fd��jD��S)Nc�P��g|]"\}}|�j�||��f��#Sr�r�r�s   �rr�z!Message.items.<locals>.<listcomp>�sD���+�+�+��A�q��D�K�2�2�1�a�8�8�9�+�+�+rr�rjs`r�itemsz
Message.items�r�rc��	|���}|jD]:\}}|���|kr|j�||��cS�;|Srh)r1r]r\r�)rer��failobjr�r�s     rr�zMessage.get�sf��	�
�z�z�|�|���M�	<�	<�D�A�q��w�w�y�y�D� � ��{�5�5�a��;�;�;�;�;�!��rc�@�	|j�||f��dSrh)r]r2)rer�r+s   r�set_rawzMessage.set_raw�s)��	�	
�
���d�E�]�+�+�+�+�+rc�P�	t|j�����Srh)rEr]�copyrjs r�	raw_itemszMessage.raw_itemss%��	��D�M�&�&�(�(�)�)�)rc���	g}|���}|jD]K\}}|���|kr.|�|j�||�����L|s|S|Srh)r1r]r2r\r�)rer�r�r�r�r�s      r�get_allzMessage.get_all
s|��	����z�z�|�|���M�	D�	D�D�A�q��w�w�y�y�D� � ��
�
�d�k�<�<�Q��B�B�C�C�C���	��N��
rc	�p�	g}|���D]h\}}|�*|�|�dd�����1|�t|�dd��|�����i|�|�d|��t
�|��||<dS)NrT�-r)r�r2r�r,�insert�	SEMISPACErN)re�_name�_value�_params�partsr�r�s       rr�zMessage.add_headers���	�&���M�M�O�O�	C�	C�D�A�q��y����Q�Y�Y�s�C�0�0�1�1�1�1����\�!�)�)�C��*=�*=�q�A�A�B�B�B�B����L�L��F�#�#�#��n�n�U�+�+��U���rc�@�	|���}ttt|j����|j��D]F\}\}}|���|kr&|j�||��|j|<dS�Gt|���rh)r1�zip�ranger"r]r\r��KeyError)rer�r�r7r�r�s      r�replace_headerzMessage.replace_header=s���	����
�
���U�3�t�}�#5�#5�6�6��
�F�F�	"�	"�I�A�v��1��w�w�y�y�E�!�!�#'�;�#A�#A�!�V�#L�#L��
�a� ����"��5�/�/�!rc��	t��}|�d|��}||ur|���St|��d���}|�d��dkrdS|S)N�content-typer�/rr[)�objectr��get_default_typerr1r/)re�missingr+�ctypes    r�get_content_typezMessage.get_content_typePs���	��(�(�������1�1���G����(�(�*�*�*��E�"�"�1�%�+�+�-�-���;�;�s���q� � ��<��rc�b�	|���}|�d��dS)Nr�r�r��split�rer�s  r�get_content_maintypezMessage.get_content_maintypeh�1��	�
�%�%�'�'���{�{�3����"�"rc�b�	|���}|�d��dS)Nr�rr�r�s  r�get_content_subtypezMessage.get_content_subtypeqr�rc��	|jSrh�rdrjs rr�zMessage.get_default_typezs��	��!�!rc��	||_dSrhrr�s  r�set_default_typezMessage.set_default_type�s��	�#����rc��t��}|�||��}||ur|Sg}t|��D]�}	|�dd��\}}|���}|���}n&#t
$r|���}d}YnwxYw|�||f����tj|��}|S)Nrrr )	r�r�r8r�rrJr2r�
decode_params)	rer��headerr�r+�params�pr�r�s	         r�_get_params_preservezMessage._get_params_preserve�s����(�(�������)�)���G����N����U�#�#�		'�		'�A�
��G�G�C��O�O�	��c��z�z�|�|���i�i�k�k�����
�
�
��w�w�y�y������
����
�M�M�4��+�&�&�&�&��$�V�,�,���
s�AB� B$�#B$r�Tc�x�	t��}|�||��}||ur|S|rd�|D��S|S)Nc�6�g|]\}}|t|��f��Sr�)r;r�s   rr�z&Message.get_params.<locals>.<listcomp>�s)��=�=�=�d�a��Q�
�a�(�(�)�=�=�=r)r�r)rer�rr:r�r	s      r�
get_paramszMessage.get_params�sX��	��(�(���*�*�7�F�;�;���W����N��	�=�=�f�=�=�=�=��Mrc���	||vr|S|�||��D]F\}}|���|���kr|rt|��cS|cS�G|Srh)rr1r;)rerr�rr:r�r�s       rr�zMessage.get_param�s���	�,�����N��-�-�g�v�>�>�	�	�D�A�q��w�w�y�y�E�K�K�M�M�)�)���(��+�+�+�+�+��H�H�H�	*�
�rr�r c���	t|t��s|r|||f}||vr|���dkrd}n|�|��}|�||���s@|st|||��}n�t�|t|||��g��}n�d}|�||���D]u\}	}
d}|	���|���krt|||��}nt|	|
|��}|s|}�Yt�||g��}�v||�|��kr$|r|�	||��dS||=|||<dSdS)Nr�r[)rr �rr:)
r#r$r1r�r�r,r�rNrr�)rerr+r�requoter�languager�r��	old_param�	old_value�append_params            rr�zMessage.set_param�s���	� �%��'�'�	/�G�	/��h��.�E�����&�,�,�.�.�N�"B�"B� �E�E��H�H�V�$�$�E��~�~�e�F�~�3�3�	B��
B�$�U�E�7�;�;���!����L���w�?�?�@�B�B����E�(,���v�@G�)8�)I�)I�

B�

B�$�	�9�!���?�?�$�$����
�
�5�5�#/��u�g�#F�#F�L�L�#/�	�9�g�#N�#N�L��B�(�E�E�%�N�N�E�<�+@�A�A�E�E��D�H�H�V�$�$�$�$��
%��#�#�F�E�2�2�2�2�2���L�$��V����%�$rc	�j�	||vrdSd}|�||���D]n\}}|���|���kr?|st|||��}�Ct�|t|||��g��}�o||�|��kr
||=|||<dSdS)Nr r)rr1r,r�rNr�)rerrr�	new_ctyper
r�s       rr�zMessage.del_params���	������F��	��O�O�6�7�O�C�C�	N�	N�D�A�q��w�w�y�y�E�K�K�M�M�)�)� �N� ,�Q��7� ;� ;�I�I� )���	�0<�Q��7�0K�0K�0M�!N�!N�I�������(�(�(�(��V��$�D��L�L�L�)�(rc�,�	|�d��dkst�|���dkr|d=d|d<||vr|||<dS|�||���}||=|||<|dd�D]\}}|�||||���dS)Nr�rr�zmime-versionr�r�r)r/rJr1rr�)rer�rrr	r
r�s       r�set_typezMessage.set_type"s���
	��z�z�#���!�#�#����<�<�>�>�^�+�+��^�$�#(�D�� ������D��L��F�������@�@����L���V���1�2�2�J�	2�	2�D�A�q��N�N�1�a���1�1�1�1�	2�	2rc���	t��}|�d|d��}||ur|�d|d��}||ur|Stj|�����S)N�filename�content-dispositionr�r�)r�r�r�collapse_rfc2231_valuer)rer�r�rs    r�get_filenamezMessage.get_filenameBsu��	��(�(���>�>�*�g�7L�M�M���w����~�~�f�g�~�F�F�H��w����N��+�H�5�5�;�;�=�=�=rc��	t��}|�d|��}||ur|Stj|�����S)N�boundary)r�r�rr�rstrip)rer�r�r!s    r�get_boundaryzMessage.get_boundaryRsR��	�
�(�(���>�>�*�g�6�6���w����N��+�H�5�5�<�<�>�>�>rc��	t��}|�|d��}||urtjd���g}d}|D]Q\}}|���dkr|�dd|zf��d}�:|�||f���R|s|�dd|zf��g}|jD]�\}	}
|	���dkr�g}|D];\}}
|
dkr|�|���!|�|�d|
�����<t�|��}
|�|j	�
|	|
������|�|	|
f����||_dS)	Nr�zNo Content-Type header foundFr!z"%s"Tr r)r�rr�HeaderParseErrorr1r2r]r�rNr\r�)rer!r�r	�	newparams�foundp�pk�pvr��hr�r�r�r�s              r�set_boundaryzMessage.set_boundary_s���	��(�(���*�*�7�N�C�C���W����)�*H�I�I�I��	����	+�	+�F�B���x�x�z�z�Z�'�'�� � �*�f�x�.?�!@�A�A�A����� � �"�b��*�*�*�*��	>�
���j�&�8�*;�<�=�=�=��
��M�	*�	*�D�A�q��w�w�y�y�N�*�*���%�7�7�D�A�q��B�w�w����Q�����������1�1�%5�6�6�6�6��n�n�U�+�+���!�!�$�+�"@�"@��C�"H�"H�I�I�I�I��!�!�1�a�&�)�)�)�)�"��
�
�
rc��	t��}|�d|��}||ur|St|t��rV|dpd}	|d�d��}t||��}n#ttf$r|d}YnwxYw	|�d��n#t$r|cYSwxYw|���S)Nrrzus-asciirr�)	r�r�r#r$r&rr�r�r1)rer�r�r�pcharsetrxs      r�get_content_charsetzMessage.get_content_charset�s��	��(�(���.�.��G�4�4���g����N��g�u�%�%�
	%��q�z�/�Z�H�
%�#�1�:�,�,�-A�B�B���h��1�1������.�
%�
%�
%�!�!�*����
%����	��N�N�:�&�&�&�&���	�	�	��N�N�N�	�����}�}���s$�+A8�8B�B�B.�.B=�<B=c�F��	�fd�|���D��S)Nc�:��g|]}|������Sr�)r.)r��partr�s  �rr�z(Message.get_charsets.<locals>.<listcomp>�s'���J�J�J�d��(�(��1�1�J�J�Jr��walk)rer�s `r�get_charsetszMessage.get_charsets�s-���	�K�J�J�J�d�i�i�k�k�J�J�J�Jrc��	|�d��}|�dSt|��d���}|S)Nrr)r�rr1)rer+�c_ds   r�get_content_dispositionzMessage.get_content_disposition�sH��	�
���.�/�/���=��4��%� � ��#�)�)�+�+���
rr2)FrN)FN)NFrh)Nr�T)r�TNr F)r�T)r�T)3�__name__�
__module__�__qualname__r
rfrkriryrxr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr�rrrr�r�r�rrr#r+r.r4r7�email.iteratorsr3r�rrrr�sK������
�'�
*�
*�
*�
*� � � �
����0���

�
�
�
�/�/�/�"�"�"����:�:�:� V�V�V�V�p&�&�&�&�(-B�-B�-B�^���"�"�"�	�	�	�H�H�H�$
#�
#�
#�E�E�E����-�-�-�	+�	+�	+�	+�	+�	+�
�
�
�
�",�,�,�*�*�*�����$,�,�,�<
"�
"�
"�&���0#�#�#�#�#�#�"�"�"�#�#�#����*����,5C�� � � � �DFJ�5:�1%�1%�1%�1%�f%�%�%�%�,2�2�2�2�@>�>�>�>� ?�?�?�?�,#�,#�,#�\����<K�K�K�K�$
�
�
�%�$�$�$�$�$�$�$rc���eZdZd�fd�	Zd�fd�	Zd�Zd�Zd�Zdd	�Zhd
�Z	d�Z
d�Zdd
�d�Zdd
�d�Z
d�Zdd�Zdd�Zdd�Zdd�d�Zd�Zd�Zd�Zd�Zd�Z�xZS)�MIMEPartNc�^��|�ddlm}|}t���|��dS)Nr)�default)�email.policyr?�superrf)rer\r?�	__class__s   �rrfzMIMEPart.__init__�s=����>�,�,�,�,�,�,��F�
������ � � � � rFc�t��	|�|jn|}|�|j}t���|||��Srh)r\�max_line_lengthrAri)rerqror\rBs    �rrizMIMEPart.as_string�sC���		�!'�����F����!�1�L��w�w� � ��<��@�@�@rc�`�|�|j�d������S)NT)�utf8�r\)rir\�clonerjs rrkzMIMEPart.__str__�s)���~�~�T�[�%6�%6�D�%6�%A�%A�~�B�B�Brc�J�|�d��}|�dn
|jdkS)NrF�
attachment)r��content_disposition)rer6s  r�
is_attachmentzMIMEPart.is_attachment�s*���h�h�,�-�-����u�u��)@�L�)P�Prc#�K�|���rdS|����d��\}}|dkr||vr|�|��|fV�dS|dks|���sdS|dkr5|���D]}|�||��Ed{V���dSd|vr|�d��|fV�d}|�d��}|r'|���D]}|d|kr|}n�|� |���}|r|dnd}|�|�||��Ed{V��dSdS)Nr��text�	multipart�related�start�
content-idr)	rLr�r�r0r~�
iter_parts�
_find_bodyr�r�)	rer1�preferencelist�maintype�subtype�subpart�	candidaterQ�subpartss	         rrTzMIMEPart._find_body�s����������	��F� �1�1�3�3�9�9�#�>�>���'��v����.�(�(�%�+�+�G�4�4�d�;�;�;�;��F��{�"�"�$�*;�*;�*=�*=�"��F��i����?�?�,�,�
D�
D���?�?�7�N�C�C�C�C�C�C�C�C�C�C��F���&�&�!�'�'�	�2�2�D�9�9�9�9��	����w�'�'���	��?�?�,�,�
�
���<�(�E�1�1� '�I��E�2����'�'�)�)�H�'/�9�����T�I�� ����y�.�A�A�A�A�A�A�A�A�A�A�A�!� r�rP�html�plainc��	t|��}d}|�||��D]\}}||kr|}|}|dkrn�|S)Nr)r"rT)rerU�	best_prio�body�prior1s      r�get_bodyzMIMEPart.get_body
se��	���'�'�	����/�/�$��?�?�	�	�J�D�$��i��� �	����1�9�9��E���r>�rNr\�rNr]�rOrP�rO�alternativec#��K�	|����d��\}}|dks|dkrdS|���}	|���}n#t$rYdSwxYw|dkr�|dkr||�d��}|rFd}g}|D]3}|�d��|krd}�|�|���4|r
|Ed{V��dS|�d	��|Ed{V��dSg}	|D]i}|����d��\}}||f|j	vr.|�
��s||	vr|	�|���e|V��jdS)
Nr�rOrgrPrQFrRTr)r�r�r�r�r�r�r�r2�pop�_body_typesrL)
rerVrWr�r�rQr��attachmentsr1�seens
          r�iter_attachmentszMIMEPart.iter_attachments"s�����		�!�1�1�3�3�9�9�#�>�>���'��{�"�"�g��&>�&>��F��"�"�$�$��	��L�L�N�N�E�E���	�	�	��F�F�	�����{�"�"�w�)�';�';��N�N�7�+�+�E��

��� ��!�1�1�D��x�x��-�-��6�6� $���#�*�*�4�0�0�0�0���*�*�*�*�*�*�*�*��F��I�I�a�L�L�L����������F����	�	�D� $� 5� 5� 7� 7� =� =�c� B� B��H�g��7�#�t�'7�7�7��*�*�,�,�8�18��1D�1D����G�$�$�$���J�J�J�J�
	�	s�A&�&
A4�3A4c#�lK�	|���r|���Ed{V��dSdSrh)r~r�rjs rrSzMIMEPart.iter_partsYsU����	������	*��'�'�)�)�)�)�)�)�)�)�)�)�)�	*�	*r)�content_managerc�@�|�|jj}|j|g|�Ri|��Srh)r\ro�get_content�rero�args�kws    rrqzMIMEPart.get_contentas5���"�"�k�9�O�*��*�4�=�$�=�=�=�"�=�=�=rc�D�|�|jj}|j|g|�Ri|��dSrh)r\ro�set_contentrrs    rrvzMIMEPart.set_contentfs;���"�"�k�9�O�#��#�D�6�4�6�6�6�2�6�6�6�6�6rc�^�|���dkrA|���}||fz}||vr#td�||�����g}g}|jD][\}}|����d��r|�||f���D|�||f���\|r:t|��|j	���}	||	_|j
|	_
|	g|_
ng|_
||_d|z|d<|�|�d|��dSdS)NrOzCannot convert {} to {}�content-rGz
multipart/r�r!)r�rrJr�r]r1rGr2r�r\r_r�)
rerW�disallowed_subtypesr!�existing_subtype�keep_headers�part_headersr�r+r1s
          r�_make_multipartzMIMEPart._make_multipartksc���$�$�&�&�+�5�5�#�7�7�9�9��"5��
�"B���#6�6�6� �!:�!A�!A�$�g�"/�"/�0�0�0������=�	3�	3�K�D�%��z�z�|�|�&�&�z�2�2�
3��#�#�T�5�M�2�2�2�2��#�#�T�5�M�2�2�2�2��	��4��:�:�T�[�1�1�1�D�(�D�M� �M�D�M�!�F�D�M�M��D�M�$��
�+�g�5��^�����N�N�:�x�0�0�0�0�0� �rc�4�|�dd|��dS)NrP)rg�mixed�r}�rer!s  r�make_relatedzMIMEPart.make_related�s!�����Y�(@�(�K�K�K�K�Krc�4�|�dd|��dS)Nrg)rr�r�s  r�make_alternativezMIMEPart.make_alternative�s �����]�J��A�A�A�A�Arc�4�|�dd|��dS)Nrr�r�r�s  r�
make_mixedzMIMEPart.make_mixed�s �����W�b�(�3�3�3�3�3r)�_dispc�2�|���dks|���|krt|d|z����t|��|j���}|j|i|��|r	d|vr||d<|�|��dS)NrO�make_rGrzContent-Disposition)r�r�getattrr�r\rvr�)re�_subtyper�rsrtr1s      r�_add_multipartzMIMEPart._add_multipart�s����%�%�'�'�;�6�6��(�(�*�*�h�6�6�-�G�D�'�H�,�-�-�/�/�/��t�D�z�z���-�-�-�����$�%�"�%�%�%��	0�*�$�6�6�*/�D�&�'����D�����rc�,�|jdg|�Rddi|��dS)NrPr��inline�r��rersrts   r�add_relatedzMIMEPart.add_related�s0�����I�C��C�C�C�H�C��C�C�C�C�Crc�(�|jdg|�Ri|��dS)Nrgr�r�s   r�add_alternativezMIMEPart.add_alternative�s+�����M�7�D�7�7�7�B�7�7�7�7�7rc�,�|jdg|�Rddi|��dS)Nrr�rJr�r�s   r�add_attachmentzMIMEPart.add_attachment�s0�����G�E�d�E�E�E�,�E�"�E�E�E�E�Erc�"�g|_d|_dSrh�r]r_rjs r�clearzMIMEPart.clear�s����
���
�
�
rc�@�d�|jD��|_d|_dS)Nc�j�g|]0\}}|����d���,||f��1S)rx)r1rG)r��nr�s   rr�z*MIMEPart.clear_content.<locals>.<listcomp>�sQ��B�B�B�D�A�q� !���	�	� 4� 4�Z� @� @�B�!�Q��B�B�Brr�rjs r�
clear_contentzMIMEPart.clear_content�s3��B�B�D�M�B�B�B��
���
�
�
rrh)FNN)r[)r8r9r:rfrirkrLrTrbrjrmrSrqrvr}r�r�r�r�r�r�r�r�r��
__classcell__�rBs@rr=r=�s��������!�!�!�!�!�!�A�A�A�A�A�A� C�C�C�Q�Q�Q�B�B�B�:����(1�1�1�K�5�5�5�n*�*�*�26�>�>�>�>�>�
26�7�7�7�7�7�
1�1�1�6L�L�L�L�B�B�B�B�4�4�4�4�59������D�D�D�8�8�8�F�F�F����������rr=c���eZdZ�fd�Z�xZS)rc�P��t��j|i|��d|vrd|d<dSdS)Nr�r�)rArv)rersrtrBs   �rrvzEmailMessage.set_content�sB��������T�(�R�(�(�(���%�%�#(�D�� � � �&�%r)r8r9r:rvr�r�s@rrr�s8�������)�)�)�)�)�)�)�)�)r)NT)�__all__rK�rer��iorr�emailrr�email._policybaser	r
rr`�email._encoded_wordsr
r�r��compiler(rr,r8r;rXrr=rr�rr�<module>r�s���
?��n�
%������	�	�	�	�
�
�
�
� � � � � � � � �������������.�.�.�.�.�.�.�.�%�%�%�%�%�%�)�)�)�)�)�)�
�
���	�
�B�J�2�3�3�	� � � � � � � �D���($�$�$�#�#�#�>C
%�C
%�C
%�C
%�C
%�C
%�C
%�C
%�L\�\�\�\�\�w�\�\�\�~)�)�)�)�)�8�)�)�)�)�)r