AlkantarClanX12

Your IP : 3.16.76.102


Current Path : /lib64/python3.6/email/__pycache__/
Upload File :
Current File : //lib64/python3.6/email/__pycache__/contentmanager.cpython-36.pyc

3


 \�)�@s:ddlZddlZddlZddlZddlmZGdd�d�Ze�Zd%dd�Zej	de�d	d
�Z
xdj�D]Zej	ee
�qhWdd
�Z
x dj�D]Zej	dee
�q�Wdd�Zej	de�dd�Zdd�Zdd�Zdd�Zd&dd�Zejee�d'd d!�Zejejje�d(d#d$�Zx eeefD]Zejee��q WdS))�N)�
quoprimimec@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ContentManagercCsi|_i|_dS)N)�get_handlers�set_handlers)�self�r�,/usr/lib64/python3.6/email/contentmanager.py�__init__	szContentManager.__init__cCs||j|<dS)N)r)r�key�handlerrrr�add_get_handler
szContentManager.add_get_handlercOs||j�}||jkr(|j||f|�|�S|j�}||jkrP|j||f|�|�Sd|jkrp|jd|f|�|�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_handlercOs>|j�dkrtd��|j||�}|j�|||f|�|�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]�}||jkr(|j|S|j}t|dd�}|rLdj||f�n|}|dkr\|}||jkrp|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�replacecCs&|jdd�}|jdd�}|j||d�S)NT)�decode�charset�ASCII)�errors)�get_payloadZ	get_paramr')rr*Zcontentr(rrr�get_text_content@sr,�textcCs|jdd�S)NT)r')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�s<|j��fdd�|D�}y,x&|D]}|jrX|jd�|||j<qDWWn@tjjk
r�}z tdj	|j
|jd���|�WYdd}~XnXdS)	N�/zContent-Typerr%csg|]}�j�j|g���qSr)Zheader_factoryZheader_source_parse)�.0�header)�mprr�
<listcomp>dsz _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	r$||d<|dk	r>|jd|ddd�|dk	rN||d<|dk	rxx |j�D]\}}|j||�q`WdS)NZ
attachmentzContent-Disposition�filenameT)r5r&z
Content-ID)�	set_param�items)r�dispositionrA�cid�paramsr
�valuerrr�
_finalize_setpsrHcCsZg}|dd}x>tdt|�|�D]*}||||�}|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�}|dkr�yd||�jd�fStk
r\YnX|jdkr�tdd	�|D��|jkr�d||�jdd
�fS||dd��}tj	|jd�|j�}t
j|�}	t|�t|	�kr�d
}nd}t|�dkr�||fS|dk�r
||�jd�}
nj|dk�r&||�jdd
�}
nN|dk�rJtj	||�jd�|j�}
n*|d
k�rft
||�|j�}
ntdj|���||
fS)NrKcs�j|��S)N)r )�lines)�lineseprr�
embedded_body�sz#_encode_text.<locals>.embedded_bodycSsdj|�dS)N�
)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(�cter8rUrWrYZsniffZsniff_qpZsniff_base64rQr)rVr�_encode_text�s@






rg�plain�utf-8c
Csdt|d||	�t||||j�\}}
|j|
�|jdtjjj||�dd�||d<t	|||||�dS)Nr-r(T)r&zContent-Transfer-Encoding)
r@rgr8�set_payloadrBr:r(ZALIASES�getrH)rrer=r(rfrDrArErFr>Zpayloadrrr�set_text_content�s
rl�rfc822c		Cs�|dkrtd��|dkr@|dkr.tdj|���|dkr:dn|}n0|dkrd|d
kr^td	j|���d}n|dkrpd}t|d
||�|j|g�||d<t|||||�dS)N�partialz4message/partial is not supported for Message objectsrmrZr[�binaryz*message/rfc822 parts do not support cte={}z
external-bodyz1message/external-body parts do not support cte={}r2zContent-Transfer-Encoding)NrZr[ro)NrZ)r;r<r@rjrH)	rr2r=rfrDrArErFr>rrr�set_message_content�s$rpr`c

Cs�t||||	�|dkr(t||jjd�}nN|dkrNtj|dddd�}|jd�}n(|dkrb|jd�n|d
krv|jdd�}|j|�||d<t	|||||�dS)Nr`)rRzquoted-printableFT)�istextr5Z	quotetabsrKrZr[ror^zContent-Transfer-Encoding)r[ro)
r@rTr8rRrOZb2a_qpr'rarjrH)
rrQrr=rfrDrArErFr>rrr�set_bytes_content�s
rr)r&)rhriNNNNNN)rmNNNNNN)r`NNNNN)rOZ
email.charsetr:Z
email.messageZemail.errorsrrZraw_data_managerr,rr.�splitrr/r=r1r@rHrTrgrlr�strrpr2ZMessagerrr0�	bytearray�
memoryviewr"rrrr�<module>sD6
	'