AlkantarClanX12

Your IP : 3.145.85.74


Current Path : /lib64/python3.8/email/__pycache__/
Upload File :
Current File : //lib64/python3.8/email/__pycache__/generator.cpython-38.opt-2.pyc

U

e5d�N�@s�dddgZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZdZd	Z
e�d
�Ze�dej�ZGdd�d�ZGd
d�de�ZdZGdd�de�Zeeejd��ZdeZejZdS)�	Generator�DecodedGenerator�BytesGenerator�N)�deepcopy)�StringIO�BytesIO)�_has_surrogates�_�
z
\r\n|\r|\nz^From 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|dkr|dkrdn|j}||_||_||_||_dS)NT)�mangle_from_�_fp�
_mangle_from_�maxheaderlenr)�self�outfpr
rr�r�'/usr/lib64/python3.8/email/generator.py�__init__$szGenerator.__init__cCs|j�|�dS�N)r�write�r�srrrrDszGenerator.writeFcCs�|jdkr|jn|j}|dk	r*|j|d�}|jdk	rB|j|jd�}|j|_|�|j�|_d|_|�|j�|_|j}|j}zL||_||_|r�|�	�}|s�dt
�t
�
��}|�||j�|�
|�W5||_||_XdS)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�flattenHs,
zGenerator.flattencCs|j||jd|jd�S�Nr)�	__class__rr)r�fprrrrys
�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}z"d|_|��|_}|�|�W5||_|j}|`X|r�t|�}|�d�dkrd|d|d<n|�d|d�|�d|d�t|dd�}|dkr�|�|�n||�|j�	|�
��dS)N�content-transfer-encodingr�Content-Transfer-Encoding�content-type��_write_headers)r�
_munge_cter,�	_dispatchr�getZreplace_header�getattrr7r�getvalue)rr%ZoldfpZ	munge_cteZsfp�methrrrr$�s&zGenerator._writecCst|��}|��}t�||f��dd�}t|d|d�}|dkrh|�dd�}t|d|d�}|dkrh|j}||�dS)N�-r	Z_handle_)�get_content_maintype�get_content_subtype�
UNDERSCORE�join�replacer;�
_writeBody)rr%�main�subZspecificr=Zgenericrrrr9�szGenerator._dispatchcCs6|��D]\}}|�|j�||��q|�|j�dSr)�	raw_itemsrrZfoldr�rr%�h�vrrrr7�szGenerator._write_headerscCs�|��}|dkrdSt|t�s.tdt|���t|j�r~|�d�}|dk	r~t|�}|d=|�	||�|��}|d|df|_
|jr�t�
d|�}|�|�dS)Nzstring payload expected: %s�charsetr3r5�>From )�get_payload�
isinstance�str�	TypeError�typer�_payloadZ	get_paramrZset_payloadr8r�fcrerFr2)rr%�payloadrKrrr�_handle_text�s$


�zGenerator._handle_textcCs�g}|��}|dkrg}n(t|t�r2|�|�dSt|t�sB|g}|D]6}|��}|�|�}|j|d|jd�|�	|�
��qF|��}|s�|j�
|�}|�|�}|�|�|jdk	r�|jr�t�d|j�}	n|j}	|�|	�|�|j�|�d||j�|�r|j�|�d��|D],}
|�|jd||j�|j�|
��q|�|jd|d|j�|jdk	�r�|j�r�t�d|j�}n|j}|�|�dS)NF�r&rrLz--r)rMrNrOr�listr,rr'r�appendr<Zget_boundaryr rB�_make_boundaryZset_boundary�preamblerrSrFr2r�pop�epilogue)rr%ZmsgtextsZsubparts�partr�g�boundaryZalltextrZZ	body_partr\rrr�_handle_multipartsJ







zGenerator._handle_multipartcCs0|j}|jdd�|_z|�|�W5||_XdS)Nrr)rrr`)rr%�prrr�_handle_multipart_signed<s
z"Generator._handle_multipart_signedcCs�g}|��D]t}|��}|�|�}|j|d|jd�|��}|�|j�}|rv|d|jkrv|�	|j�
|dd���q|�	|�q|j�|j�
|��dS)NFrVr-)
rMr,rr'rr<r/r r!rXrBrr)rr%Zblocksr]rr^�textr0rrr�_handle_message_delivery_statusGs
z)Generator._handle_message_delivery_statuscCs^|��}|�|�}|j}t|t�rD|j|�d�d|jd�|��}n
|�	|�}|j
�|�dS)NrFrV)r,rrRrNrWr'rMrr<rrr)rr%rr^rTrrr�_handle_message\s




zGenerator._handle_messagecCsvt�tj�}dt|d}|dkr(|S|}d}|�dt�|�dtj�}|�	|�sXqr|dt
|�}|d7}q0|S)Nz===============z==rz^--z(--)?$�.r6)�randomZ	randrange�sys�maxsize�_fmt�_compile_re�re�escape�	MULTILINE�searchrO)�clsrc�tokenr_�bZcounterZcrerrrrYus

zGenerator._make_boundarycCst�||�Sr)rl�compile�rpr�flagsrrrrk�szGenerator._compile_re)NN)FN)N)�__name__�
__module__�__qualname__rrr'rr,rr2r$r9r7rUrDr`rbrdre�classmethodrYrkrrrrrs,
� 
1'
:csLeZdZdd�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�Nrz)r|rrrrr�szBytesGenerator._encodecCs8|��D]\}}|j�|j�||��q|�|j�dSr)rGrrrZfold_binaryrrHrrrr7�szBytesGenerator._write_headerscs\|jdkrdSt|j�rH|jjdksH|jr:t�d|j�|_|�|j�ntt	|��
|�dS)NZ7bitrL)rRrrZcte_typerrSrFr2�superrrU)rr%�r)rrrU�s
zBytesGenerator._handle_textcCst�|�d�|�Sr})rlrsr|rtrrrrk�szBytesGenerator._compile_re)rvrwrxrr,rr7rUrDryrk�
__classcell__rrrrr�s

zD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s$eZdZddd�dd�Zdd�ZdS)rNrcCs.tj|||||d�|dkr$t|_n||_dSr()rr�_FMTrj)rrr
rZfmtrrrrr�s�zDecodedGenerator.__init__cCs�|��D]v}|��}|dkr2t|jdd�|d�q|dkr<qt|j|��|��|��|�d�|�dd�|�d	d
�d�|d�qdS)NrcF)�decode)�fileZ	multipartz
[no filename]zContent-Descriptionz[no description]r4z
[no encoding])rQ�maintypeZsubtype�filenameZdescription�encoding)	�walkr?�printrMrjZget_content_typer@�get_filenamer:)rr%r]r�rrrr9�s(���	�zDecodedGenerator._dispatch)NNN)rvrwrxrr9rrrrr�s�r6z%%0%dd)�__all__rlrhr"rg�copyr�iorrZemail.utilsrrA�NLrsr.rnrSrrr�r�len�reprriZ_widthrjrYrrrr�<module>s(

t3;