Your IP : 3.142.198.108


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

�

�Q�f����	ddgZddlZddlZddlZddlmZmZddlmZddlm	Z	ddl
mZddlmZ
dd	lmZe
j Zd
Zej$d�Zd�Zdd
�Zd�Zd�Zd�ZGd�d�ZGd�de�ZGd�de�Zy)�Message�EmailMessage�N)�BytesIO�StringIO)�utils)�errors)�compat32��charset)�decode_bz; z[ \(\)<>@,;:\\"/\[\]\?=]c��t|�jd�\}}}|s|j�dfS|j�|j�fS)N�;)�str�	partition�strip)�param�a�sep�bs    �4/opt/alt/python312/lib64/python3.12/email/message.py�_splitparamrsH��
�E�
�$�$�S�)�I�A�s�A���w�w�y�$����7�7�9�a�g�g�i���c��	|��t|�dkDr�t|t�r,|dz
}tj|d|d|d�}|�d|��S	|jd�|stj|�r|�d	tj|��d
�S|�d|��S|S#t$r&|dz
}tj|dd�}|�d|��cYSwxYw)Nr�*���=�asciizutf-8�z="�")
�len�
isinstance�tupler�encode_rfc2231�encode�UnicodeEncodeError�	tspecials�search�quote)r�valuer)s   r�_formatparamr+'s����
��S��Z�!�^��e�U�#��S�L�E��(�(��q��5��8�U�1�X�F�E�#�U�+�+�
0����W�%��I�$�$�U�+� %�u�{�{�5�'9�:�:�#�U�+�+����&�
0������,�,�U�G�R�@��"'��/�/�
0�s�B�,C
�	C
c�r�dt|�z}g}|dddk(�r|dd}|jd�}|dkDro|jdd|�|jdd|�z
dzrE|jd|dz�}|dkDr+|jdd|�|jdd|�z
dzr�E|dkrt|�}|d|}d|vrL|j	d�}|d|j�j
�dz||dzdj�z}|j|j��||d}|dddk(r��|S)Nrrrr z\"rr)r�find�countr!�indexr�lower�append)�s�plist�end�f�is     r�_parseparamr7Is?���c�!�f��A��E�
�B�Q�%�3�,�
�a�b�E���f�f�S�k���A�g�1�7�7�3��3�/�!�'�'�%��C�2H�H�A�M��&�&��c�A�g�&�C��A�g�1�7�7�3��3�/�!�'�'�%��C�2H�H�A�M���7��a�&�C�
�d�s�G���!�8������A��"�1����
�#�#�%��+�a��!���g�m�m�o�=�A�
���Q�W�W�Y��
�c�d�G���B�Q�%�3�,��Lrc��t|t�r!|d|dtj|d�fStj|�S)Nrrr)r"r#r�unquote)r*s r�
_unquotevaluer:]s?��
�%����Q�x��q��5�=�=��q��#:�:�:��}�}�U�#�#rc�T�	g}t|j��}|D]G}|jd�s�|jd�j	d�\}}}	t|d��nt
d��|D]L}|st
d��|jd�dk(rn)	tj|�}|j|��Ndj|�S#t$rY��wxYw#tj$r/|d	d
z
dzdzd
zdz}tj|d|�}Y�twxYw)Nsbegin � �)�basez`begin` line not foundzTruncated inputs 	
sendr� �?���r)
�iter�
splitlines�
startswith�removeprefixr�int�
ValueErrorr�binascii�a2b_uu�Errorr1�join)	�encoded�
decoded_lines�encoded_lines_iter�line�mode�_�path�decoded_line�nbytess	         r�
_decode_uurWhs5�� ��M��g�0�0�2�3��"���?�?�9�%� �-�-�i�8�B�B�4�H�M�D�!�T�
��D�q�!��#��1�2�2�"����.�/�/�
�Z�Z��
%��
/��	:�#�?�?�4�0�L�
	���\�*�#��8�8�M�"�"��'�
��
���~�~�	:��Q���
�b�(�A�-��1�a�7�F�#�?�?�4���=�9�L�	:�s$�
C�C%�	C"�!C"�%?D'�&D'c�R�eZdZ	efd�Zd�Zd1d�Zd�Zd2d�Zd�Z	d	�Z
d
�Zd�Zd3d�Z
d4d
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd4d�Zd�Zd�Zd4d�Zd�Zd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d$�Z%d5d%�Z&		d5d&�Z'		d6d'�Z(d7d(�Z)d8d)�Z*d4d*�Z+d4d+�Z,d,�Z-d4d-�Z.d4d.�Z/d/�Z0dd0l1m2Z2y)9rc��||_g|_d|_d|_d|_dx|_|_g|_d|_y)N�
text/plain)	�policy�_headers�	_unixfrom�_payload�_charset�preamble�epilogue�defects�
_default_type)�selfr[s  r�__init__zMessage.__init__�sB�������
������
���
�(,�,��
��
����)��rc�$�	|j�S�N)�	as_string�rds r�__str__zMessage.__str__�s��	��~�~��rrNc��	ddlm}|�|jn|}t�}||d||��}|j	||��|j�S)Nr)�	GeneratorF)�mangle_from_�maxheaderlenr[��unixfrom)�email.generatorrlr[r�flatten�getvalue)rdrprnr[rl�fp�gs       rrhzMessage.as_string�sU��	�	.� &�����F��
�Z���b�#(�#/�#�
%��	
�	�	�$��	�*��{�{�}�rc�$�	|j�Srg)�as_bytesris r�	__bytes__zMessage.__bytes__�s��	��}�}��rc��	ddlm}|�|jn|}t�}||d|��}|j	||��|j�S)Nr)�BytesGeneratorF)rmr[ro)rqrzr[rrrrs)rdrpr[rzrtrus      rrwzMessage.as_bytes�sL��	�	3� &�����F��
�Y���2�E�&�A��	�	�	�$��	�*��{�{�}�rc�8�	t|jt�Srg)r"r^�listris r�is_multipartzMessage.is_multipart�s��D��$�-�-��.�.rc��||_yrg�r])rdrps  r�set_unixfromzMessage.set_unixfrom�s	��!��rc��|jSrgrris r�get_unixfromzMessage.get_unixfrom�s���~�~�rc��	|j�	|g|_y	|jj|�y#t$rtd��wxYw)Nz=Attach is not valid on a message with a non-multipart payload)r^r1�AttributeError�	TypeError)rd�payloads  r�attachzMessage.attach�sT��	��=�=� �$�I�D�M�
:��
�
�$�$�W�-��!�
:��!9�:�:�
:�s	�4�A	c�:�	|j�r |ry|�|jS|j|S|�;t|jt�s!t	dt|j�z��|j}t
|jdd��j�}|s^t|t�rLtj|�r7	|jdd�}	|j|jd�d�}|S|St|t�r	|jdd�}|dk(rt!j"�S|d	k(rPt%d
j'j)���\}}|D]}|j*j-||�� |S|dvr	t/�St|t�rS|S#t$r|jdd�}Y|SwxYw#t$rY|SwxYw#t$r|jd�}Y��wxYw#t0$rcYSwxYw)NzExpected list, got %szcontent-transfer-encodingrr�surrogateescape�replace�raw-unicode-escapezquoted-printable�base64r)z
x-uuencode�uuencode�uuezx-uue)r}r^r"r|r��typer�getr0r�_has_surrogatesr%�decode�get_content_charset�LookupErrorr&�quopri�decodestringrrMrEr[�
handle_defectrWrI)	rdr6r�r��cte�bpayloadr*rb�defects	         r�get_payloadzMessage.get_payload�s��	�B�������y��}�}�$��}�}�Q�'�'�
�=��D�M�M�4�!@��3�d�4�=�=�6I�I�J�J��-�-���$�(�(�6��;�<�B�B�D����'�3�'�E�,A�,A�'�,J��&�~�~�g�7H�I�H�F�"*�/�/�$�2J�2J�7�2S�U^�"_��
�N�7�N��g�s�#�
@�"�>�>�'�3D�E���$�$��&�&�x�0�0�
�H�_�&�c�h�h�x�/B�/B�/D�&E�F�N�E�7�!�����)�)�$��7�"��L�
�>�
>�
 �!�(�+�+��g�s�#��O����?'�F�"*�/�/�'�9�"E���N�	F��)����N���&�
@�
#�>�>�*>�?��
@��$�
 ���
 �sT�G�!F:�G,�
H�:G�G�G�G�	G)�(G)�,H	�H	�H�Hc��	t|d�rA|�||_yt|t�st|�}|j	|j
d�}t|d�r|j
dd�|_n||_|�|j|�yy)Nr%r�r�r)�hasattrr^r"�Charsetr%�output_charsetr��set_charset)rdr�rs   r�set_payloadzMessage.set_payloadKs���	�
�7�H�%��� '��
���g�w�/�!�'�*���n�n�W�%;�%;�=N�O�G��7�H�%�#�N�N�7�4E�F�D�M�#�D�M������W�%�rc���	|�|jd�d|_yt|t�st|�}||_d|vr|j	dd�d|vr#|j	dd|j���n |j
d|j��||j�k7r |j|j�|_d|vr|j�}	||�yy#t$rw|j}|r>	|jdd	�}n*#t$r|j|j�}YnwxYw|j|�|_|j	d|�YywxYw)
Nr�MIME-Version�1.0�Content-TyperZr
zContent-Transfer-Encodingrr�)�	del_paramr_r"r��
add_header�get_output_charset�	set_param�body_encoder^�get_body_encodingr�r%�UnicodeErrorr�)rdrr�r�s    rr�zMessage.set_charset_se��	��?��N�N�9�%� �D�M���'�7�+��g�&�G���
���%��O�O�N�E�2���%��O�O�N�L�$+�$>�$>�$@�
�
B�
�N�N�9�g�&@�&@�&B�C��g�0�0�2�2�#�/�/��
�
�>�D�M�&�d�2��+�+�-�C�

B��D�	�3���
B��-�-���I�")�.�.��:K�"L���'�I�")�.�.��1G�1G�"H��I�� '� 3� 3�G� <��
���� ;�S�A�
B�s6�$C.�.E.�D�E.�$E�=E.�?E�+E.�-E.c��	|jSrg)r_ris r�get_charsetzMessage.get_charset�s��	��}�}�rc�.�	t|j�Srg)r!r\ris r�__len__zMessage.__len__�s��G��4�=�=�!�!rc�&�	|j|�Srg)r�)rd�names  r�__getitem__zMessage.__getitem__�s��	��x�x��~�rc�h�	|jj|�}|r_|j�}d}|jD]>\}}|j�|k(s�|dz
}||k\s�%t	dj||���|jj
|jj||��y)Nrrz/There may be at most {} {} headers in a message)r[�header_max_countr0r\rI�formatr1�header_store_parse)rdr��val�	max_count�lname�found�k�vs        r�__setitem__zMessage.__setitem__�s���	�
�K�K�0�0��6�	���J�J�L�E��E��
�
���1��7�7�9��%��Q�J�E��	�)�(�*8�8>��y�$�8O�Q�Q�	&�	
�
�
���T�[�[�;�;�D�#�F�Grc��	|j�}g}|jD],\}}|j�|k7s�|j||f��.||_yrg)r0r\r1)rdr��
newheadersr�r�s     r�__delitem__zMessage.__delitem__�sT��	��z�z�|���
��M�M�D�A�q��w�w�y�D� ��!�!�1�a�&�)�"�#��
rc�v�|j�}|jD]\}}||j�k(s�yy)NTF)r0r\)rdr��
name_lowerr�r�s     r�__contains__zMessage.__contains__�s5���Z�Z�\�
��M�M�D�A�q��Q�W�W�Y�&��"�rc#�<K�|jD]	\}}|���y�wrg�r\)rd�fieldr*s   r�__iter__zMessage.__iter__�s���� �M�M�L�E�5��K�*�s�c�N�	|jD��cgc]\}}|��	c}}Scc}}wrgr��rdr�r�s   r�keyszMessage.keys�s)��	�#�m�m�,�m�d�a���m�,�,��,s�!c��	|jD��cgc]!\}}|jj||���#c}}Scc}}wrg�r\r[�header_fetch_parser�s   r�valueszMessage.values�sG��	�!�M�M�+�)�D�A�q����.�.�q�!�4�)�+�	+��+s�&;c	��	|jD��cgc]#\}}||jj||�f��%c}}Scc}}wrgr�r�s   r�itemsz
Message.items�sL��	�!�M�M�+�)�D�A�q��D�K�K�2�2�1�a�8�9�)�+�	+��+s�(=c��	|j�}|jD]6\}}|j�|k(s�|jj||�cS|Srg)r0r\r[r�)rdr��failobjr�r�s     rr�zMessage.get�sR��	�
�z�z�|���M�M�D�A�q��w�w�y�D� ��{�{�5�5�a��;�;�"��rc�@�	|jj||f�yrg)r\r1)rdr�r*s   r�set_rawzMessage.set_raw�s��	�	
�
�
���d�E�]�+rc�J�	t|jj��Srg)rDr\�copyris r�	raw_itemszMessage.raw_itemss!��	��D�M�M�&�&�(�)�)rc���	g}|j�}|jD]D\}}|j�|k(s�|j|jj	||���F|s|S|Srg)r0r\r1r[r�)rdr�r�r�r�r�s      r�get_allzMessage.get_allse��	����z�z�|���M�M�D�A�q��w�w�y�D� ��
�
�d�k�k�<�<�Q��B�C�"���N��
rc	�0�	g}|j�D]T\}}|�"|j|jdd���*|jt|jdd�|���V|�|j	d|�t
j
|�||<y)NrS�-r)r�r1r�r+�insert�	SEMISPACErM)rd�_name�_value�_params�partsr�r�s       rr�zMessage.add_header#s���	�&���M�M�O�D�A�q��y����Q�Y�Y�s�C�0�1����\�!�)�)�C��*=�q�A�B�	$�
���L�L��F�#��n�n�U�+��U�rc�0�	|j�}ttt|j��|j�D]F\}\}}|j�|k(s�|j
j
||�|j|<yt|��rg)r0�zip�ranger!r\r[r��KeyError)rdr�r�r6r�r�s      r�replace_headerzMessage.replace_headerAs|��	����
���U�3�t�}�}�#5�6��
�
�F�I�A�v��1��w�w�y�E�!�#'�;�;�#A�#A�!�V�#L��
�
�a� ��G�
�5�/�!rc���	t�}|jd|�}||ur|j�St|�dj	�}|jd�dk7ry|S)N�content-typer�/rrZ)�objectr��get_default_typerr0r.)rd�missingr*�ctypes    r�get_content_typezMessage.get_content_typeTsh��	��(�������1���G���(�(�*�*��E�"�1�%�+�+�-���;�;�s��q� ���rc�L�	|j�}|jd�dS)Nr�r�r��split�rdr�s  r�get_content_maintypezMessage.get_content_maintypel�+��	�
�%�%�'���{�{�3���"�"rc�L�	|j�}|jd�dS)Nr�rr�r�s  r�get_content_subtypezMessage.get_content_subtypeur�rc��	|jSrg�rcris rr�zMessage.get_default_type~s��	��!�!�!rc��	||_yrgr�r�s  r�set_default_typezMessage.set_default_type�s��	�#��rc�l�t�}|j||�}||ur|Sg}t|�D]K}	|jdd�\}}|j	�}|j	�}|j
||f��Mtj|�}|S#t
$r|j	�}d}Y�IwxYw)Nrrr)	r�r�r7r�rrIr1r�
decode_params)	rdr��headerr�r*�params�pr�r�s	         r�_get_params_preservezMessage._get_params_preserve�s����(�������)���G���N����U�#�A�
��G�G�C��O�	��c��z�z�|���i�i�k��

�M�M�4��+�&�$��$�$�V�,���
��
�
��w�w�y����
�s�5B�B3�2B3c��	t�}|j||�}||ur|S|r |D��cgc]\}}|t|�f��c}}S|Scc}}wrg)r�rr:)rdr�r�r9r�r�r�r�s        r�
get_paramszMessage.get_params�s_��	��(���*�*�7�F�;���W���N��6<�=�f�d�a��Q�
�a�(�)�f�=�=��M��>s�Ac��	||vr|S|j||�D]9\}}|j�|j�k(s�(|r
t|�cS|cS|Srg)rr0r:)rdrr�r�r9r�r�s       r�	get_paramzMessage.get_param�s_��	�,����N��-�-�g�v�>�D�A�q��w�w�y�E�K�K�M�)��(��+�+��H�?��rc�h�	t|t�s|r|||f}||vr|j�dk(rd}n|j|�}|j	||��s3|st|||�}n�tj|t|||�g�}nwd}|j||��D]_\}	}
d}|	j�|j�k(rt|||�}n
t|	|
|�}|s|}�Itj||g�}�a||j|�k7r|r|j||�y||=|||<yy)Nr�rZ)r�r�r�r9)
r"r#r0r�rr+r�rMrr�)rdrr*r��requoter�languager�r��	old_param�	old_value�append_params            rr�zMessage.set_param�sA��	� �%��'�G��h��.�E����&�,�,�.�N�"B� �E��H�H�V�$�E��~�~�e�F�~�3��$�U�E�7�;��!����L���w�?�@�B���E�(,���v�@G�)8�)I�$�	�9�!���?�?�$����
�5�#/��u�g�#F�L�#/�	�9�g�#N�L��(�E�%�N�N�E�<�+@�A�E�)I��D�H�H�V�$�$���#�#�F�E�2���L�$��V��%rc	�,�	||vryd}|j||��D]Y\}}|j�|j�k7s�(|st|||�}�8tj	|t|||�g�}�[||j|�k7r	||=|||<yy)Nrr)rr0r+r�rMr�)rdrr�r�	new_ctyperr�s       rr�zMessage.del_params���	������	��O�O�6�7�O�C�D�A�q��w�w�y�E�K�K�M�)� � ,�Q��7� ;�I� )���	�0<�Q��7�0K�0M�!N�I�D������(�(��V��$�D��L�)rc��	|jd�dk(st�|j�dk(r|d=d|d<||vr|||<y|j||��}||=|||<|ddD]\}}|j	||||��y)Nr�rr�zmime-versionr�r�r)r.rIr0rr�)rdr�r�rr�rr�s       r�set_typezMessage.set_type&s���
	��z�z�#��!�#����<�<�>�^�+��^�$�#(�D�� �����D��L��������@����L���V���1�2�J�D�A�q��N�N�1�a���1�rc��	t�}|jd|d�}||ur|jd|d�}||ur|Stj|�j	�S)N�filename�content-dispositionr�r�)r�rr�collapse_rfc2231_valuer)rdr�r�rs    r�get_filenamezMessage.get_filenameFsd��	��(���>�>�*�g�7L�M���w���~�~�f�g�~�F�H��w���N��+�+�H�5�;�;�=�=rc��	t�}|jd|�}||ur|Stj|�j	�S)N�boundary)r�rrr�rstrip)rdr�r�rs    r�get_boundaryzMessage.get_boundaryVsG��	�
�(���>�>�*�g�6���w���N��+�+�H�5�<�<�>�>rc��	t�}|j|d�}||urtjd��g}d}|D]D\}}|j	�dk(r|jdd|zf�d}�2|j||f��F|s|jdd|zf�g}|jD]�\}	}
|	j	�dk(rzg}|D]2\}}
|
dk(r|j|��|j|�d|
����4tj|�}
|j|jj|	|
����|j|	|
f���||_y)	Nr�zNo Content-Type header foundFrz"%s"Trr)r�rr�HeaderParseErrorr0r1r\r�rMr[r�)rdrr�r��	newparams�foundp�pk�pvr��hr�r�r�r�s              r�set_boundaryzMessage.set_boundarycsY��	��(���*�*�7�N�C���W���)�)�*H�I�I��	����F�B���x�x�z�Z�'�� � �*�f�x�.?�!@�A���� � �"�b��*���
���j�&�8�*;�<�=��
��M�M�D�A�q��w�w�y�N�*���%�D�A�q��B�w����Q������1�%5�6�	&�
 �n�n�U�+���!�!�$�+�+�"@�"@��C�"H�I��!�!�1�a�&�)�"�#��
rc�V�	t�}|jd|�}||ur|St|t�r*|dxsd}	|dj	d�}t||�}	|j	d�|j�S#ttf$r|d}Y�8wxYw#t$r|cYSwxYw)Nrrzus-asciirr�)	r�rr"r#r%rr�r�r0)rdr�r�r�pcharsetrws      rr�zMessage.get_content_charset�s���	��(���.�.��G�4���g���N��g�u�%��q�z�/�Z�H�
%�#�1�:�,�,�-A�B���h��1��	��N�N�:�&��}�}���� ��.�
%�!�!�*��
%��
�	��N�	�s#� B�B�B�B�B(�'B(c�h�	|j�D�cgc]}|j|���c}Scc}wrg)�walkr�)rdr��parts   r�get_charsetszMessage.get_charsets�s3��	�?C�i�i�k�J�k�d��(�(��1�k�J�J��Js�/c�h�	|jd�}|�yt|�dj�}|S)Nrr)r�rr0)rdr*�c_ds   r�get_content_dispositionzMessage.get_content_disposition�s=��	�
���.�/���=���%� ��#�)�)�+���
r)r%)FrN)FN)NFrg)Nr�T)r�TNrF)r�T)r�T)3�__name__�
__module__�__qualname__r	rerjrhrxrwr}r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrr�r�rrrr!r�r'r*�email.iteratorsr%�rrrr�s��
�'�
*� �
�0�

�/�"��:� V�p&�(-B�^�"�	�H�$
#���-�	+�	+�
�",�*��$,�<
"�&�0#�#�"�#��*�,5C�� �DFJ�5:�1%�f%�,2�@>� ?�,#�\�<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�8��|�ddlm}|}t�|�
|�y)Nr)�default)�email.policyr3�superre)rdr[r3�	__class__s   �rrezMIMEPart.__init__�s����>�,��F�
���� rc�d��	|�|jn|}|�|j}t�|�
|||�Srg)r[�max_line_lengthr5rh)rdrprnr[r6s    �rrhzMIMEPart.as_string�s>���		�!'�����F����!�1�1�L��w� ��<��@�@rc�Z�|j|jjd����S)NT)�utf8�r[)rhr[�cloneris rrjzMIMEPart.__str__�s%���~�~�T�[�[�%6�%6�D�%6�%A�~�B�Brc�J�|jd�}|�dS|jdk(S)NrF�
attachment)r��content_disposition)rdr)s  r�
is_attachmentzMIMEPart.is_attachment�s+���h�h�,�-����u�P��)@�)@�L�)P�Prc#�\K�|j�ry|j�jd�\}}|dk(r||vr|j|�|f��y|dk7s|j	�sy|dk7r0|j�D]}|j
||�Ed{����yd|vr|jd�|f��d}|jd�}|r!|j�D]}|d|k(s�|}n|�|j�}|r|dnd}|�|j
||�Ed{���yy7��7��w)Nr��text�	multipart�related�start�
content-idr)	r@r�r�r/r}�
iter_parts�
_find_bodyrr�)	rdr&�preferencelist�maintype�subtype�subpart�	candidaterE�subpartss	         rrHzMIMEPart._find_body�sK��������� �1�1�3�9�9�#�>���'��v���.�(�%�+�+�G�4�d�;�;���{�"�$�*;�*;�*=���i���?�?�,���?�?�7�N�C�C�C�-����&�!�'�'�	�2�D�9�9��	����w�'����?�?�,���<�(�E�1� '�I��-����'�'�)�H�'/����T�I�� ����y�.�A�A�A�!�D��
B�s+�BD,�D(�AD,�*7D,�!D*�"D,�*D,c�z�	t|�}d}|j||�D]\}}||ks�|}|}|dk(s�|S|S)Nr)r!rH)rdrI�	best_prio�body�prior&s      r�get_bodyzMIMEPart.get_bodysZ��	���'�	����/�/�$��?�J�D�$��i�� �	����1�9����
@��r>�rB�html�rB�plain�rCrD�rC�alternativec#�K�	|j�jd�\}}|dk7s|dk(ry|j�}	|j�}|dk(rt|dk(ro|jd�}|r@d}g}|D]*}|j
d�|k(rd}�|j|��,|r|Ed{���y|jd	�|Ed{���yg}	|D]^}|j�jd�\}}||f|jvr&|j�s||	vr|	j|��[|���`y#t$rYywxYw7��7�|�w)
Nr�rCrZrDrEFrFTr)r�r�r�r�r�rr�r1�pop�_body_typesr@)
rdrJrKr�r�rEr��attachmentsr&�seens
          r�iter_attachmentszMIMEPart.iter_attachments&sg����		�!�1�1�3�9�9�#�>���'��{�"�g��&>���"�"�$��	��L�L�N�E�
�{�"�w�)�';��N�N�7�+�E���� ��!�D��x�x��-��6� $��#�*�*�4�0�	"�
�*�*�*���I�I�a�L��������D� $� 5� 5� 7� =� =�c� B��H�g��7�#�t�'7�'7�7��*�*�,���1D����G�$���J�
��7�	��	��$+��
�sI�?E�D1�AE�)E�*E�E�A+E�1	D=�:E�<D=�=E�Ec#�dK�	|j�r|j�Ed{���yy7��wrg)r}r�ris rrGzMIMEPart.iter_parts]s3����	������'�'�)�)�)��)�s�%0�.�0)�content_managerc�^�|�|jj}|j|g|��i|��Srg)r[rb�get_content�rdrb�args�kws    rrdzMIMEPart.get_contentes4���"�"�k�k�9�9�O�*��*�*�4�=�$�=�"�=�=rc�`�|�|jj}|j|g|��i|��yrg)r[rb�set_contentres    rrizMIMEPart.set_contentjs1���"�"�k�k�9�9�O�#��#�#�D�6�4�6�2�6rc�$�|j�dk(r5|j�}||fz}||vrtdj||���g}g}|jD]K\}}|j�j
d�r|j||f��9|j||f��M|r=t|�|j��}	||	_|j|	_
|	g|_
ng|_
||_d|z|d<|�|jd|�yy)NrCzCannot convert {} to {}�content-r;z
multipart/r�r)r�r�rIr�r\r0rFr1r�r[r^r�)
rdrK�disallowed_subtypesr�existing_subtype�keep_headers�part_headersr�r*r&s
          r�_make_multipartzMIMEPart._make_multipartos���$�$�&�+�5�#�7�7�9��"5��
�"B���#6�6� �!:�!A�!A�$�g�"/�0�0������=�=�K�D�%��z�z�|�&�&�z�2��#�#�T�5�M�2��#�#�T�5�M�2�	)�
��4��:�T�[�[�1�D�(�D�M� �M�M�D�M�!�F�D�M��D�M�$��
�+�g�5��^�����N�N�:�x�0� rc�*�|jdd|�y)NrD)rZ�mixed�rp�rdrs  r�make_relatedzMIMEPart.make_related�s�����Y�(@�(�Krc�*�|jdd|�y)NrZ)rrrsrts  r�make_alternativezMIMEPart.make_alternative�s�����]�J��Arc�*�|jdd|�y)Nrrr/rsrts  r�
make_mixedzMIMEPart.make_mixed�s�����W�b�(�3r)�_dispc��|j�dk7s|j�|k7rt|d|z��t|�|j��}|j
|i|��|r	d|vr||d<|j
|�y)NrC�make_r;rzContent-Disposition)r�r��getattrr�r[rir�)rd�_subtyperzrfrgr&s      r�_add_multipartzMIMEPart._add_multipart�s����%�%�'�;�6��(�(�*�h�6�-�G�D�'�H�,�-�/��t�D�z����-������$�%�"�%��*�$�6�*/�D�&�'����D�rc�4�|jdg|��ddi|��y)NrDrz�inline�r�rdrfrgs   r�add_relatedzMIMEPart.add_related�s!������I�C��C�H�C��Crc�0�|jdg|��i|��y)NrZr�r�s   r�add_alternativezMIMEPart.add_alternative�s������M�7�D�7�B�7rc�4�|jdg|��ddi|��y)Nrrrzr>r�r�s   r�add_attachmentzMIMEPart.add_attachment�s!������G�E�d�E�,�E�"�Erc� �g|_d|_yrg)r\r^ris r�clearzMIMEPart.clear�s����
���
rc��|jD��cgc](\}}|j�jd�s||f��*c}}|_d|_ycc}}w)Nrk)r\r0rFr^)rd�nr�s   r�
clear_contentzMIMEPart.clear_content�sN��,0�M�M�B�M�D�A�q� !���	� 4� 4�Z� @��Q��M�B��
���
��Bs�-Arg)FNN))rDrUrW)r+r,r-rerhrjr@rHrSr]r`rGrdrirprurwryrr�r�r�r�r��
__classcell__�r6s@rr1r1�s����!�A� C�Q�B�:�(1�K�5�n*�26�>�
26�7�
1�6L�B�4�59��D�8�F��rr1c���eZdZ�fd�Z�xZS)rc�8��t�|�|i|��d|vrd|d<yy)Nr�r�)r5ri)rdrfrgr6s   �rrizEmailMessage.set_content�s,���
���T�(�R�(���%�#(�D�� �&r)r+r,r-rir�r�s@rrr�s
���)�)r)NT)�__all__rJ�rer��iorr�emailrr�email._policybaser	rr_�email._encoded_wordsrr�r��compiler'rr+r7r:rWrr1rr/rr�<module>r�s���
?��n�
%���	�
� ���&�%�)�
�
�
���	�
�B�J�J�2�3�	� � �D�($�#�>G
%�G
%�T\�w�\�~)�8�)r

?>