Mini Shell

Direktori : /opt/cppython/lib/python3.8/email/__pycache__/
Upload File :
Current File : //opt/cppython/lib/python3.8/email/__pycache__/contentmanager.cpython-38.pyc

U

��eg�)�@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�3/opt/cppython/lib/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��mprr	�
<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$
�
��rFcCsx|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�dispositionrG�cid�paramsr�valuerrr	�
_finalize_setps�rNcCsVg}|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rZcs�|�|���}|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)NrQcs��|��Sr�r!��lines��lineseprr	�
embedded_body��z#_encode_text.<locals>.embedded_bodycSsd�|�dS)N�
r[r\rrr	�normal_body�raz!_encode_text.<locals>.normal_bodycss|]}t|�VqdSr)rS)r9�xrrr	�	<genexpr>�sz_encode_text.<locals>.<genexpr>r)�default�7bit�8bit�surrogateescape�
zlatin-1�base64�quoted-printablez$Unknown content transfer encoding {})�encode�
splitlinesr_�maxrXr)�UnicodeDecodeErrorZcte_typerZbody_encoderUrVrSrZrArB)�stringr*�cter>r]r`rcZsniffZsniff_qpZsniff_base64rWrr^r	�_encode_text�sD
�



�
rs�plain�utf-8c
Csdt|d||	�t||||j�\}}
|�|
�|jdtjj�||�dd�||d<t	|||||�dS)Nr/r*T)r'�Content-Transfer-Encoding)
rFrsr>�set_payloadrHr@r*ZALIASES�getrN)rrqrCr*rrrJrGrKrLrD�payloadrrr	�set_text_content�s
�rz�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 objectsr{)Nrgrh�binaryz*message/rfc822 parts do not support cte={}rhz
external-body)Nrgz1message/external-body parts do not support cte={}rgr7rv)rArBrFrwrN)	rr7rCrrrJrGrKrLrDrrr	�set_message_content�s(��r~rkc

Cs�t||||	�|dkr(t||jjd�}nN|dkrNtj|dddd�}|�d�}n(|dkrb|�d�n|d	krv|�dd
�}|�|�||d<t	|||||�dS)Nrk)rXrlFT)�istextr:Z	quotetabsrQrg)rhr}rirv)
rFrZr>rXrUZb2a_qpr)rmrwrN)
rrWrrCrrrJrGrKrLrDrrr	�set_bytes_content�s
r�)r')rtruNNNNNN)r{NNNNNN)rkNNNNN)rUZ
email.charsetr@Z
email.messageZemail.errorsrrZraw_data_managerr.r
r2�splitrr4rCr6rFrNrZrsrzr�strr~r7ZMessager�r5�	bytearray�
memoryviewr#rrrr	�<module>s^6
�	'�
�
�


Zerion Mini Shell 1.0