AlkantarClanX12

Your IP : 18.117.12.181


Current Path : /opt/alt/python310/lib64/python3.10/email/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/email/__pycache__/contentmanager.cpython-310.opt-1.pyc

o

6��f;)�@s>ddlZddlZddlZddlZddlmZGdd�d�Ze�Zd%dd�Ze�	de�d	d
�Z
d��D]Ze�	ee
�q3dd
�Z
d��D]
Ze�	dee
�qDdd�Ze�	de�dd�Zdd�Zdd�Zdd�Z			d&dd�Ze�ee�			d'd d!�Ze�ejje�	"		d(d#d$�ZeeefD]Ze�ee�q�dS))�N)�
quoprimimec@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�ContentManagercCsi|_i|_dS�N)�get_handlers�set_handlers)�self�r�;/opt/alt/python310/lib64/python3.10/email/contentmanager.py�__init__	s
zContentManager.__init__cC�||j|<dSr)r)r�key�handlerrrr	�add_get_handler
�zContentManager.add_get_handlercOs�|��}||jvr|j||g|�Ri|��S|��}||jvr.|j||g|�Ri|��Sd|jvrA|jd|g|�Ri|��St|��)N�)Zget_content_typer�get_content_maintype�KeyError)r�msg�args�kwZcontent_type�maintyperrr	�get_contents


zContentManager.get_contentcCrr)r)rZtypekeyr
rrr	�add_set_handlerrzContentManager.add_set_handlercOsD|��dkr
td��|�||�}|��|||g|�Ri|��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]O}||jvr|j|S|j}t|dd�}|r'd�||f�n|}|dur/|}||jvr;|j|S||jvrG|j|S|j}||jvrV|j|Sqd|jvra|jdSt|��)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$rr!r
rrrrrrrrr	rs	r�replacecCs&|jdd�}|�dd�}|j||d�S)NT��decode�charset�ASCII)�errors)�get_payloadZ	get_paramr+)rr.Zcontentr,rrr	�get_text_content@sr0�textcCs|jdd�S)NTr*�r/�rrrr	�get_non_text_contentGsr4zaudio image video applicationcCs
|�d�S�Nrr2r3rrr	�get_message_contentMs
r6zrfc822 external-bodyzmessage/cCst|�d��Sr5)�bytesr/r3rrr	�%get_and_fixup_unknown_message_contentSsr8�messagec
s�d�||f�|d<|rOt|dd�s|j��fdd�|D�}z|D]}|jr+|jd�|||j<q!WdStjjyN}z
td�	|j
|jd���|�d}~wwdS)	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,
�
������rGcCs||dur
|dur
d}|dur||d<|dur|jd|ddd�|dur'||d<|dur:|��D]\}}|�||�q/dSdS)NZ
attachmentzContent-Disposition�filenameT)r<r)z
Content-ID)�	set_param�items)r�dispositionrH�cid�paramsr�valuerrr	�
_finalize_setps"��rOcCsVg}|dd}tdt|�|�D]}||||�}|�t�|��d��qd�|�S)N��r�asciir)�range�len�append�binascii�
b2a_base64r+r#)�data�max_line_lengthZ
encoded_linesZunencoded_bytes_per_line�iZthislinerrr	�_encode_base64�s
r[cs�|�|���}|j�d���fdd�}dd�}|durztdd�|D�dd	�|jkrLz
d
||��d�fWSty<Ynw|jdkrLd||��dd�fS||dd
��}t�	|�d�|j�}t
�|�}	t|�t|	�krnd}nd}t|�d
krz||fS|d
kr�||��d�}
||
fS|dkr�||��dd�}
||
fS|dkr�t�	||��d�|j�}
||
fS|dkr�t
||�|j�}
||
fStd�|���)NrRcs��|��Sr�r#��lines��lineseprr	�
embedded_body��z#_encode_text.<locals>.embedded_bodycSsd�|�dS)N�
r\r]rrr	�normal_body�rbz!_encode_text.<locals>.normal_bodycss�|]}t|�VqdSr)rT)r;�xrrr	�	<genexpr>�s�z_encode_text.<locals>.<genexpr>r)�default�7bit�8bit�surrogateescape�
zlatin-1�base64�quoted-printablez$Unknown content transfer encoding {})�encode�
splitlinesr`�maxrYr+�UnicodeDecodeErrorZcte_typerZbody_encoderVrWrTr[rBrC)�stringr,�cter?r^rardZsniffZsniff_qpZsniff_base64rXrr_r	�_encode_text�sL�
�

�����rt�plain�utf-8c
Csdt|d||	�t||||j�\}}
|�|
�|jdtjj�||�dd�||d<t	|||||�dS)Nr1r,T�r)�Content-Transfer-Encoding)
rGrtr?�set_payloadrIrAr,ZALIASES�getrO)rrrrDr,rsrKrHrLrMrEZpayloadrrr	�set_text_content�s
�r{�rfc822c		Cs�|dkrtd��|dkr |dvrtd�|���|durdn|}n|dkr2|dvr/td	�|���d
}n|dur8d
}t|d||�|�|g�||d<t|||||�dS)
N�partialz4message/partial is not supported for Message objectsr|)Nrhri�binaryz*message/rfc822 parts do not support cte={}riz
external-body)Nrhz1message/external-body parts do not support cte={}rhr9rx)rBrCrGryrO)	rr9rDrsrKrHrLrMrErrr	�set_message_content�s(��rrlc

Cs�t||||	�|dkrt||jjd�}n'|dkr'tj|dddd�}|�d�}n|dkr1|�d�}n
|d	vr;|�dd
�}|�|�||d<t|||||�dS)Nrl)rYrmFT)�istextr<Z	quotetabsrRrh)rir~rjrx)	rGr[r?rYrVZb2a_qpr+ryrO)
rrXrrDrsrKrHrLrMrErrr	�set_bytes_content�s
r�rw)rurvNNNNNN)r|NNNNNN)rlNNNNN)rVZ
email.charsetrAZ
email.messageZemail.errorsrrZraw_data_managerr0rr4�splitrr6rDr8rGrOr[rtr{r�strrr9ZMessager�r7�	bytearray�
memoryviewr%rrrr	�<module>sP6
�	'
�
�
��