U eb @sddlmZmZmZmZmZddlZddlZddlm Z m Z m Z e dZ GdddejZGdd d ejZGd d d ejZGd d d eejZGdddeejZee ejdddZeedS))encodedecodealabelulabel IDNAErrorN)AnyTupleOptionalu [.。.。]c@sDeZdZdeeeeefdddZd eeeeefdddZdS) Codecstrict)dataerrorsreturncCs.|dkrtd||sdSt|t|fS)Nr Unsupported error handling "{}"r)rformatrlenselfr rr8/opt/hc_python/lib/python3.8/site-packages/idna/codec.pyr s z Codec.encodecCs.|dkrtd||sdSt|t|fS)Nr rr)rrrrrrrrrs z Codec.decodeN)r )r ) __name__ __module__ __qualname__strr bytesintrrrrrrr s r c@s(eZdZeeeeeefdddZdS)IncrementalEncoderr rfinalrc Cs|dkrtd||sdSt|}d}|rV|dsDd}|d=n|sV|d=|rVd}g}d}|D]*}|t||r|d7}|t|7}qbd||} |t|7}| |fS) Nr rrr.rr)rr_unicode_dots_resplitappendrrjoin) rr rr#labels trailing_dotresultsizelabelZ result_bytesrrr_buffer_encodes0  z!IncrementalEncoder._buffer_encodeN) rrrrboolr rr r/rrrrr!sr!c@s(eZdZeeeeeefdddZdS)IncrementalDecoderr"c Cs|dkrtd||sdSt|ts2t|d}t|}d}|rj|dsXd}|d=n|sj|d=|rjd}g}d}|D]*}|t||r|d 7}|t|7}qvd ||} |t|7}| |fS) Nr rrasciirr$.rr) rr isinstancerr&r'r(rrr)) rr rr#r*r+r,r-r.Z result_strrrr_buffer_decode>s4    z!IncrementalDecoder._buffer_decodeN) rrrrrr0r r r5rrrrr1=sr1c@s eZdZdS) StreamWriterNrrrrrrrr6asr6c@s eZdZdS) StreamReaderNr7rrrrr8esr8)namerc Cs,|dkr dStj|tjtjttttdS)NZidna2008)r9rrincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInfor rrr!r1r6r8)r9rrrsearch_functionisr@)corerrrrrr>retypingrr r compiler&r BufferedIncrementalEncoderr!BufferedIncrementalDecoderr1r6r8rr?r@registerrrrrs !$