Your IP : 18.188.245.152


Current Path : /opt/alt/python35/lib64/python3.5/email/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/email/__pycache__/charset.cpython-35.opt-2.pyc



���]�B�0@s�ddddgZddlmZddlZddlZddlmZddlmZd	Z	d
Z
dZdZd
Z
dZdZde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfde	e	dfd
dEde
e
dfde
e
dfde
ddfd e
ddfde
ddfd!e
e
dfd"ee
d"fiZd#dd$dd%dd&dd'dd(dd)dd*dd+dd,dd-dd.dd/dd0dd1dd2dd3dd4dd5dd6dd7d8d9dd:d;d<d
iZdd=dd>d
diZdddd?d�Zd@d�ZdAd�ZdBdC�ZGdDd�d�ZdS)F�Charset�	add_alias�add_charset�	add_codec�)�partialN)�errors)�encode_7or8bit����zus-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�big5�gb2312zeuc-jpziso-2022-jp�	shift_jiszkoi8-rzutf-8�latin_1zlatin-1Zlatin_2zlatin-2Zlatin_3zlatin-3Zlatin_4zlatin-4Zlatin_5zlatin-5Zlatin_6zlatin-6Zlatin_7zlatin-7Zlatin_8zlatin-8Zlatin_9zlatin-9Zlatin_10zlatin-10�cp949zks_c_5601-1987�euc_jp�euc_krzeuc-kr�ascii�eucgb2312_cn�big5_twcCs/|tkrtd��|||ft|<dS)Nz!SHORTEST not allowed for body_enc)�SHORTEST�
ValueError�CHARSETS)�charsetZ
header_encZbody_enc�output_charset�r�,/opt/alt/python35/lib64/python3.5/charset.pyrmscCs|t|<dS)N)�ALIASES)�aliasZ	canonicalrrrr�scCs|t|<dS)N)�	CODEC_MAP)rZ	codecnamerrrr�scCs-|tkr|jdd�S|j|�SdS)Nr�surrogateescape)�UNKNOWN8BIT�encode)�string�codecrrr�_encode�sr'c@s�eZdZedd�Zdd�ZeZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)rc
Csy2t|t�r"|jd�nt|d�}Wn!tk
rUtj|��YnX|j�}tj||�|_	t
j|j	ttdf�\}}}|s�|j	}||_
||_tj||�|_tj|j	|j	�|_tj|j|j�|_dS)Nr)�
isinstance�strr$�UnicodeErrorrZCharsetError�lowerr�get�
input_charsetrr�BASE64�header_encoding�
body_encodingrr!Zinput_codec�output_codec)�selfr-ZhencZbenc�convrrr�__init__�s&
			zCharset.__init__cCs
|jj�S)N)r-r+)r2rrr�__str__�szCharset.__str__cCst|�t|�j�kS)N)r)r+)r2�otherrrr�__eq__�szCharset.__eq__cCs.|jtkrdS|jtkr&dStSdS)Nzquoted-printable�base64)r0�QPr.r)r2rrr�get_body_encoding�s
zCharset.get_body_encodingcCs|jp|jS)N)rr-)r2rrr�get_output_charsetszCharset.get_output_charsetcCsM|jpd}t||�}|j|�}|dkr=|S|j||�S)Nzus-ascii)r1r'�_get_encoder�
header_encode)r2r%r&�header_bytes�encoder_modulerrrr=szCharset.header_encodecCs�|jpd}t||�}|j|�}t|jd|�}|j�}t|�t}g}	g}
t|�|}x�|D]�}|
j	|�t
j|
�}
|jt|
|��}||kr�|
j
�|	r�|
r�|	j	d�nC|	r�dnd}t
j|
�}t||�}|	j	||��|g}
t|�|}q�Wt
j|
�}t||�}|	j	||��|	S)Nzus-asciir� r
)r1r'r<rr=r;�len�RFC2047_CHROME_LEN�next�append�EMPTYSTRING�join�
header_length�pop)r2r%Z
maxlengthsr&r>r?�encoderr�extra�linesZcurrent_line�maxlen�	characterZ	this_line�lengthZ	separatorZjoined_linerrr�header_encode_lines,s6


	zCharset.header_encode_linescCs�|jtkrtjS|jtkr,tjS|jtkr|tjj|�}tjj|�}||krrtjStjSndSdS)N)r/r.�email�
base64mimer9�
quoprimimerrG)r2r>Zlen64Zlenqprrrr<js
zCharset._get_encodercCs�|s
|S|jtkrJt|t�r:|j|j�}tjj|�S|jt	kr�t|t�rz|j|j�}|j
d�}tjj|�St|t�r�|j|j�j
d�}|SdS)N�latin1r)r0r.r(r)r$rrPrQ�body_encoder9�decoderR)r2r%rrrrTys	zCharset.body_encodeN)�__name__�
__module__�__qualname__�DEFAULT_CHARSETr4r5�__repr__r7r:r;r=rOr<rTrrrrr�s,!>)NNN)�__all__�	functoolsrZemail.base64mimerPZemail.quoprimimerZemail.encodersrr9r.rrBrYr#rErrr!rrrr'rrrrr�<module>s�		


?>