MINI MINI MANI MO

Path : /usr/lib64/python3.6/encodings/__pycache__/
File Upload :
Current File : //usr/lib64/python3.6/encodings/__pycache__/punycode.cpython-36.pyc

3


 \@sdZddlZddZddZddZd	d
ZddZd
ZddZddZ	ddZ
ddZddZddZ
ddZGdddejZGdddejZGd d!d!ejZGd"d#d#eejZGd$d%d%eejZd&d'ZdS)(uY Codec for the Punicode encoding, as specified in RFC 3492

Written by Martin v. Löwis.
NcCsTt}t}x2|D]*}t|dkr2|jt|q|j|qWt|}t||fS)z 3.1 Basic code point segregation)	bytearraysetordappendaddsortedbytes)strbaseextendedcr*/usr/lib64/python3.6/encodings/punycode.py	segregate
s
rcCs*d}x |D]}t||kr
|d7}q
W|S)z@Return the length of str, considering only characters below max.r)r)r
maxresr
rrr
selective_lens

rcCsRt|}xD|d7}||krdS||}||kr:|d|fS||kr
|d7}q
WdS)aReturn a pair (index, pos), indicating the next occurrence of
    char in str. index is the position of the character considering
    only ordinals up to and including char, and pos is the position in
    the full string. index/pos is the starting position in the full
    string.rNr)rr)len)r
charindexposlr
rrrselective_findsrcCsd}g}d}x~|D]v}d}}t|}t||}	|	d||}
xBt||||\}}|dkr^P|
||7}
|j|
d|}d}
qBW|}qW|S)z3.2 Insertion unsort codingrrrrrr)rrrr)r
rZoldcharresultZoldindexr
rrrZcurlendeltarrrinsertion_unsort0s$

rcCs,d|d|}|dkrdS|dkr(dS|S)N$rr)jbiasrrrrTFsr#s$abcdefghijklmnopqrstuvwxyz0123456789cCsrt}d}xbt||}||kr4|jt|t|S|jt|||d|||d|}|d7}qWdS)z(3.3 Generalized variable-length integersrrrN)rr#rdigitsr	)Nr"rr!trrrgenerate_generalized_integerNs
r'cCs\|r|d}n|d}|||7}d}x|dkrB|d}|d7}q(W|d||d}|S)Niri#r&r)rfirstnumcharsZ	divisionsr"rrradapt[s

r-cCsTt}d}x@t|D]4\}}t||}|j|t||dk||d}qWt|S)z3.4 Bias adaptationHrr)r	enumerater'extendr-r	)Zbaselendeltasrr"Zpointsrsrrrgenerate_integersjs

r3cCs8t|\}}t||}tt||}|r4|d|S|S)N-)rrr3r)textrrr1rrrpunycode_encodeus
r6c
Csd}d}d}xyt||}Wn,tk
rJ|dkr>td|ddfSX|d7}d|kofdknrv|d}nDd|kod	knr|d
}n"|dkrtd||n|dfSt||}	|||7}||	kr||fS|d|	}|d7}qWdS)
z(3.3 Generalized variable-length integersrrstrictzincomplete punicode stringNAZ09z Invalid extended code point '%s'r)r
IndexErrorUnicodeErrorr#)
rextposr"errorsrwr!rZdigitr&rrrdecode_generalized_numbers2


rBc	Csd}d
}d}d}x|t|krt||||\}}|dkr<|S||d7}||t|d7}|dkr|dkrxtd|td	}|t|d}|d|t|||d}t||dkt|}|}qW|S)z3.2 Insertion unsort codingrrr.rNir7zInvalid character U+%x?r)rrBr>rchrr-)	rrr@rrr"r?Znewposrrrrinsertion_sorts( rEcCst|tr|jd}t|tr&t|}|jd}|dkrLd}t|dj}n.t|d|d|}t||dddj}t|||S)Nasciir4rr)
isinstancer
encode
memoryviewr	rfindupperrE)r5r@rrrrrrpunycode_decodes



rMc@s eZdZdddZdddZdS)	Codecr7cCst|}|t|fS)N)r6r)selfinputr@rrrrrIszCodec.encodecCs*|dkrtd|t||}|t|fS)Nr7replaceignorezUnsupported error handling )r7rQrR)r>rMr)rOrPr@rrrrdecodes
zCodec.decodeN)r7)r7)__name__
__module____qualname__rIrSrrrrrNs
rNc@seZdZdddZdS)IncrementalEncoderFcCst|S)N)r6)rOrPfinalrrrrIszIncrementalEncoder.encodeN)F)rTrUrVrIrrrrrWsrWc@seZdZdddZdS)IncrementalDecoderFcCs$|jdkrtd|jt||jS)Nr7rQrRzUnsupported error handling )r7rQrR)r@r>rM)rOrPrXrrrrSs
zIncrementalDecoder.decodeN)F)rTrUrVrSrrrrrYsrYc@seZdZdS)StreamWriterN)rTrUrVrrrrrZsrZc@seZdZdS)StreamReaderN)rTrUrVrrrrr[sr[c	Cs tjdtjtjttttdS)NZpunycode)namerIrSincrementalencoderincrementaldecoderstreamwriterstreamreader)	codecs	CodecInforNrIrSrWrYrZr[rrrrgetregentrysrc)__doc__rarrrrr#r$r'r-r3r6rBrErMrNrWrYrZr[rcrrrr<module>s(



OHA YOOOO