U e5d@sddlZddZddZddZdd Zd d Zd Zd dZddZddZ ddZ ddZ ddZ ddZ GdddejZGdddejZGdd d ejZGd!d"d"eejZGd#d$d$eejZd%d&ZdS)'NcCsPt}t}|D]*}t|dkr0|t|q||qt|}t||fS)N) bytearraysetordappendaddsortedbytes)strbaseextendedcr*/usr/lib64/python3.8/encodings/punycode.py segregate s  rcCs&d}|D]}t||kr|d7}q|S)Nr)r)r maxresr rrr selective_lens   rcCsNt|}|d7}||krdS||}||kr8|d|fS||kr|d7}qdS)Nr)r)len)r charindexposlr rrrselective_finds rc Csd}g}d}|D]r}d}}t|}t||} | d||} t||||\}}|dkrZq~| ||7} || d|}d} q>|}q|S)Nrrrr)rrrr) r r ZoldcharresultZoldindexr rrrZcurlendeltarrrinsertion_unsort0s"  rcCs,d|d|}|dkrdS|dkr(dS|S)N$rr)jbiasrrrrTFs r#s$abcdefghijklmnopqrstuvwxyz0123456789cCsnt}d}t||}||kr2|t|t|S|t|||d|||d|}|d7}q dS)Nrrr)rr#rdigitsr )Nr"rr!trrrgenerate_generalized_integerNs r'cCsX|r|d}n|d}|||7}d}|dkr@|d}|d7}q&|d||d}|S)Niri#r&r)rfirstnumcharsZ divisionsr"rrradapt[s   r-cCsPt}d}t|D]4\}}t||}||t||dk||d}qt|S)NHrr)r enumerater'extendr-r )Zbaselendeltasrr"Zpointsrsrrrgenerate_integersjs  r3cCs8t|\}}t||}tt||}|r4|d|S|S)N-)rrr3r)textr r r1rrrpunycode_encodeus    r6c Csd}d}d}zt||}Wn0tk rL|dkrrchrr-) r r r@rrr"r?Znewposrrrrinsertion_sorts,    rFcCst|tr|d}t|tr&t|}|d}|dkrLd}t|d}n.t|d|d|}t||ddd}t|||S)Nasciir4rr) isinstancer encode memoryviewr rfindupperrF)r5r@rr r rrrpunycode_decodes    rNc@s eZdZdddZdddZdS) Codecr7cCst|}|t|fSN)r6rselfinputr@rrrrrJsz Codec.encodecCs*|dkrtd|t||}|t|fSN)r7replaceignorezUnsupported error handling )r>rNrrQrrrdecodes  z Codec.decodeN)r7)r7)__name__ __module__ __qualname__rJrWrrrrrOs rOc@seZdZdddZdS)IncrementalEncoderFcCst|SrP)r6rRrSfinalrrrrJszIncrementalEncoder.encodeN)F)rXrYrZrJrrrrr[sr[c@seZdZdddZdS)IncrementalDecoderFcCs$|jdkrtd|jt||jSrT)r@r>rNr\rrrrWs zIncrementalDecoder.decodeN)F)rXrYrZrWrrrrr^sr^c@s eZdZdS) StreamWriterNrXrYrZrrrrr_sr_c@s eZdZdS) StreamReaderNr`rrrrrasrac Cs tjdtjtjttttdS)NZpunycode)namerJrWincrementalencoderincrementaldecoder streamwriter streamreader) codecs CodecInforOrJrWr[r^r_rarrrr getregentrysri)rgrrrrr#r$r'r-r3r6rCrFrNrOr[r^r_rarirrrrs&