Your IP : 3.133.147.193


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

o

6��f�B�	@s�gd�ZddlmZddlZddlZddlmZddlmZdZ	dZ
dZd	Zd
Z
dZdZid
e	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�d
d�de
e
df�de
e
df�de
ddf�de
ddf�e
ddfe
e
dfee
dfd ��Zid!d
�d"d
�d#d�d$d�d%d�d&d�d'd�d(d�d)d�d*d�d+d�d,d�d-d�d.d�d/d�d0d�d1d�dddd2dd3d
d4��Zd5d6dd7�Zdd8d9�Zd:d;�Zd<d=�Zd>d?�ZGd@dA�dA�ZdS)B)�Charset�	add_alias�add_charset�	add_codec�)�partialN)�errors)�encode_7or8bit�����us-asciizunknown-8bit�z
iso-8859-1z
iso-8859-2z
iso-8859-3z
iso-8859-4z
iso-8859-9ziso-8859-10ziso-8859-13ziso-8859-14ziso-8859-15ziso-8859-16zwindows-1252Zviscii)NNN�big5�gb2312zeuc-jp�iso-2022-jp�	shift_jis�utf-8)rzkoi8-rr�latin_1zlatin-1Zlatin_2zlatin-2Zlatin_3zlatin-3Zlatin_4zlatin-4Zlatin_5zlatin-5Zlatin_6zlatin-6Zlatin_7zlatin-7Zlatin_8zlatin-8Zlatin_9zks_c_5601-1987zeuc-kr)zlatin-9Zlatin_10zlatin-10�cp949�euc_jp�euc_kr�ascii�eucgb2312_cn�big5_tw)rrr
cCs$	|tkr	td��|||ft|<dS)Nz!SHORTEST not allowed for body_enc)�SHORTEST�
ValueError�CHARSETS)�charsetZ
header_encZbody_enc�output_charset�r �4/opt/alt/python310/lib64/python3.10/email/charset.pyrmsrcC�	|t|<dS�N)�ALIASES)�aliasZ	canonicalr r r!r��rcCr"r#)�	CODEC_MAP)rZ	codecnamer r r!r�srcCs|tkr
|�dd�S|�|�S)Nr�surrogateescape)�UNKNOWN8BIT�encode)�string�codecr r r!�_encode�s
r-c@sZeZdZ	efdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�ZdS)rcCs�zt|t�r|�d�nt|d�}Wntyt�|��w|��}t�||�|_	t
�|j	ttdf�\}}}|s<|j	}||_
||_t�||�|_t�|j	|j	�|_t�|j|j�|_dS)Nr)�
isinstance�strr*�UnicodeErrorrZCharsetError�lowerr$�get�
input_charsetrr�BASE64�header_encoding�
body_encodingrr'Zinput_codec�output_codec)�selfr3ZhencZbencZconvr r r!�__init__�s0

�
�
��
�zCharset.__init__cCs
|j��Sr#)r3r1�r8r r r!�__repr__�s
zCharset.__repr__cCst|�t|���kSr#)r/r1)r8�otherr r r!�__eq__�szCharset.__eq__cCs"	|jtkrdS|jtkrdStS)Nzquoted-printable�base64)r6�QPr4rr:r r r!�get_body_encoding�s


zCharset.get_body_encodingcCs	|jp|jSr#)rr3r:r r r!�get_output_charsetr&zCharset.get_output_charsetcCs8	|jpd}t||�}|�|�}|dur|S|�||�S)Nr
)r7r-�_get_encoder�
header_encode)r8r+r,�header_bytes�encoder_moduler r r!rCs



zCharset.header_encodecCs	|jpd}t||�}|�|�}t|j|d�}|��}t|�t}g}	g}
t|�|}|D]F}|
�	|�t
�|
�}
|�t|
|��}||krs|
�
�|	sS|
sS|	�	d�n|	rWdnd}t
�|
�}t||�}|	�	||��|g}
t|�|}q-t
�|
�}t||�}|	�	||��|	S)Nr
)r� r)r7r-rBrrCrA�len�RFC2047_CHROME_LEN�next�append�EMPTYSTRING�join�
header_length�pop)r8r+Z
maxlengthsr,rDrE�encoderrZextra�linesZcurrent_line�maxlen�	characterZ	this_lineZlengthZ	separatorZjoined_liner r r!�header_encode_lines*s:






�

zCharset.header_encode_linescCsZ|jtkrtjS|jtkrtjS|jtkr+tj�|�}tj�|�}||kr(tjStjSdSr#)r5r4�email�
base64mimer?�
quoprimimerrM)r8rDZlen64Zlenqpr r r!rBhs


zCharset._get_encodercCs�	|s|S|jturt|t�r|�|j�}tj�|�S|jt	ur6t|t�r+|�|j�}|�
d�}tj�|�St|t�rD|�|j��
d�}|S)N�latin1r)r6r4r.r/r*rrTrU�body_encoder?�decoderV)r8r+r r r!rXws





zCharset.body_encodeN)
�__name__�
__module__�__qualname__�DEFAULT_CHARSETr9r;r=r@rArCrSrBrXr r r r!r�s+!>r)�__all__�	functoolsrZemail.base64mimerTZemail.quoprimimerZemail.encodersrr?r4rrHr]r)rKrr$r'rrrr-rr r r r!�<module>s�
�
�
�
�

�
�

�
�
�
�
�
��
�
�
�
����������	�
���
�������
	


?>