Your IP : 52.15.65.43
3
�Qg�#�@s�ddlZddlZddlZddlmZejd�ZdZdZdd�Z dd �Z
d
d�ZGdd
�d
ej�ZGdd�dej
�ZGdd�dej�ZGdd�deej�ZGdd�deej�Zdd�ZdS)�N)� ucd_3_2_0u[.。.。]sxn--zxn--cCsg}x(|D] }tj|�rq
|jtj|��q
Wdj|�}tjd|�}xr|D]j}tj|�s�tj|�s�tj |�s�tj
|�s�tj|�s�tj|�s�tj
|�s�tj|�s�tj|�rJtd|��qJWdd�|D�}t|��rtdd�|D��r�td��|d p�|d�rtd��|S)
N��NFKCzInvalid character %rcSsg|]}tj|��qS�)�
stringprepZin_table_d1)�.0�xrr�&/usr/lib64/python3.6/encodings/idna.py�
<listcomp>)sznameprep.<locals>.<listcomp>css|]}tj|�VqdS)N)rZin_table_d2)rrrrr � <genexpr>1sznameprep.<locals>.<genexpr>zViolation of BIDI requirement 2r�zViolation of BIDI requirement 3���)rZin_table_b1�appendZmap_table_b2�join�unicodedata� normalizeZin_table_c12Zin_table_c22Zin_table_c3Zin_table_c4Zin_table_c5Zin_table_c6Zin_table_c7Zin_table_c8Zin_table_c9�UnicodeError�any)�labelZnewlabel�cZRandALrrr �namepreps2
rcCs�y|jd�}Wntk
r"Yn*Xdt|�ko:dknrD|Std��t|�}y|jd�}Wntk
rvYn*Xdt|�ko�dknr�|Std��|jt�r�td��|jd�}t|}dt|�ko�dknr�|Std��dS)N�asciir�@zlabel empty or too longzLabel starts with ACE prefix�punycode)�encoder�lenr�
startswith�sace_prefix�
ace_prefix)rrrr �ToASCII<s,
rcCs�t|t�rd}n,y|jd�}d}Wntk
r:d}YnX|stt|�}y|jd�}Wntk
rrtd��YnX|jt�s�t|d�S|tt�d�}|j d�}t
|�}t|d�j�t|d�kr�td||��|S)NTrFzInvalid character in IDN labelrzIDNA does not round-trip)�
isinstance�bytesrrrrr�strr�decoder�lower)rZ
pure_asciiZlabel1�resultZlabel2rrr � ToUnicodegs*
r&c@s eZdZddd�Zddd�ZdS) �Codec�strictcCs|dkrtd|��|sdSy|jd�}Wntk
r>YnjX|jd�}x8|dd�D](}dt|�kordknsXtd ��qXWt|d
�dkr�td
��|t|�fSt�}tj|�}|r�|dr�d}|d=nd}x(|D] }|r�|jd�|jt|��q�Wt ||�t|�fS)Nr(zunsupported error handling �rr�.rrzlabel empty or too longzlabel too long)r)rr
r
r
r
)
rr�UnicodeEncodeError�splitr� bytearray�dots�extendrr!)�self�input�errorsr%�labelsr�trailing_dotrrr r�s4
zCodec.encodecCs�|dkrtd|��|sd St|t�s.t|�}t|kr^y|jd�t|�fStk
r\YnX|jd�}|r�t|d
�dkr�d}|d=nd}g}x|D]}|jt |��q�Wdj
|�|t|�fS)Nr(zUnsupported error handling rrrr*r�.)rrr
r
)rr r!rr#r�UnicodeDecodeErrorr,rr&r)r0r1r2r3r4r%rrrr r#�s(
zCodec.decodeN)r()r()�__name__�
__module__�__qualname__rr#rrrr r'�s
%r'c@seZdZdd�ZdS)�IncrementalEncoderc Cs�|dkrtd|��|sdStj|�}d}|rT|dsBd}|d =n|sT|d
=|rTd}t�}d}x<|D]4}|r~|jd�|d7}|jt|��|t|�7}qdW||7}|t|�7}t|�|fS)Nr(zunsupported error handling r)rrr*)r)rr
r
r
)rr.r,r-r/rrr!) r0r1r2�finalr3r4r%�sizerrrr �_buffer_encode�s2
z!IncrementalEncoder._buffer_encodeN)r7r8r9r=rrrr r:�sr:c@seZdZdd�ZdS)�IncrementalDecoderc Cs�|dkrtd|��|sdSt|t�r2tj|�}nt|d�}|jd�}d}|rt|d sbd}|d
=n|st|d=|rtd}g}d}x2|D]*}|jt|��|r�|d7}|t|�7}q�Wdj|�|}|t|�7}||fS)Nr(zUnsupported error handling rrrr5r)rrr
r
r
) rr r"r.r,rr&rr) r0r1r2r;r3r4r%r<rrrr �_buffer_decode�s6
z!IncrementalDecoder._buffer_decodeN)r7r8r9r?rrrr r>�sr>c@seZdZdS)�StreamWriterN)r7r8r9rrrr r@"sr@c@seZdZdS)�StreamReaderN)r7r8r9rrrr rA%srAc Cs tjdt�jt�jttttd�S)NZidna)�namerr#�incrementalencoder�incrementaldecoder�streamwriter�streamreader) �codecs� CodecInfor'rr#r:r>r@rArrrr �getregentry*srI)r�rerGrr�compiler.rrrrr&r'�BufferedIncrementalEncoderr:�BufferedIncrementalDecoderr>r@rArIrrrr �<module>s
.+)H#'
?>