HEX
Server: Apache
System: Linux bd12.noc223.com 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: handcraf (1693)
PHP: 8.1.28
Disabled: NONE
Upload Files
File: //opt/alt/python312/lib64/python3.12/email/__pycache__/generator.cpython-312.opt-2.pyc
�

|h�e�N��X�	gd�ZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZdZdZ
ejd�Zejd	ej �ZGd
�d�ZGd�d
e�ZdZGd�de�Zeeej0dz
��ZdezZej6Zy))�	Generator�DecodedGenerator�BytesGenerator�N)�deepcopy)�StringIO�BytesIO)�_has_surrogates�_�
z
\r\n|\r|\nz^From c��eZdZ	ddd�d�Zd�Zdd�Zd�Zd�Zd�Zd	�Z	d
�Z
d�Zd�Zd
�Z
e
Zd�Zd�Zd�Zd�Zedd��Zed��Zy)rN��policyc�b�	|�|�dn|j}||_||_||_||_y)NT)�mangle_from_�_fp�
_mangle_from_�maxheaderlenr)�self�outfprrrs     �6/opt/alt/python312/lib64/python3.12/email/generator.py�__init__zGenerator.__init__#s>��	�.��#)�>�4�v�7J�7J�L����)���(������c�:�|jj|�y�N)r�write�r�ss  rrzGenerator.writeCs�������q�rc���	|j�|jn|j}|�|j|��}|j�|j|j��}|j|_|j|j�|_d|_|j|j�|_|j}|j}	||_||_|rZ|j�}|s*dtjtj��z}|j||jz�|j|�||_||_y#||_||_wxYw)N)�linesep��max_line_length�zFrom nobody )r�clonerr�_NL�_encode�_encoded_NL�_EMPTY�_encoded_EMPTY�get_unixfrom�time�ctimer�_write)r�msg�unixfromrr�old_gen_policy�old_msg_policy�ufroms        r�flattenzGenerator.flattenGs*��	�( $�{�{�2�����������\�\�'�\�2�F����(��\�\�$�2C�2C�\�D�F��>�>����<�<����1������"�l�l�4�;�;�7���
��������	(� �D�K��C�J���(�(�*���*�T�Z�Z��	�	��-D�D�E��
�
�5�4�8�8�+�,��K�K���(�D�K�'�C�J��)�D�K�'�C�J�s
�A;E�E-c�V�	|j||jd|j��S�Nr
)�	__class__rr)r�fps  rr#zGenerator.clonexs0��?��~�~�b�"�0�0�"�%)�[�[��2�	2rc��t�Sr)r�rs r�_new_bufferzGenerator._new_buffer�s
���z�rc��|Sr�rs  rr%zGenerator._encode�s���rc���|sytj|�}|ddD].}|j|�|j|j��0|dr|j|d�yy)N���)�NLCRE�splitrr$)r�lines�lines   r�_write_lineszGenerator._write_lines�se�������E�"���#�2�J�	!�D��J�J�t���J�J�t�x�x� �	!���9��J�J�u�R�y�!�rc� �|j}	d|_|j�x|_}|j|�||_|j}|`|rOt	|�}|jd��	|d|d<n|j
d|d�|j
d|d�t|dd�}|�|j|�n||�|jj|j��y#||_|j}|`wxYw)N�content-transfer-encodingr�Content-Transfer-Encoding�content-type��_write_headers)r�
_munge_cter9�	_dispatchr�get�replace_header�getattrrHr�getvalue)rr-�oldfp�sfp�	munge_cte�meths      rr,zGenerator._write�s�������	 �"�D�O�!�-�-�/�/�D�H�s��N�N�3���D�H����I�����3�-�C��w�w�2�3�;�3<�Q�<��/�0��"�"�#>�	�!��M����~�y��|�<��s�,�d�3���<�����$���J������s�|�|�~�&��'�D�H����I���s�/C6�6D
c�&�|j�}|j�}tj||f�j	dd�}t|d|zd�}|�0|j	dd�}t|d|zd�}|�|j}||�y)N�-r
�_handle_)�get_content_maintype�get_content_subtype�
UNDERSCORE�join�replacerM�
_writeBody)rr-�main�sub�specificrR�generics       rrJzGenerator._dispatch�s���
�'�'�)���%�%�'���?�?�D�#�;�/�7�7��S�A���t�Z�(�2�D�9���<��l�l�3��,�G��4��g�!5�t�<�D��|������S�	rc��|j�D]0\}}|j|jj||���2|j|j�yr)�	raw_itemsrr�foldr$�rr-�h�vs    rrHzGenerator._write_headers�sJ���M�M�O�	/�D�A�q��J�J�t�{�{�'�'��1�-�.�	/�	
�
�
�4�8�8�rc��|j�}|�yt|t�stdt	|�z��t|j�rR|jd�}|�?t|�}|d=|j||�|j�}|d|df|_
|jrtjd|�}|j|�y)Nzstring payload expected: %s�charsetrDrF�>From )�get_payload�
isinstance�str�	TypeError�typer	�_payload�	get_paramr�set_payloadrIr�fcrer]rB)rr-�payloadrgs    r�_handle_textzGenerator._handle_text�s����/�/�#���?���'�3�'��9�D��M�I�J�J��3�<�<�(��m�m�I�.�G��"��s�m���3�4������1��/�/�+��#&�'B�#C�#&�~�#6�#8�������h�h�x��1�G����'�"rc�0�g}|j�}|�g}n5t|t�r|j|�yt|t�s|g}|D]`}|j�}|j
|�}|j|d|j��|j|j���b|j�}|s=|jj|�}|j|�}|j|�|j �e|j"r!t$j'd|j �}	n|j }	|j)|	�|j|j�|jd|z|jz�|r*|j*j|j-d��|D]K}
|j|jdz|z|jz�|j*j|
��M|j|jdz|zdz|jz�|j.�K|j"r!t$j'd|j.�}n|j.}|j)|�yy)NF�r.rrhz--r)rirjrkr�listr9r#r2r$�appendrN�get_boundaryr&rY�_make_boundary�set_boundary�preamblerrqr]rBr�pop�epilogue)rr-�msgtexts�subparts�partr�g�boundary�alltextr{�	body_partr}s            r�_handle_multipartzGenerator._handle_multiparts�����?�?�$�����H�
��#�
&��J�J�x� ���H�d�+� �z�H��	*�D�� � �"�A��
�
�1�
�A�
�I�I�d�U�D�H�H�I�=��O�O�A�J�J�L�)�		*��#�#�%����&�&�+�+�H�5�G��*�*�7�3�H����X�&��<�<�#��!�!��8�8�H�c�l�l�;���<�<�����h�'��J�J�t�x�x� ��
�
�4�(�?�T�X�X�-�.���H�H�N�N�8�<�<��?�+�"�	&�I��J�J�t�x�x�$���1�D�H�H�<�=��H�H�N�N�9�%�		&�	
�
�
�4�8�8�d�?�X�-��4�t�x�x�?�@��<�<�#��!�!��8�8�H�c�l�l�;���<�<�����h�'�$rc��|j}|jd��|_	|j|�||_y#||_wxYw)Nrr )rr#r�)rr-�ps   r�_handle_multipart_signedz"Generator._handle_multipart_signed;sA��
�K�K���g�g�a�g�0���	��"�"�3�'��D�K��!�D�K�s	�>�	Ac��g}|j�D]�}|j�}|j|�}|j|d|j��|j�}|j
|j�}|r@|d|jk(r.|j|jj|dd����|j|���|jj|jj|��y)NFrur=)
rir9r#r2r$rNr?r&r(rwrYrr)rr-�blocksr�rr��textr@s        r�_handle_message_delivery_statusz)Generator._handle_message_delivery_statusFs������O�O�%�
	$�D�� � �"�A��
�
�1�
�A�
�I�I�d�U�D�H�H�I�=��:�:�<�D��J�J�t�/�/�0�E���r��d�&9�&9�9��
�
�d�.�.�3�3�E�#�2�J�?�@��
�
�d�#�
	$�	
�����t�'�'�,�,�V�4�5rc�R�|j�}|j|�}|j}t|t�r>|j|j
d�d|j��|j�}n|j|�}|jj|�y)NrFru)r9r#rnrjrvr2rir$rNr%rr)rr-rr�rrs     r�_handle_messagezGenerator._handle_message[sz��������J�J�q�M���,�,���g�t�$�
�I�I�c�o�o�a�(�5�$�(�(�I�K��j�j�l�G��l�l�7�+�G������w�rc�@�tjtj�}dt|zzdz}|�|S|}d}	|jdt
j|�zdztj�}|j|�s	|S|dzt|�z}|dz
}�d)Nz===============z==rz^--z(--)?$�.rG)�random�	randrange�sys�maxsize�_fmt�_compile_re�re�escape�	MULTILINE�searchrk)�clsr��tokenr��b�counter�cres       rryzGenerator._make_boundaryts���� � ����-������.��5���<��O�������/�/�%�"�)�)�A�,�"6��"A�2�<�<�P�C��:�:�d�#�����3���W��-�A��q�L�G�rc�.�tj||�Sr)r��compile�r�r�flagss   rr�zGenerator._compile_re�s���z�z�!�U�#�#r)NN)FNr)�__name__�
__module__�__qualname__rrr2r#r9r%rBr,rJrHrsr[r�r�r�r��classmethodryr�r;rrrrs�������@�/(�b2�(��	"� %'�N�(�#�,�J�8(�t	�6�* �2����"�$��$rrc�L��eZdZ	d�Zd�Zd�Zd�Z�fd�ZeZe	d��Z
�xZS)rc�Z�|jj|jdd��y)N�ascii�surrogateescape)rr�encoders  rrzBytesGenerator.write�s�������q�x�x��):�;�<rc��t�Sr)rr8s rr9zBytesGenerator._new_buffer�s
���y�rc�$�|jd�S�Nr�)r�rs  rr%zBytesGenerator._encode�s���x�x�� � rc���|j�D]:\}}|jj|jj	||���<|j|j
�yr)rarrr�fold_binaryr$rcs    rrHzBytesGenerator._write_headers�sP���M�M�O�	:�D�A�q��H�H�N�N�4�;�;�2�2�1�a�8�9�	:�	
�
�
�4�8�8�rc�<��|j�yt|j�rf|jjdk(sM|jr%t
j
d|j�|_|j|j�ytt|�+|�y)N�7bitrh)rnr	r�cte_typerrqr]rB�superrrs)rr-r5s  �rrszBytesGenerator._handle_text�so����<�<����3�<�<�(����1E�1E�v�1M��!�!�#�x�x��#�,�,�?������c�l�l�+��.��3�C�8rc�L�tj|jd�|�Sr�)r�r�r�r�s   rr�zBytesGenerator._compile_re�s���z�z�!�(�(�7�+�U�3�3r)r�r�r�rr9r%rHrsr[r�r��
__classcell__)r5s@rrr�s:���
�=��!��
9��J��4��4rrzD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c�"�eZdZ	ddd�d�Zd�Zy)rNr
c�d�	tj|||||��|�t|_y||_yr4)rr�_FMTr�)rrrr�fmtrs      rrzDecodedGenerator.__init__�s:��	�*	���4���l�"(�	�	*��;��D�I��D�Irc
��|j�D]�}|j�}|dk(rt|jd��|���6|dk(r�<t|j|j�|j�|j
�|jd�|jdd�|jd	d
�d�z|����y)Nr�F)�decode)�file�	multipartz
[no filename]zContent-Descriptionz[no description]rEz
[no encoding])rm�maintype�subtype�filename�description�encoding)	�walkrV�printrir��get_content_typerW�get_filenamerK)rr-r�r�s    rrJzDecodedGenerator._dispatch�s����H�H�J�	"�D��0�0�2�H��6�!��d�&�&�e�&�4�4�@��[�(���d�i�i�#'�#8�#8�#:�#'�#<�#<�#>�#'�#;�#;�#=�#'�#4�#4�_�#E�#'�8�8�,A�,>�$@�#'�8�8�,G�,;�$=�	#�	�!�	"�	"r)NNN)r�r�r�rrJr;rrrr�s���
���<"rrrGz%%0%dd)�__all__r�r�r*r��copyr�iorr�email.utilsr	rX�NLr�r>r�rqrrr�r�len�reprr��_widthr�ryr;rr�<module>r�s���
A�
=��	�
��
�� �'�
�
�	����
�
�=�!���r�z�z�)�R�\�\�*��o$�o$�d/4�Y�/4�dN��6"�y�6"�t

�T�#�+�+�a�-�
 �	!���&����)�)�r