U .e @sddlmZmZmZmZmZddlZddlZedZ Gdddej Z Gdddej Z Gd d d ej ZGd d d e ejZGd dde ejZddZdS))encodedecodealabelulabel IDNAErrorNu [.。.。]c@s eZdZdddZdddZdS) CodecstrictcCs.|dkrtd||sdSt|t|fSNr Unsupported error handling "{0}"r)rformatrlenselfdataerrorsr:/usr/lib/python3.8/site-packages/pip/_vendor/idna/codec.pyr s z Codec.encodecCs.|dkrtd||sdSt|t|fSr )rrrrrrrrrs z Codec.decodeN)r )r )__name__ __module__ __qualname__rrrrrrrs rc@seZdZddZdS)IncrementalEncoderc Cs|dkrtd||sdSt|}d}|rV|dsDd}|d=n|sV|d=|rVd}g}d}|D]*}|t||r|d7}|t|7}qbd||}|t|7}||fS) Nr r r r .rr)rr_unicode_dots_resplitappendrrjoin rrrfinallabelsZ trailing_dotresultsizeZlabelrrr_buffer_encodes0  z!IncrementalEncoder._buffer_encodeN)rrrr%rrrrrsrc@seZdZddZdS)IncrementalDecoderc Cs|dkrtd||sdSt|tr4t|}nt|}t|d|d}d}|r~|dsld}|d=n|s~|d=|r~d}g}d}|D]*}|t||r|d 7}|t |7}qd ||}|t |7}||fS) Nr r r asciirr rrr) rr isinstanceZunicoderrstrrrrrr rrr_buffer_decode?s8     z!IncrementalDecoder._buffer_decodeN)rrrr*rrrrr&>sr&c@s eZdZdS) StreamWriterNrrrrrrrr+gsr+c@s eZdZdS) StreamReaderNr,rrrrr-jsr-c Cs tjdtjtjttttdS)NZidna)namerrincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInforrrrr&r+r-rrrr getregentrymsr5)Zcorerrrrrr3recompilerrBufferedIncrementalEncoderrBufferedIncrementalDecoderr&r+r-r5rrrrs !)