AlkantarClanX12

Your IP : 18.223.237.218


Current Path : /opt/alt/python35/lib64/python3.5/email/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/email/__pycache__/generator.cpython-35.opt-2.pyc



���]�M�@sdddgZddlZddlZddlZddlZddlmZddlmZm	Z	ddl
mZdZd	Z
ejd
�Zejdej�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@seZdZdddddd�Zdd�Zdddd	�Zd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
e
Zdd�Zdd�Zdd�Zd d!�Zedd"d#��Zed$d%��ZdS)&rN�policycCsO|dkr'|dkrdn|j}||_||_||_||_dS)NT)�mangle_from_�_fp�
_mangle_from_�maxheaderlenr)�self�outfprrr�r�./opt/alt/python35/lib64/python3.5/generator.py�__init__$s			zGenerator.__init__cCs|jj|�dS)N)r
�write)r�srrrrDszGenerator.writeFcCs6|jdkr|jn|j}|dk	r?|jd|�}|jdk	rc|jd|j�}|j|_|j|j�|_d|_|j|j�|_|j}|j}zh||_||_|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�time�ctimer�_write)r�msg�unixfromrrZold_gen_policyZold_msg_policyZufromrrr�flattenHs,!						zGenerator.flattencCs|j||jdd|j�S)Nr)�	__class__rr)r�fprrrrys	zGenerator.clonecCst�S)N)r)rrrr�_new_buffer�szGenerator._new_buffercCs|S)Nr)rrrrrr�szGenerator._encodecCsp|s
dStj|�}x5|dd�D]#}|j|�|j|j�q*W|drl|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|r�t|�}|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._writecCs�|j�}|j�}tj||f�jdd�}t|d|d�}|dkr�|jdd�}t|d|d�}|dkr�|j}||�dS)N�-r	Z_handle_)�get_content_maintype�get_content_subtype�
UNDERSCORE�join�replacer2�
_writeBody)rr"�main�subZspecificr4Zgenericrrrr1�s!	zGenerator._dispatchcCsMx6|j�D](\}}|j|jj||��q
W|j|j�dS)N)�	raw_itemsrrZfoldr)rr"�h�vrrrr/�s zGenerator._write_headerscCs�|j�}|dkrdSt|t�sAtdt|���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"�payloadrArrr�_handle_text�s"	zGenerator._handle_textcCs4g}|j�}|dkr'g}n8t|t�rG|j|�dSt|t�s_|g}xX|D]P}|j�}|j|�}|j|ddd|j�|j	|j
��qfW|j�}|s�|jj
|�}|j|�}|j|�|jdk	rP|jr*tjd|j�}	n	|j}	|j|	�|j|j�|jd||j�|r�|jj|jd��x=|D]5}
|j|jd||j�|jj|
�q�W|j|jd|d|j�|jdk	r0|jrtjd|j�}n	|j}|j|�dS)Nr#Frz>From z--r)rBrCrDr�listr'rr$r�appendr3Zget_boundaryrr9�_make_boundaryZset_boundary�preamblerrHr=r.r
�pop�epilogue)rr"ZmsgtextsZsubparts�partr�g�boundaryZalltextrNZ	body_partrPrrr�_handle_multipart�sJ	
	

		

#		zGenerator._handle_multipartcCs@|j}|jdd�|_z|j|�Wd||_XdS)Nrr)rrrT)rr"�prrr�_handle_multipart_signed8s
	z"Generator._handle_multipart_signedcCs�g}x�|j�D]�}|j�}|j|�}|j|ddd|j�|j�}|j|j�}|r�|d|jkr�|j	|jj
|dd���q|j	|�qW|jj|jj
|��dS)Nr#Frr(r)r))
rBr'rr$rr3r+rrrLr9r
r)rr"ZblocksrQrrR�textr,rrr�_handle_message_delivery_statusCs&z)Generator._handle_message_delivery_statuscCs�|j�}|j|�}|j}t|t�rg|j|jd�ddd|j�|j�}n|j	|�}|j
j|�dS)Nrr#Fr)r'rrGrCrKr$rBrr3rr
r)rr"rrRrIrrr�_handle_messageXs
	%zGenerator._handle_messagecCs�tjtj�}d	t|d}|dkr4|S|}d}xX|jdtj|�dtj�}|j	|�syP|dt
|�}|d7}qCW|S)
N�=�z==rz^--z(--)?$�.r(z===============)�random�	randrange�sys�maxsize�_fmt�_compile_re�re�escape�	MULTILINE�searchrD)�clsrW�tokenrS�bZcounterZcrerrrrMqs&zGenerator._make_boundarycCstj||�S)N)rc�compile)rgr�flagsrrrrb�szGenerator._compile_re)�__name__�
__module__�__qualname__rrr$rr'rr.r!r1r/rJr;rTrVrXrY�classmethodrMrbrrrrrs(
	1#
:csjeZdZdd�Zdd�Zdd�Zdd�Z�fd	d
�ZeZe	dd��Z
�S)
rcCs |jj|jdd��dS)N�ascii�surrogateescape)r
r�encode)rrrrrr�szBytesGenerator.writecCst�S)N)r)rrrrr'�szBytesGenerator._new_buffercCs
|jd�S)Nrp)rr)rrrrrr�szBytesGenerator._encodecCsPx9|j�D]+\}}|jj|jj||��q
W|j|j�dS)N)r>r
rrZfold_binaryr)rr"r?r@rrrr/�s#zBytesGenerator._write_headerscs�|jdkrdSt|j�ri|jjdkri|jrVtjd|j�|_|j|j�ntt	|�j
|�dS)NZ7bitz>From )rGrrZcte_typerrHr=r.�superrrJ)rr")r%rrrJ�s"	zBytesGenerator._handle_textcCstj|jd�|�S)Nrp)rcrjrr)rgrrkrrrrb�szBytesGenerator._compile_re)rlrmrnrr'rr/rJr;rorbrr)r%rr�s

zD[Non-text (%(type)s) part of message omitted, filename %(filename)s]c@s1eZdZddddd�Zdd�ZdS)rN�NcCs;tj||||�|dkr.t|_n	||_dS)N)rr�_FMTra)rrrr�fmtrrrr�szDecodedGenerator.__init__cCs�x�|j�D]�}|j�}|dkrJt|jdd�d|�q
|dkrYq
t|jd|j�d|j�d|j�d	|jd
�d|jdd
�d|jdd�id|�q
WdS)NrW�decodeF�fileZ	multipartrF�maintype�subtype�filenamez
[no filename]�descriptionzContent-Descriptionz[no description]�encodingzContent-Transfer-Encodingz
[no encoding])	�walkr6�printrBraZget_content_typer7�get_filename�get)rr"rQryrrrr1�s 	
zDecodedGenerator._dispatch)rlrmrnrr1rrrrr�sr(z%%0%dd)�__all__rcr_rr]�copyr�iorrZemail.utilsrr8�NLrjr*rerHrrrur�len�reprr`�_widthrarMrrrr�<module>s&�o39