3 'X @sddlmZmZmZmZmZddlZddlZejdZ Gdddej Z Gdddej Z Gd d d ej ZGd d d e ejZGd dde ejZddZdS))encodedecodealabelulabel IDNAErrorNu [.。.。]c@s eZdZdddZdddZdS) CodecstrictcCs.|dkrtdj||sdSt|t|fS)Nr z Unsupported error handling "{0}"r)r r)rformatrlen)selfdataerrorsr/usr/lib/python3.6/codec.pyr s z Codec.encodecCs.|dkrtdj||sdSt|t|fS)Nr z Unsupported error handling "{0}"r r)r r)rr rr )r rrrrrrs z Codec.decodeN)r )r )__name__ __module__ __qualname__rrrrrrrs rc@seZdZddZdS)IncrementalEncoderc Cs|dkrtdj||sdStj|}d}|rV|dsDd}|d =n|sV|d =|rVd}g}d}x2|D]*}|jt||r|d7}|t|7}qdWdj||}|t|7}||fS) Nr z Unsupported error handling "{0}"r rr.)r rrr)rr _unicode_dots_resplitappendrr join) r rrfinallabels trailing_dotresultsizelabelrrr_buffer_encodes0   z!IncrementalEncoder._buffer_encodeN)rrrr"rrrrrsrc@seZdZddZdS)IncrementalDecoderc Cs|dkrtdj||sdSt|tr4tj|}nt|}t|d|jd}d}|r~|d sld}|d =n|s~|d =|r~d}g}d}x2|D]*}|jt||r|d7}|t |7}qWdj ||}|t |7}||fS) Nr z Unsupported error handling "{0}"r rasciirr)r rrrr) rr isinstanceZunicoderrstrrrr r) r rrrrrrr r!rrr_buffer_decode?s8      z!IncrementalDecoder._buffer_decodeN)rrrr'rrrrr#>sr#c@s eZdZdS) StreamWriterN)rrrrrrrr(gsr(c@s eZdZdS) StreamReaderN)rrrrrrrr)jsr)c Cs tjdtjtjttttdS)NZidna)namerrincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInforrrrr#r(r)rrrr getregentrymsr1)Zcorerrrrrr/recompilerrBufferedIncrementalEncoderrBufferedIncrementalDecoderr#r(r)r1rrrrs !)