AlkantarClanX12

Your IP : 3.135.247.17


Current Path : /usr/lib64/python3.6/email/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/email/__pycache__/generator.cpython-36.opt-2.pyc

3

��f�P�@s�dddgZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZddlm
Z
d	Zd
Zejd�Zejdej�Zejd
�ZGdd�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|dkr|dkrdn|j}||_||_||_||_dS)NT)�mangle_from_�_fp�
_mangle_from_�maxheaderlenr)�self�outfpr
rr�r�'/usr/lib64/python3.6/email/generator.py�__init__&szGenerator.__init__cCs|jj|�dS)N)r�write)r�srrrrFszGenerator.writeFcCs�|jdkr|jn|j}|dk	r*|j|d�}|jdk	rB|j|jd�}|j|_|j|j�|_d|_|j|j�|_|j}|j}zL||_||_|r�|j	�}|s�dt
jt
j
��}|j||j�|j
|�Wd||_||_XdS)N)�linesep)�max_line_length�zFrom nobody )r�clonerr�_NL�_encode�_encoded_NLZ_EMPTY�_encoded_EMPTYZget_unixfrom�timeZctimer�_write)r�msg�unixfromrrZold_gen_policyZold_msg_policyZufromrrr�flattenJs,
zGenerator.flattencCs|j||jd|jd�S)N)r)�	__class__rr)r�fprrrr{szGenerator.clonecCst�S)N)r)rrrr�_new_buffer�szGenerator._new_buffercCs|S)Nr)rrrrrr�szGenerator._encodecCsX|sdStj|�}x*|dd�D]}|j|�|j|j�q W|drT|j|d�dS)N����r)r))�NLCRE�splitrr)r�lines�linerrr�_write_lines�s

zGenerator._write_linescCs�|j}z"d|_|j�|_}|j|�Wd||_|j}|`X|rht|�}|jd|d�|jd|d�t|dd�}|dkr�|j|�n||�|jj|j	��dS)Nzcontent-transfer-encodingrzcontent-typer(�_write_headers)
r�
_munge_cter'�	_dispatchrZreplace_header�getattrr/r�getvalue)rr"ZoldfpZsfpZ	munge_cte�methrrrr!�s"zGenerator._writecCst|j�}|j�}tj||f�jdd�}t|d|d�}|dkrh|jdd�}t|d|d�}|dkrh|j}||�dS)N�-r
Z_handle_)�get_content_maintype�get_content_subtype�
UNDERSCORE�join�replacer2�
_writeBody)rr"�main�subZspecificr4Zgenericrrrr1�szGenerator._dispatchcCs�x�|j�D]�\}}|jj||�}|jjr�|jj}|j|jj�sRtd|�d|����|}|j|�rr|dt|��}tj	|�r�td|����|j
|�q
W|j
|j�dS)Nz folded header does not end with z: z folded header contains newline: )�	raw_itemsrZfoldZverify_generated_headersr�endswithr	�len�NEWLINE_WITHOUT_FWSP�searchrr)rr"�h�vZfoldedrZfolded_no_lineseprrrr/�s

zGenerator._write_headerscCs�|j�}|dkrdSt|t�s.tdt|���t|j�r~|jd�}|dk	r~t|�}|d=|j	||�|j�}|d|df|_
|jr�tj
d|�}|j|�dS)Nzstring payload expected: %s�charsetzcontent-transfer-encodingzcontent-typez>From )�get_payload�
isinstance�str�	TypeError�typer�_payloadZ	get_paramrZset_payloadr0r�fcrer=r.)rr"�payloadrErrr�_handle_text�s"


zGenerator._handle_textcCs�g}|j�}|dkrg}n(t|t�r2|j|�dSt|t�sB|g}x>|D]6}|j�}|j|�}|j|d|jd�|j	|j
��qHW|j�}|s�|jj
|�}|j|�}|j|�|jdk	r�|jr�tjd|j�}	n|j}	|j|	�|j|j�|jd||j�|�r|jj|jd��x4|D],}
|j|jd||j�|jj|
��qW|j|jd|d|j�|jdk	�r�|j�r�tjd|j�}n|j}|j|�dS)NF)r#rz>From z--r)rFrGrHr�listr'rr$r�appendr3Zget_boundaryrr9�_make_boundaryZset_boundary�preamblerrLr=r.r�pop�epilogue)rr"ZmsgtextsZsubparts�partr�g�boundaryZalltextrRZ	body_partrTrrr�_handle_multipartsJ









zGenerator._handle_multipartcCs0|j}|jdd�|_z|j|�Wd||_XdS)Nr)r)rrrX)rr"�prrr�_handle_multipart_signedFs
z"Generator._handle_multipart_signedcCs�g}x�|j�D]t}|j�}|j|�}|j|d|jd�|j�}|j|j�}|rx|d|jkrx|j	|jj
|dd���q|j	|�qW|jj|jj
|��dS)NF)r#rr(r)r))
rFr'rr$rr3r+rrrPr9rr)rr"ZblocksrUrrV�textr,rrr�_handle_message_delivery_statusQs
z)Generator._handle_message_delivery_statuscCs^|j�}|j|�}|j}t|t�rD|j|jd�d|jd�|j�}n
|j	|�}|j
j|�dS)NrF)r#r)r'rrKrGrOr$rFrr3rrr)rr"rrVrMrrr�_handle_messagefs




zGenerator._handle_messagecCsztjtj�}d	t|d}|dkr(|S|}d}xD|jdtj|�dtj�}|j	|�sZP|dt
|�}|d7}q2W|S)
N�=�z==rz^--z(--)?$�.r(z===============)�randomZ	randrange�sys�maxsize�_fmt�_compile_re�re�escape�	MULTILINErBrH)�clsr[�tokenrW�bZcounterZcrerrrrQs
zGenerator._make_boundarycCstj||�S)N)rf�compile)rir�flagsrrrre�szGenerator._compile_re)NN)FN)N)�__name__�
__module__�__qualname__rrr$rr'rr.r!r1r/rNr;rXrZr\r]�classmethodrQrerrrrrs(

1#:csLeZdZdd�Zdd�Zdd�Zdd�Z�fd	d
�ZeZe	dd��Z
�ZS)
rcCs|jj|jdd��dS)N�ascii�surrogateescape)rr�encode)rrrrrr�szBytesGenerator.writecCst�S)N)r)rrrrr'�szBytesGenerator._new_buffercCs
|jd�S)Nrr)rt)rrrrrr�szBytesGenerator._encodecCs<x*|j�D]\}}|jj|jj||��q
W|j|j�dS)N)r>rrrZfold_binaryr)rr"rCrDrrrr/�szBytesGenerator._write_headerscs^|jdkrdSt|j�rJ|jjdkrJ|jr<tjd|j�|_|j|j�ntt	|�j
|�dS)NZ7bitz>From )rKrrZcte_typerrLr=r.�superrrN)rr")r%rrrN�s
zBytesGenerator._handle_textcCstj|jd�|�S)Nrr)rfrlrt)rirrmrrrre�szBytesGenerator._compile_re)rnrorprr'rr/rNr;rqre�
__classcell__rr)r%rr�s

zD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s$eZdZddd�dd�Zdd�ZdS)rN)rcCs.tj|||||d�|dkr$t|_n||_dS)N)r)rr�_FMTrd)rrr
rZfmtrrrrr�s
zDecodedGenerator.__init__cCs�x�|j�D]v}|j�}|dkr4t|jdd�|d�q
|dkr>q
t|j|j�|j�|j�|jd�|jdd�|jd	d
�d�|d�q
WdS)Nr[F)�decode)�fileZ	multipartz
[no filename]zContent-Descriptionz[no description]zContent-Transfer-Encodingz
[no encoding])rJ�maintype�subtype�filenameZdescription�encoding)	�walkr6�printrFrdZget_content_typer7�get_filename�get)rr"rUrzrrrr1�s 
zDecodedGenerator._dispatch)NNN)rnrorprr1rrrrr�sr(z%%0%dd)�__all__rfrbr ra�copyr�iorrZemail.utilsrZemail.errorsr	r8�NLrlr*rhrLrArrrwrr@�reprrcZ_widthrdrQrrrr�<module>s,


|3;