Your IP : 18.220.13.15


Current Path : /opt/alt/python39/lib64/python3.9/email/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/email/__pycache__/generator.cpython-39.opt-2.pyc

a

R�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�eZdZd&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��policycCs6|dur|durdn|j}||_||_||_||_dS)NT)�mangle_from_�_fp�
_mangle_from_�maxheaderlenr
)�self�outfprrr
�r�4/opt/alt/python39/lib64/python3.9/email/generator.py�__init__&szGenerator.__init__cCs|j�|�dS�N)r�write�r�srrrrFszGenerator.writeFcCs�|jdur|jn|j}|dur*|j|d�}|jdurB|j|jd�}|j|_|�|j�|_d|_|�|j�|_|j}|j}zX||_||_|r�|�	�}|s�dt
�t
�
��}|�||j�|�
|�W||_||_n||_||_0dS)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�flattenJs0
�zGenerator.flattencCs|j||jd|jd�S�Nr)�	__class__rr
)r�fprrrr{s
�zGenerator.clonecCst�Sr)r�rrrr�_new_buffer�szGenerator._new_buffercCs|Srrrrrrr �szGenerator._encodecCsT|sdSt�|�}|dd�D]}|�|�|�|j�q|drP|�|d�dS)N���)�NLCRE�splitrr)r�lines�linerrr�_write_lines�s

zGenerator._write_linescCs�|j}z2d|_|��|_}|�|�W||_|j}|`n||_|j}|`0|r�t|�}|�d�durt|d|d<n|�d|d�|�d|d�t|dd�}|dur�|�|�n||�|j�	|�
��dS)N�content-transfer-encodingr�Content-Transfer-Encoding�content-type��_write_headers)r�
_munge_cter-�	_dispatchr�getZreplace_header�getattrr8r�getvalue)rr&ZoldfpZsfpZ	munge_cte�methrrrr%�s,�zGenerator._writecCst|��}|��}t�||f��dd�}t|d|d�}|durh|�dd�}t|d|d�}|durh|j}||�dS)N�-r
Z_handle_)�get_content_maintype�get_content_subtype�
UNDERSCORE�join�replacer<�
_writeBody)rr&�main�subZspecificr>Zgenericrrrr:�szGenerator._dispatchcCs�|��D]p\}}|j�||�}|jjrn|jj}|�|jj�sPtd|�d|����t�|�	|��rntd|����|�
|�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�vZfoldedrrrrr8�s��zGenerator._write_headerscCs�|��}|durdSt|t�s.tdt|���t|j�r~|�d�}|dur~t|�}|d=|�	||�|��}|d|df|_
|jr�t�
d|�}|�|�dS)Nzstring payload expected: %s�charsetr4r6�>From )�get_payload�
isinstance�str�	TypeError�typer�_payloadZ	get_paramrZset_payloadr9r�fcrerGr3)rr&�payloadrOrrr�_handle_text�s$


�zGenerator._handle_textcCs�g}|��}|durg}n(t|t�r2|�|�dSt|t�sB|g}|D]6}|��}|�|�}|j|d|jd�|�	|�
��qF|��}|s�|j�
|�}|�|�}|�|�|jdur�|jr�t�d|j�}	n|j}	|�|	�|�|j�|�d||j�|�r|j�|�d��|D],}
|�|jd||j�|j�|
��q|�|jd|d|j�|jdu�r�|j�r�t�d|j�}n|j}|�|�dS)NF�r'rrPz--r)rQrRrSr�listr-rr(r�appendr=Zget_boundaryr!rC�_make_boundaryZset_boundary�preamblerrWrGr3r�pop�epilogue)rr&ZmsgtextsZsubparts�partr�g�boundaryZalltextr^Z	body_partr`rrr�_handle_multipart
sJ







zGenerator._handle_multipartcCs6|j}|jdd�|_z|�|�W||_n||_0dS)Nrr)r
rrd)rr&�prrr�_handle_multipart_signedGs
z"Generator._handle_multipart_signedcCs�g}|��D]t}|��}|�|�}|j|d|jd�|��}|�|j�}|rv|d|jkrv|�	|j�
|dd���q|�	|�q|j�|j�
|��dS)NFrZr.)
rQr-rr(rr=r0r!r"r\rCrr)rr&Zblocksrarrb�textr1rrr�_handle_message_delivery_statusRs
z)Generator._handle_message_delivery_statuscCs^|��}|�|�}|j}t|t�rD|j|�d�d|jd�|��}n
|�	|�}|j
�|�dS)NrFrZ)r-rrVrRr[r(rQrr=r rr)rr&rrbrXrrr�_handle_messagegs




zGenerator._handle_messagecCsvt�tj�}dt|d}|dur(|S|}d}|�dt�|�dtj�}|�	|�sXqr|dt
|�}|d7}q0|S)Nz===============z==rz^--z(--)?$�.r7)�randomZ	randrange�sys�maxsize�_fmt�_compile_re�re�escape�	MULTILINErKrS)�clsrg�tokenrc�bZcounterZcrerrrr]�s

zGenerator._make_boundarycCst�||�Sr)rp�compile�rsr�flagsrrrro�szGenerator._compile_re)NN)FN)N)�__name__�
__module__�__qualname__rrr(rr-r r3r%r:r8rYrErdrfrhri�classmethodr]rorrrrrs,
� 
1':rcsLeZdZdd�Zdd�Zdd�Zdd�Z�fd	d
�ZeZe	dd��Z
�ZS)
rcCs|j�|�dd��dS)N�ascii�surrogateescape)rr�encoderrrrr�szBytesGenerator.writecCst�Sr)rr,rrrr-�szBytesGenerator._new_buffercCs
|�d�S�Nr})rrrrrr �szBytesGenerator._encodecCs8|��D]\}}|j�|j�||��q|�|j�dSr)rHrrr
Zfold_binaryr)rr&rMrNrrrr8�szBytesGenerator._write_headerscs\|jdurdSt|j�rH|jjdksH|jr:t�d|j�|_|�|j�ntt	|��
|�dS)NZ7bitrP)rVrr
Zcte_typerrWrGr3�superrrY)rr&�r*rrrY�s
zBytesGenerator._handle_textcCst�|�d�|�Sr�)rprvrrwrrrro�szBytesGenerator._compile_re)ryrzr{rr-r r8rYrEr|ro�
__classcell__rrr�rr�s

rzD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s$eZdZddd�dd�Zdd�ZdS)rNrcCs.tj|||||d�|dur$t|_n||_dSr))rr�_FMTrn)rrrrZfmtr
rrrr�s�zDecodedGenerator.__init__cCs�|��D]v}|��}|dkr2t|jdd�|d�q|dkr<qt|j|��|��|��|�d�|�dd�|�d	d
�d�|d�qdS)NrgF)�decode)�fileZ	multipartz
[no filename]zContent-Descriptionz[no description]r5z
[no encoding])rU�maintypeZsubtype�filenameZdescription�encoding)	�walkr@�printrQrnZget_content_typerA�get_filenamer;)rr&rar�rrrr:�s(���	�zDecodedGenerator._dispatch)NNN)ryrzr{rr:rrrrr�s�rr7z%%0%dd)�__all__rprlr#rk�copyr�iorrZemail.utilsrZemail.errorsr	rB�NLrvr/rrrWrJrrr�r�len�reprrmZ_widthrnr]rrrr�<module>s,

}3;

?>