Your IP : 3.139.79.187


Current Path : /opt/alt/python39/lib64/python3.9/email/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/email/__pycache__/charset.cpython-39.opt-2.pyc

a

R�f�B�@sngd�ZddlmZddlZddlZddlmZddlmZdZ	dZ
dZd	Zd
Z
dZdZe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfe	e	dfd
e
e
dfe
e
dfe
ddfe
ddfe
ddfe
e
dfee
dfd�Zdddddddddddddddddddddddd
d�Zdd dd!�Zd,d"d#�Zd$d%�Zd&d'�Zd(d)�ZGd*d+�d+�ZdS)-)�Charset�	add_alias�add_charset�	add_codec�)�partialN)�errors)�encode_7or8bit�����us-asciizunknown-8bit�)NNN�iso-2022-jp�utf-8)�
iso-8859-1�
iso-8859-2�
iso-8859-3�
iso-8859-4�
iso-8859-9�iso-8859-10�iso-8859-13�iso-8859-14�iso-8859-15�iso-8859-16zwindows-1252Zvisciir
�big5�gb2312�euc-jp�	shift_jisrzkoi8-rrrrrrrrrrrrzks_c_5601-1987rzeuc-kr)�latin_1zlatin-1Zlatin_2zlatin-2Zlatin_3zlatin-3Zlatin_4zlatin-4Zlatin_5zlatin-5Zlatin_6zlatin-6Zlatin_7zlatin-7Zlatin_8zlatin-8Zlatin_9zlatin-9Zlatin_10zlatin-10�cp949�euc_jp�euc_kr�ascii�eucgb2312_cn�big5_tw)rrr
cCs"|tkrtd��|||ft|<dS)Nz!SHORTEST not allowed for body_enc)�SHORTEST�
ValueError�CHARSETS)�charsetZ
header_encZbody_enc�output_charset�r+�2/opt/alt/python39/lib64/python3.9/email/charset.pyrmsrcCs|t|<dS�N)�ALIASES)�aliasZ	canonicalr+r+r,r�srcCs|t|<dSr-)�	CODEC_MAP)r)Z	codecnamer+r+r,r�srcCs"|tkr|�dd�S|�|�SdS)Nr#�surrogateescape)�UNKNOWN8BIT�encode)�string�codecr+r+r,�_encode�sr6c@sXeZdZefdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)rcCs�z$t|t�r|�d�n
t|d�}Wnty@t�|��Yn0|��}t�||�|_	t
�|j	ttdf�\}}}|s||j	}||_
||_t�||�|_t�|j	|j	�|_t�|j|j�|_dS)Nr#)�
isinstance�strr3�UnicodeErrorrZCharsetError�lowerr.�get�
input_charsetr(r&�BASE64�header_encoding�
body_encodingr*r0Zinput_codec�output_codec)�selfr<ZhencZbencZconvr+r+r,�__init__�s,
�
��zCharset.__init__cCs
|j��Sr-)r<r:�rAr+r+r,�__repr__�szCharset.__repr__cCst|�t|���kSr-)r8r:)rA�otherr+r+r,�__eq__�szCharset.__eq__cCs$|jtkrdS|jtkrdStSdS)Nzquoted-printable�base64)r?�QPr=rrCr+r+r,�get_body_encoding�s


zCharset.get_body_encodingcCs|jp
|jSr-)r*r<rCr+r+r,�get_output_charsetszCharset.get_output_charsetcCs6|jpd}t||�}|�|�}|dur*|S|�||�S)Nr
)r@r6�_get_encoder�
header_encode)rAr4r5�header_bytes�encoder_moduler+r+r,rLs


zCharset.header_encodecCs|jpd}t||�}|�|�}t|j|d�}|��}t|�t}g}	g}
t|�|}|D]�}|
�	|�t
�|
�}
|�t|
|��}||krX|
�
�|	s�|
s�|	�	d�n.|	r�dnd}t
�|
�}t||�}|	�	||��|g}
t|�|}qXt
�|
�}t||�}|	�	||��|	S)Nr
)r)� r)r@r6rKrrLrJ�len�RFC2047_CHROME_LEN�next�append�EMPTYSTRING�join�
header_length�pop)rAr4Z
maxlengthsr5rMrN�encoderr)Zextra�linesZcurrent_line�maxlen�	characterZ	this_lineZlengthZ	separatorZjoined_liner+r+r,�header_encode_lines*s6








zCharset.header_encode_linescCs`|jtkrtjS|jtkr tjS|jtkrXtj�|�}tj�|�}||krPtjStjSndSdSr-)r>r=�email�
base64mimerH�
quoprimimer&rV)rArMZlen64Zlenqpr+r+r,rKhs


zCharset._get_encodercCs�|s|S|jtur4t|t�r(|�|j�}tj�|�S|jt	urjt|t�rT|�|j�}|�
d�}tj�|�St|t�r�|�|j��
d�}|SdS)N�latin1r#)r?r=r7r8r3r*r]r^�body_encoderH�decoder_)rAr4r+r+r,raws	





zCharset.body_encodeN)
�__name__�
__module__�__qualname__�DEFAULT_CHARSETrBrDrFrIrJrLr\rKrar+r+r+r,r�s,!>r)NNN)�__all__�	functoolsrZemail.base64mimer]Zemail.quoprimimerZemail.encodersrrHr=r&rQrfr2rTr(r.r0rrrr6rr+r+r+r,�<module>s�� ��
	


?>