B #a} @sddlmZmZmZmZmZddlZddlZddlm Z m Z e dZ Gdddej Z Gdd d ejZGd d d ejZGd d d e ejZGddde ejZddZdS))encodedecodealabelulabel IDNAErrorN)TupleOptionalu [.。.。]c@s eZdZdddZdddZdS) CodecstrictcCs.|dkrtd||sdSt|t|fS)Nr zUnsupported error handling "{}")r)rformatrlen)selfdataerrorsr1/tmp/pip-target-jgxl_w8r/lib/python/idna/codec.pyr s z Codec.encodecCs.|dkrtd||sdSt|t|fS)Nr zUnsupported error handling "{}")r)rr rr)rrrrrrrs z Codec.decodeN)r )r )__name__ __module__ __qualname__rrrrrrr s r c@seZdZddZdS)IncrementalEncoderc Cs|dkrtd||sdSt|}d}|rV|dsDd}|d=n|sV|d=|rVd}g}d}x2|D]*}|t||r|d7}|t|7}qdWd||} |t|7}| |fS) Nr zUnsupported error handling "{}")rrr.rr)rr _unicode_dots_resplitappendrrjoin) rrrfinallabels trailing_dotresultsizelabel result_strrrr_buffer_encodes0   z!IncrementalEncoder._buffer_encodeN)rrrr&rrrrrsrc@seZdZddZdS)IncrementalDecoderc Cs|dkrtd||sdSt|}d}|rV|dsDd}|d=n|sV|d=|rVd}g}d}x2|D]*}|t||r|d7}|t|7}qdWd||} |t|7}| |fS) Nr zUnsupported error handling "{}")rrrrrrr)rr rrrrrr) rrrrr r!r"r#r$r%rrr_buffer_decodeAs0   z!IncrementalDecoder._buffer_decodeN)rrrr(rrrrr'@sr'c@s eZdZdS) StreamWriterN)rrrrrrrr)bsr)c@s eZdZdS) StreamReaderN)rrrrrrrr*fsr*c Cs tjdtjtjttttdS)Nidna)namerrincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInfor rrrr'r)r*rrrr getregentryjsr3)corerrrrrr1retypingrr compilerr BufferedIncrementalEncoderrBufferedIncrementalDecoderr'r)r*r3rrrrs ""