a c. @sddlmZmZmZmZmZddlZddlZddlm Z m Z e dZ Gdddej Z Gdd d ejZGd d d ejZGd d d e ejZGddde ejZejdddZdS))encodedecodealabelulabel IDNAErrorN)TupleOptionalu [.。.。]c@sDeZdZdeeeeefdddZd eeeeefdddZdS) Codecstrict)dataerrorsreturncCs.|dkrtd||sdSt|t|fS)Nr Unsupported error handling "{}")r)rformatrlenselfr r rW/workspaces/shunt/resources/test-fastapi/venv/lib/python3.9/site-packages/idna/codec.pyr s z Codec.encodecCs.|dkrtd||sdSt|t|fS)Nr rr)rrrrrrrrrs z Codec.decodeN)r )r ) __name__ __module__ __qualname__strrbytesintrrrrrrr s r c@s(eZdZeeeeeefdddZdS)IncrementalEncoderr r finalrc 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 r r!labels trailing_dotresultsizelabelZ result_strrrr_buffer_encodes0  z!IncrementalEncoder._buffer_encodeN)rrrrboolrrr/rrrrrsrc@s(eZdZeeeeeefdddZdS)IncrementalDecoderr c Cs|dkrtd||sdSt|}d}|rV|dsDd}|d=n|sV|d=|rVd}g}d}|D]*}|t||r|d7}|t|7}qbd||} |t|7}| |fSr")rrr%r&r'rrr(r)rrr_buffer_decode>s0  z!IncrementalDecoder._buffer_decodeN)rrrrr0rrr2rrrrr1=sr1c@s eZdZdS) StreamWriterNrrrrrrrr3^sr3c@s eZdZdS) StreamReaderNr4rrrrr5bsr5)rc Cs tjdtjtjttttdS)Nidna)namerrincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInfor rrrr1r3r5rrrr getregentryfsr>)corerrrrrr<retypingrr compiler%r BufferedIncrementalEncoderrBufferedIncrementalDecoderr1r3r5r=r>rrrrs !!