Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/encodings/idna.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@sddlZddlZddlZddlmZejd�ZdZeed�Z	d�Z
d�Zd�Zd	ej
fd
��YZ
dejfd��YZd
ejfd��YZde
ejfd��YZde
ejfd��YZd�ZdS(i�N(t	ucd_3_2_0u[.。.。]sxn--tasciicCs�g}x9|D]1}tj|�r(q
n|jtj|��q
Wdj|�}tjd|�}x�|D]�}tj|�s�j|�s�j	|�s�j
|�s�j|�s�j|�s�j
|�s�j|�s�j|�rjtd|��qjqjWttj|�}x]|D]U}|r'ttj|�rTtd��n|dsj|dr|td��q|q'q'W|S(NutNFKCsInvalid character %rsViolation of BIDI requirement 2ii�sViolation of BIDI requirement 3(t
stringpreptin_table_b1tappendtmap_table_b2tjointunicodedatat	normalizetin_table_c12tin_table_c22tin_table_c3tin_table_c4tin_table_c5tin_table_c6tin_table_c7tin_table_c8tin_table_c9tUnicodeErrortmaptin_table_d1tfiltertin_table_d2(tlabeltnewlabeltctRandAL((s$/sys/lib/python2.7/encodings/idna.pytnamepreps4


cCs+y|jd�}Wntk
r&n3Xdt|�koDdknrM|Std��t|�}y|jd�}Wntk
r�n3Xdt|�ko�dknr�|Std��|jt�r�td��n|jd�}t|}dt|�kodknr|Std��dS(NRii@slabel empty or too longsLabel starts with ACE prefixtpunycode(tencodeRtlenRt
startswithtuace_prefixt
ace_prefix(R((s$/sys/lib/python2.7/encodings/idna.pytToASCII>s,
"
"
"cCst|t�rt}n3y|jd�}t}Wntk
rJt}nX|s�t|�}y|jd�}Wq�tk
r�td��q�Xn|jt�s�t	|d�S|t
t�}|jd�}t|�}|j
�|krtd||��n|S(NRsInvalid character in IDN labelRsIDNA does not round-trip(t
isinstancetstrtTrueRRtFalseRR R"tunicodeRtdecodeR#tlower(Rt
pure_asciitlabel1tresulttlabel2((s$/sys/lib/python2.7/encodings/idna.pyt	ToUnicodeis*	




tCodeccBs eZdd�Zdd�ZRS(tstrictcCs�|dkrtd|��n|s)dSg}tj|�}|rjt|d�dkrjd}|d=nd}x!|D]}|jt|��qwWdj|�|t|�fS(NR1sunsupported error handling tii�t.(R2i(RtdotstsplitRRR#R(tselftinputterrorsR-tlabelsttrailing_dotR((s$/sys/lib/python2.7/encodings/idna.pyR�s

cCs�|dkrtd|��n|s)d	St|t�rJtj|�}n(t|�}t|d�|jd�}|r�t|d�dkr�d}|d=nd}g}x!|D]}|jt|��q�Wdj	|�|t|�fS(
NR1sUnsupported error handling uiRR3i�u.(ui(
RR$R(R4R5R%RRR/R(R6R7R8R9R:R-R((s$/sys/lib/python2.7/encodings/idna.pyR)�s"


(t__name__t
__module__RR)(((s$/sys/lib/python2.7/encodings/idna.pyR0�stIncrementalEncodercBseZd�ZRS(c	Cs|dkrtd|��n|s)d	Stj|�}d}|r�|ds^d}|d=q�|s�|d=|r}d}q}q�ng}d}xD|D]<}|jt|��|r�|d7}n|t|�7}q�Wdj|�|}|t|�7}||fS(
NR1sunsupported error handling R2iui�R3i(R2i(RR4R5RR#RR(	R6R7R8tfinalR9R:R-tsizeR((s$/sys/lib/python2.7/encodings/idna.pyt_buffer_encode�s0



(R;R<R@(((s$/sys/lib/python2.7/encodings/idna.pyR=�stIncrementalDecodercBseZd�ZRS(c	Cs:|dkrtd|��n|s)d
St|t�rJtj|�}n(t|�}t|d�|jd�}d}|r�|ds�d}|d=q�|s�|d=|r�d}q�q�ng}d}xD|D]<}|jt|��|r�d	7}n|t|�7}q�Wdj	|�|}|t|�7}||fS(NR1sUnsupported error handling uiRR3i�u.i(ui(
RR$R(R4R5R%RR/RR(	R6R7R8R>R9R:R-R?R((s$/sys/lib/python2.7/encodings/idna.pyt_buffer_decode�s8




(R;R<RB(((s$/sys/lib/python2.7/encodings/idna.pyRA�stStreamWritercBseZRS((R;R<(((s$/sys/lib/python2.7/encodings/idna.pyRCstStreamReadercBseZRS((R;R<(((s$/sys/lib/python2.7/encodings/idna.pyRDscCs@tjdddt�jdt�jdtdtdtdt�S(	NtnametidnaRR)tincrementalencodertincrementaldecodertstreamwritertstreamreader(	tcodecst	CodecInfoR0RR)R=RARCRD(((s$/sys/lib/python2.7/encodings/idna.pytgetregentrys	(RtreRKRRtcompileR4R"R(R!RR#R/R0tBufferedIncrementalEncoderR=tBufferedIncrementalDecoderRARCRDRM(((s$/sys/lib/python2.7/encodings/idna.pyt<module>s$	0	+	)3"(

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].