AlkantarClanX12

Your IP : 3.142.131.51


Current Path : /opt/alt/python310/lib64/python3.10/email/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/email/__pycache__/generator.cpython-310.opt-2.pyc

o

6��fPQ�@s�	gd�ZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZddlm
Z
dZdZe�d	�Ze�d
ej�Ze�d�ZGdd
�d
�ZGdd�de�ZdZGdd�de�Zeeejd��ZdeZejZdS))�	Generator�DecodedGenerator�BytesGenerator�N)�deepcopy)�StringIO�BytesIO)�_has_surrogates)�HeaderWriteError�_�
z
\r\n|\r|\nz^From z\r\n[^ \t]|\r[^ \n\t]|\n[^ \t]c@s�eZdZ	d&dd�dd�Zdd�Zd'dd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
e
Zdd�Zdd�Zdd�Zd d!�Zed(d"d#��Zed$d%��ZdS))rN��policycCs8	|dur|durdn|j}||_||_||_||_dS)NT)�mangle_from_�_fp�
_mangle_from_�maxheaderlenr
)�self�outfprrr
�r�6/opt/alt/python310/lib64/python3.10/email/generator.py�__init__&s
zGenerator.__init__cCs|j�|�dS�N)r�write�r�srrrrFszGenerator.writeFcCs�	|jdur	|jn|j}|dur|j|d�}|jdur"|j|jd�}|j|_|�|j�|_d|_|�|j�|_|j}|j}z-||_||_|r]|�	�}|sUdt
�t
�
��}|�||j�|�
|�W||_||_dS||_||_w)N)�linesep�Zmax_line_length�zFrom nobody )r
�clonerr�_NL�_encode�_encoded_NLZ_EMPTY�_encoded_EMPTYZget_unixfrom�time�ctimer�_write)r�msg�unixfromrr
Zold_gen_policyZold_msg_policyZufromrrr�flattenJs2

�zGenerator.flattencCs	|j||jd|jd�S�Nr)�	__class__rr
)r�fprrrr{s�zGenerator.clonecC�t�Sr)r�rrrr�_new_buffer�szGenerator._new_buffercCs|Srrrrrrr �szGenerator._encodecCsX|sdSt�|�}|dd�D]
}|�|�|�|j�q|dr*|�|d�dSdS)N���)�NLCRE�splitrr)r�lines�linerrr�_write_lines�s

�zGenerator._write_linescCs�|j}zd|_|��|_}|�|�W||_|j}|`n	||_|j}|`w|rJt|�}|�d�dur:|d|d<n|�d|d�|�d|d�t|dd�}|durZ|�|�n||�|j�	|�
��dS)N�content-transfer-encodingr�Content-Transfer-Encoding�content-type��_write_headers)r�
_munge_cter.�	_dispatchr�getZreplace_header�getattrr9r�getvalue)rr&ZoldfpZsfpZ	munge_cte�methrrrr%�s,�zGenerator._writecCst|��}|��}t�||f��dd�}t|d|d�}|dur4|�dd�}t|d|d�}|dur4|j}||�dS)N�-r
Z_handle_)�get_content_maintype�get_content_subtype�
UNDERSCORE�join�replacer=�
_writeBody)rr&�main�subZspecificr?Zgenericrrrr;�szGenerator._dispatchcCs�|��D]8\}}|j�||�}|jjr7|jj}|�|jj�s(td|�d|����t�|�	|��r7td|����|�
|�q|�
|j�dS)Nz folded header does not end with z: z folded header contains newline: )�	raw_itemsr
ZfoldZverify_generated_headersr�endswithr	�NEWLINE_WITHOUT_FWSP�search�removesuffixrr)rr&�h�vZfoldedrrrrr9�s��zGenerator._write_headerscCs�|��}|dur
dSt|t�stdt|���t|j�r?|�d�}|dur?t|�}|d=|�	||�|��}|d|df|_
|jrHt�
d|�}|�|�dS)Nzstring payload expected: %s�charsetr5r7�>From )�get_payload�
isinstance�str�	TypeError�typer�_payloadZ	get_paramrZset_payloadr:r�fcrerHr4)rr&�payloadrPrrr�_handle_text�s$


�zGenerator._handle_textcCs�g}|��}|dur
g}nt|t�r|�|�dSt|t�s!|g}|D]}|��}|�|�}|j|d|jd�|�	|�
��q#|��}|sU|j�
|�}|�|�}|�|�|jdurs|jret�d|j�}	n|j}	|�|	�|�|j�|�d||j�|r�|j�|�d��|D]}
|�|jd||j�|j�|
�q�|�|jd|d|j�|jdur�|jr�t�d|j�}n|j}|�|�dSdS)NF�r'rrQz--r)rRrSrTr�listr.rr(r�appendr>Zget_boundaryr!rD�_make_boundaryZset_boundary�preamblerrXrHr4r�pop�epilogue)rr&ZmsgtextsZsubparts�partr�g�boundaryZalltextr_Z	body_partrarrr�_handle_multipart
sL








�zGenerator._handle_multipartcCs4|j}|jdd�|_z|�|�W||_dS||_w)Nrr)r
rre)rr&�prrr�_handle_multipart_signedGs
z"Generator._handle_multipart_signedcCs�g}|��D]:}|��}|�|�}|j|d|jd�|��}|�|j�}|r;|d|jkr;|�	|j�
|dd���q|�	|�q|j�|j�
|��dS)NFr[r/)
rRr.rr(rr>r1r!r"r]rDrr)rr&Zblocksrbrrc�textr2rrr�_handle_message_delivery_statusRs
z)Generator._handle_message_delivery_statuscCs^|��}|�|�}|j}t|t�r"|j|�d�d|jd�|��}n|�	|�}|j
�|�dS)NrFr[)r.rrWrSr\r(rRrr>r rr)rr&rrcrYrrr�_handle_messagegs




zGenerator._handle_messagecCsxt�tj�}dt|d}|dur|S|}d}	|�dt�|�dtj�}|�	|�s/	|S|dt
|�}|d7}q)	Nz===============z==rTz^--z(--)?$�.r8)�randomZ	randrange�sys�maxsize�_fmt�_compile_re�re�escape�	MULTILINErLrT)�clsrh�tokenrd�bZcounterZcrerrrr^�s
��zGenerator._make_boundarycCst�||�Sr)rq�compile�rtr�flagsrrrrp�szGenerator._compile_re)NN)FNr)�__name__�
__module__�__qualname__rrr(rr.r r4r%r;r9rZrFrergrirj�classmethodr^rprrrrrs0	� 
1':rcsNeZdZ	dd�Zdd�Zdd�Zdd�Z�fd	d
�ZeZe	dd��Z
�ZS)
rcCs|j�|�dd��dS)N�ascii�surrogateescape)rr�encoderrrrr�szBytesGenerator.writecCr,r)rr-rrrr.�szBytesGenerator._new_buffercCs
|�d�S�Nr~)r�rrrrr �s
zBytesGenerator._encodecCs8|��D]\}}|j�|j�||��q|�|j�dSr)rIrrr
Zfold_binaryr)rr&rNrOrrrr9�szBytesGenerator._write_headerscs^|jdurdSt|j�r%|jjdks%|jrt�d|j�|_|�|j�dStt	|��
|�dS)NZ7bitrQ)rWrr
Zcte_typerrXrHr4�superrrZ)rr&�r*rrrZ�s
zBytesGenerator._handle_textcCst�|�d�|�Sr�)rqrwr�rxrrrrp�szBytesGenerator._compile_re)rzr{r|rr.r r9rZrFr}rp�
__classcell__rrr�rr�s
rzD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s&eZdZ	ddd�dd�Zdd�ZdS)rNrcCs2	tj|||||d�|durt|_dS||_dSr))rr�_FMTro)rrrrZfmtr
rrrr�s�

zDecodedGenerator.__init__cCs�|��D];}|��}|dkrt|jdd�|d�q|dkrqt|j|��|��|��|�d�|�dd�|�d	d
�d�|d�qdS)NrhF)�decode)�fileZ	multipartz
[no filename]zContent-Descriptionz[no description]r6z
[no encoding])rV�maintypeZsubtype�filename�description�encoding)	�walkrA�printrRroZget_content_typerB�get_filenamer<)rr&rbr�rrrr;�s*���	��zDecodedGenerator._dispatch)NNN)rzr{r|rr;rrrrr�s�rr8z%%0%dd)�__all__rqrmr#rl�copyr�iorrZemail.utilsrZemail.errorsr	rC�NLrwr0rsrXrKrrr�r�len�reprrnZ_widthror^rrrr�<module>s0

}3;