Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/python35/lib64/python3.5/email/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/python35/lib64/python3.5/email/__pycache__/contentmanager.cpython-35.pyc



��Yf�)�
@s�ddlZddlZddlZddlZddlmZGdd�d�Ze�Zddd�Zej	de�d	d
�Z
x$dj�D]Zej	ee
�q�Wdd
�Z
x(dj�D]Zej	dee
�q�Wdd�Zej	de�dd�Zdd�Zdd�Zdd�Zdddddddddd�Zejee�dddddddd d!�Zejejje�d"dddddd#d$�Zx'eeefD]Zejee�q�WdS)%�N)�
quoprimimec@sXeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ContentManagercCsi|_i|_dS)N)�get_handlers�set_handlers)�self�r�9/opt/alt/python35/lib64/python3.5/email/contentmanager.py�__init__	s	zContentManager.__init__cCs||j|<dS)N)r)r�key�handlerrrr�add_get_handler
szContentManager.add_get_handlercOs�|j�}||jkr2|j||||�S|j�}||jkrd|j||||�Sd|jkr�|jd|||�St|��dS)N�)Zget_content_typer�get_content_maintype�KeyError)r�msg�args�kwZcontent_type�maintyperrr�get_contentszContentManager.get_contentcCs||j|<dS)N)r)rZtypekeyrrrr�add_set_handlerszContentManager.add_set_handlercOsQ|j�dkrtd��|j||�}|j�|||||�dS)NZ	multipartz"set_content not valid on multipart)r�	TypeError�_find_set_handlerZ
clear_content)rr�objrrrrrr�set_contents

zContentManager.set_contentc	Cs	d}x�t|�jD]�}||jkr6|j|S|j}t|dd�}|rldj||f�n|}|dkr�|}||jkr�|j|S||jkr�|j|S|j}||jkr|j|SqWd|jkr�|jdSt|��dS)N�
__module__r
�.)�type�__mro__r�__qualname__�getattr�join�__name__r)	rrrZfull_path_for_error�typZqname�modname�	full_path�namerrrr's&	!	z ContentManager._find_set_handlerN)	r!rrr	rrrrrrrrrrs	r�replacecCs7|jdd�}|jdd�}|j|d|�S)N�decodeT�charset�ASCII�errors)�get_payloadZ	get_paramr')rr*Zcontentr(rrr�get_text_content@sr,�textcCs|jdd�S)Nr'T)r+)rrrr�get_non_text_contentGsr.zaudio image video applicationcCs
|jd�S)Nr)r+)rrrr�get_message_contentMsr/zrfc822 external-bodyzmessage/cCst|jd��S)Nr)�bytesr+)rrrr�%get_and_fixup_unknown_message_contentSsr1�messagecs�dj||f�|d<|r�t|dd�sT|j��fdd�|D�}y8x1|D])}|jrz|jd�|||j<q^WWnRtjjk
r�}z,tdj	|j
d|j���|�WYdd}~XnXdS)	N�/zContent-Typerr%cs+g|]!}�j�j|g���qSr)Zheader_factoryZheader_source_parse)�.0�header)�mprr�
<listcomp>ds	z _prepare_set.<locals>.<listcomp>zInvalid header: {}�policy)r �hasattrr8Zdefectsr%�emailr*ZHeaderDefect�
ValueError�formatZfold)rr�subtype�headersr5�excr)r6r�_prepare_set_s	

	
	r@cCs�|dkr|dk	rd}|dk	r4||d<|dk	r\|jd|dddd�|dk	rr||d<|dk	r�x*|j�D]\}}|j||�q�WdS)NZ
attachmentzContent-Disposition�filenamer5r&Tz
Content-ID)�	set_param�items)r�dispositionrA�cid�paramsr
�valuerrr�
_finalize_setps
	
rHcCswg}|dd}xStdt|�|�D]9}||||�}|jtj|�jd��q-Wdj|�S)N��r�asciir
)�range�len�append�binascii�
b2a_base64r'r )�data�max_line_lengthZ
encoded_linesZunencoded_bytes_per_line�iZthislinerrr�_encode_base64�s#rTcs|j|�j�}|jjd���fdd�}dd�}|dkrVyd||�jd�fSWntk
r�YnX|jdkr�tdd	�|D��|jkr�d||�jdd
�fS||dd��}tj	|jd�|j�}t
j|�}	t|�t|	�kr4d
}n"d}t|�dkrV||fS|dkrz||�jd�}
n�|dkr�||�jdd
�}
no|dkr�tj	||�jd�|j�}
n<|d
kr�t
||�|j�}
ntdj|���||
fS)NrKcs�j|��S)N)r )�lines)�lineseprr�embeded_body�sz"_encode_text.<locals>.embeded_bodycSsdj|�dS)Ns
)r )rUrrr�normal_body�sz!_encode_text.<locals>.normal_body�7bit�8bitcss|]}t|�VqdS)N)rM)r4�xrrr�	<genexpr>�sz_encode_text.<locals>.<genexpr>�surrogateescape�
zlatin-1�base64zquoted-printablez$Unknown content transfer encoding {})�encode�
splitlinesrVr'�UnicodeDecodeErrorZcte_type�maxrRrZbody_encoderOrPrMrTr;r<)�stringr(�cter8rUrWrXZsniffZsniff_qpZsniff_base64rQr)rVr�_encode_text�s@
"	
rfZplainzutf-8c
Cs�t|d||	�t||||j�\}}
|j|
�|jdtjjj||�dd�||d<t	|||||�dS)Nr-r(r&TzContent-Transfer-Encoding)
r@rfr8�set_payloadrBr:r(ZALIASES�getrH)rrdr=r(rerDrArErFr>Zpayloadrrr�set_text_content�s
	
ri�rfc822c		Cs�|dkrtd��|dkr`|dkrEtdj|���|dkrWdn|}nH|dkr�|d
kr�td	j|���d}n|dkr�d}t|d
||�|j|g�||d<t|||||�dS)N�partialz4message/partial is not supported for Message objectsrjrYrZ�binaryz*message/rfc822 parts do not support cte={}z
external-bodyz1message/external-body parts do not support cte={}r2zContent-Transfer-Encoding)NrYrZrl)NrY)r;r<r@rgrH)	rr2r=rerDrArErFr>rrr�set_message_content�s$	
rmr_c

Cs�t||||	�|dkr:t|d|jj�}ny|dkrytj|dddddd�}|jd	�}n:|d
kr�|jd	�n|dkr�|jd	d
�}|j|�||d<t	|||||�dS)Nr_rRzquoted-printable�istextFr5Z	quotetabsTrKrYrZrlr]zContent-Transfer-Encoding)rZrl)
r@rTr8rRrOZb2a_qpr'r`rgrH)
rrQrr=rerDrArErFr>rrr�set_bytes_content�s!

ro)rOZ
email.charsetr:Z
email.messageZemail.errorsrrZraw_data_managerr,rr.�splitrr/r=r1r@rHrTrfrir�strrmr2ZMessageror0�	bytearray�
memoryviewr"rrrr�<module>sD6			'					

Hacked By AnonymousFox1.0, Coded By AnonymousFox