U ÙAT^Ò#ã@s¸ddlZddlZddlZddlmZe d¡ZdZdZdd„Z dd „Z d d „Z Gd d „d ej ƒZ Gdd„dej ƒZGdd„dejƒZGdd„de ejƒZGdd„de ejƒZdd„ZdS)éN)Ú ucd_3_2_0u [.。.。]sxn--zxn--cCsg}|D] }t |¡rq| t |¡¡qd |¡}t d|¡}|D]j}t |¡s¢t |¡s¢t  |¡s¢t  |¡s¢t  |¡s¢t  |¡s¢t  |¡s¢t |¡s¢t |¡rDtd|ƒ‚qDdd„|Dƒ}|D]:}|rÂtdd„|Dƒƒrätdƒ‚|d rô|d sÂtd ƒ‚qÂ|S) NÚÚNFKCzInvalid character %rcSsg|]}t |¡‘qS©)Ú stringprepZ in_table_d1©Ú.0Úxrrú&/usr/lib64/python3.8/encodings/idna.pyÚ )sznameprep..css|]}t |¡VqdS)N)rZ in_table_d2rrrr Ú 2sznameprep..zViolation of BIDI requirement 2réÿÿÿÿzViolation of BIDI requirement 3)rZ in_table_b1ÚappendZ map_table_b2ÚjoinÚ unicodedataÚ normalizeZ in_table_c12Z in_table_c22Z in_table_c3Z in_table_c4Z in_table_c5Z in_table_c6Z in_table_c7Z in_table_c8Z in_table_c9Ú UnicodeErrorÚany)ÚlabelZnewlabelÚcZRandALrrr ÚnameprepsD    ÿþýüûúùø  rcCsðz| d¡}Wntk r"Yn*Xdt|ƒkrs,  r cCsÒt|tƒrd}n,z| d¡}d}Wntk r:d}YnX|stt|ƒ}z| d¡}Wntk rrtdƒ‚YnX| t¡sˆt|dƒS|ttƒd…}|  d¡}t |ƒ}t|dƒ  ¡t|dƒkrÎtd||ƒ‚|S)NTrFzInvalid character in IDN labelrzIDNA does not round-trip) Ú isinstanceÚbytesrrrrrÚstrrÚdecoder Úlower)rZ pure_asciiZlabel1ÚresultZlabel2rrr Ú ToUnicodeis*       r'c@s eZdZddd„Zddd„ZdS) ÚCodecÚstrictcCs|dkrtd|ƒ‚|sdSz| d¡}Wntk r>YndX| d¡}|dd…D]&}dt|ƒkrrdksVntd ƒ‚qVt|dƒdkr–td ƒ‚|t|ƒfStƒ}t |¡}|rÊ|dsÊd}|d=nd }|D] }|rä| d¡| t|ƒ¡qÒt ||ƒt|ƒfS) Nr)úunsupported error handling ©órró.r rrrzlabel too longr,) rrÚUnicodeEncodeErrorÚsplitrÚ bytearrayÚdotsÚextendr r")ÚselfÚinputÚerrorsr&ÚlabelsrÚ trailing_dotrrr r“s4       z Codec.encodecCsÀ|dkrtd|ƒ‚|sdSt|tƒs.t|ƒ}t|kr`z| d¡t|ƒfWStk r^YnX| d¡}|rŠt|dƒdkrŠd}|d=nd }g}|D]}| t |ƒ¡q–d  |¡|t|ƒfS) Nr)úUnsupported error handling ©rrrr-r rÚ.r) rr!r"rr$rÚUnicodeDecodeErrorr/rr'r)r3r4r5r6r7r&rrrr r$¸s(   z Codec.decodeN)r))r))Ú__name__Ú __module__Ú __qualname__rr$rrrr r(’s %r(c@seZdZdd„ZdS)ÚIncrementalEncoderc Cs¸|dkrtd|ƒ‚|sdSt |¡}d}|rT|dsBd}|d=n|sT|d=|rTd}tƒ}d}|D]4}|r|| d¡|d7}| t|ƒ¡|t|ƒ7}qb||7}|t|ƒ7}t|ƒ|fS) Nr)r*r+r,r r-ré)rr1r/r0r2r rr"© r3r4r5Úfinalr6r7r&Úsizerrrr Ú_buffer_encodeÛs2    z!IncrementalEncoder._buffer_encodeN)r<r=r>rDrrrr r?Úsr?c@seZdZdd„ZdS)ÚIncrementalDecoderc CsÎ|dkrtd|ƒ‚|sdSt|tƒr2t |¡}nt|dƒ}| d¡}d}|rt|dsbd}|d=n|st|d=|rtd}g}d}|D]*}| t|ƒ¡|rž|d 7}|t|ƒ7}q€d |¡|}|t|ƒ7}||fS) Nr)r8r9rr:rr rr@) rr!r#r1r/rr'rrrArrr Ú_buffer_decodeþs6      z!IncrementalDecoder._buffer_decodeN)r<r=r>rFrrrr rEýsrEc@s eZdZdS)Ú StreamWriterN©r<r=r>rrrr rG$srGc@s eZdZdS)Ú StreamReaderNrHrrrr rI'srIc Cs tjdtƒjtƒjttttdS)NZidna)Únamerr$ÚincrementalencoderÚincrementaldecoderÚ streamwriterÚ streamreader) ÚcodecsÚ CodecInfor(rr$r?rErGrIrrrr Ú getregentry,sùrQ)rÚrerOrrÚcompiler1rrrr r'r(ÚBufferedIncrementalEncoderr?ÚBufferedIncrementalDecoderrErGrIrQrrrr Ús  0+)H#'