AlkantarClanX12

Your IP : 18.218.2.191


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

U

e5d�)�@s.ddlZddlZddlZddlZddlmZGdd�d�Ze�Zd%dd�Ze�	de�d	d
�Z
d��D]Ze�	ee
�qfdd
�Z
d��D]Ze�	dee
�q�dd�Ze�	de�dd�Zdd�Zdd�Zdd�Zd&dd�Ze�ee�d'd d!�Ze�ejje�d(d#d$�ZeeefD]Ze�ee��qdS))�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.8/email/contentmanager.py�__init__	szContentManager.__init__cCs||j|<dSr)r)r�key�handlerrrr	�add_get_handler
szContentManager.add_get_handlercOs||��}||jkr(|j||f|�|�S|��}||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|<dSr)r)rZtypekeyrrrr	�add_set_handlerszContentManager.add_set_handlercOs>|��dkrtd��|�||�}|��|||f|�|�dS)NZ	multipartz"set_content not valid on multipart)r�	TypeError�_find_set_handlerZ
clear_content)rr�objrrrrrr	�set_contents
zContentManager.set_contentc	Cs�d}t|�jD]�}||jkr*|j|S|j}t|dd�}|rNd�||f�n|}|dkr^|}||jkrv|j|S||jkr�|j|S|j}||jkr|j|Sqd|jkr�|jdSt|��dS)N�
__module__r�.)�type�__mro__r�__qualname__�getattr�join�__name__r)	rrrZfull_path_for_error�typZqname�modname�	full_path�namerrr	r's&





z ContentManager._find_set_handlerN)	r"rrr
r
rrrrrrrr	rs	r�replacecCs&|jdd�}|�dd�}|j||d�S)NT��decode�charset�ASCII)�errors)�get_payloadZ	get_paramr))rr,Zcontentr*rrr	�get_text_content@sr.�textcCs|jdd�S)NTr(�r-�rrrr	�get_non_text_contentGsr2zaudio image video applicationcCs
|�d�S�Nrr0r1rrr	�get_message_contentMsr4zrfc822 external-bodyzmessage/cCst|�d��Sr3)�bytesr-r1rrr	�%get_and_fixup_unknown_message_contentSsr6�messagec
s�d�||f�|d<|r�t|dd�s<|j��fdd�|D�}z(|D]}|jrV|jd�|||j<qBWn@tjjk
r�}ztd�	|j
|jd���|�W5d}~XYnXdS)	N�/zContent-Typerr&csg|]}�j��|g���qSr)Zheader_factoryZheader_source_parse)�.0�header�Zmprr	�
<listcomp>ds�z _prepare_set.<locals>.<listcomp>zInvalid header: {})�policy)r!�hasattrr=Zdefectsr&�emailr,ZHeaderDefect�
ValueError�formatZfold)rr�subtype�headersr:�excrr;r	�_prepare_set_s$
�
��rEcCsx|dkr|dk	rd}|dk	r$||d<|dk	r>|jd|ddd�|dk	rN||d<|dk	rt|��D]\}}|�||�q^dS)NZ
attachmentzContent-Disposition�filenameT)r:r'z
Content-ID)�	set_param�items)r�dispositionrF�cid�paramsr�valuerrr	�
_finalize_setps�rMcCsVg}|dd}tdt|�|�D]*}||||�}|�t�|��d��q d�|�S)N��r�asciir)�range�len�append�binascii�
b2a_base64r)r!)�data�max_line_lengthZ
encoded_linesZunencoded_bytes_per_line�iZthislinerrr	�_encode_base64�srYcs�|�|���}|j�d���fdd�}dd�}|dkr�tdd�|D�dd	�|jkr�zd
||��d�fWStk
rzYnX|jdkr�d||��dd�fS||dd
��}t�	|�d�|j�}t
�|�}	t|�t|	�kr�d}nd}t|�d
kr�||fS|d
k�r||��d�}
nj|dk�r,||��dd�}
nN|dk�rPt�	||��d�|j�}
n*|dk�rlt
||�|j�}
ntd�|���||
fS)NrPcs��|��Sr�r!��lines��lineseprr	�
embedded_body��z#_encode_text.<locals>.embedded_bodycSsd�|�dS)N�
rZr[rrr	�normal_body�r`z!_encode_text.<locals>.normal_bodycss|]}t|�VqdSr)rR)r9�xrrr	�	<genexpr>�sz_encode_text.<locals>.<genexpr>r)�default�7bit�8bit�surrogateescape�
zlatin-1�base64�quoted-printablez$Unknown content transfer encoding {})�encode�
splitlinesr^�maxrWr)�UnicodeDecodeErrorZcte_typerZbody_encoderTrUrRrYr@rA)�stringr*�cter=r\r_rbZsniffZsniff_qpZsniff_base64rVrr]r	�_encode_text�sD
�



�
rr�plain�utf-8c
Csdt|d||	�t||||j�\}}
|�|
�|jdtjj�||�dd�||d<t	|||||�dS)Nr/r*T)r'�Content-Transfer-Encoding)
rErrr=�set_payloadrGr?r*ZALIASES�getrM)rrprBr*rqrIrFrJrKrCZpayloadrrr	�set_text_content�s
�rx�rfc822c		Cs�|dkrtd��|dkr@|dkr.td�|���|dkr:dn|}n0|dkrd|dkr^td	�|���d
}n|dkrpd
}t|d||�|�|g�||d<t|||||�dS)
N�partialz4message/partial is not supported for Message objectsry)Nrfrg�binaryz*message/rfc822 parts do not support cte={}rgz
external-body)Nrfz1message/external-body parts do not support cte={}rfr7ru)r@rArErvrM)	rr7rBrqrIrFrJrKrCrrr	�set_message_content�s(��r|rjc

Cs�t||||	�|dkr(t||jjd�}nN|dkrNtj|dddd�}|�d�}n(|dkrb|�d�n|d	krv|�dd
�}|�|�||d<t	|||||�dS)Nrj)rWrkFT)�istextr:Z	quotetabsrPrf)rgr{rhru)
rErYr=rWrTZb2a_qpr)rlrvrM)
rrVrrBrqrIrFrJrKrCrrr	�set_bytes_content�s
r~)r')rsrtNNNNNN)ryNNNNNN)rjNNNNN)rTZ
email.charsetr?Z
email.messageZemail.errorsrrZraw_data_managerr.r
r2�splitrr4rBr6rErMrYrrrxr�strr|r7ZMessager~r5�	bytearray�
memoryviewr#rrrr	�<module>s^6
�	'�
�
�