Files
PowerToys/PythonHome/Lib/encodings/punycode.pyc

44 lines
7.5 KiB
Plaintext
Raw Normal View History

2014-07-09 18:15:23 +08:00
<03>
<EFBFBD>W`Sc@sdZddlZd<00>Zd<00>Zd<00>Zd<00>Zd<00>ZdZd <00>Zd
<00>Z d <00>Z
d <00>Z d <00>Z d<00>Z d<00>Zdejfd<00><00>YZdejfd<00><00>YZdejfd<00><00>YZdeejfd<00><00>YZdeejfd<00><00>YZd<00>ZdS(sX Codec for the Punicode encoding, as specified in RFC 3492
Written by Martin v. L<>wis.
i<EFBFBD><EFBFBD><EFBFBD><EFBFBD>NcCs{g}i}x:|D]2}t|<00>dkr;|j|<00>qd||<qW|j<00>}|j<00>dj|<00>jd<00>|fS(s 3.1 Basic code point segregationi<6E>ittascii(tordtappendtkeystsorttjointencode(tstrtbasetextendedtc((s.\Lib\encodings\punycode.pyt segregate s  
cCs:d}x-|D]%}t|<00>|kr |d7}q q W|S(s@Return the length of str, considering only characters below max.ii(R(RtmaxtresR ((s.\Lib\encodings\punycode.pyt selective_lens
 cCsmt|<00>}xZ|d7}||kr)dS||}||krM|d|fS||kr|d7}qqdS(sReturn 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.ii<><69><EFBFBD><EFBFBD>N(i<><69><EFBFBD><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD>(tlen(RtchartindextpostlR ((s.\Lib\encodings\punycode.pytselective_find s 
 
  c Cs<>d}g}d}x<>|D]<5D>}d}}t|<00>}t||<00>} | d||}
xYt||||<00>\}}|dkr<>Pn|
||7}
|j|
d<18>|}d}
qY|}qW|S(s3.2 Insertion unsort codingi<67>i<><69><EFBFBD><EFBFBD>ii(RRRR( RR
toldchartresulttoldindexR RRRtcurlentdelta((s.\Lib\encodings\punycode.pytinsertion_unsort2s$ 
   
cCs6d|d|}|dkr"dS|dkr2dS|S(Ni$ii((tjtbiasR((s.\Lib\encodings\punycode.pytTHs   t$abcdefghijklmnopqrstuvwxyz0123456789cCs<>g}d}xpt||<00>}||kr?|jt|<19>|S|jt|||d|<19>||d|}|d7}qdS(s(3.3 Generalized variable-length integersii$iN(RRtdigits(tNRRRtt((s.\Lib\encodings\punycode.pytgenerate_generalized_integerPs !cCsr|r|d}n
|d}|||7}d}x$|dkrW|d}|d7}q4W|d||d}|S(Ni<4E>iii<>i#i$i&((Rtfirsttnumcharst divisionsR((s.\Lib\encodings\punycode.pytadapt]s 

cCsrg}d}xVt|<00>D]H\}}t||<00>}|j|<00>t||dk||d<17>}qWdj|<00>S(s3.4 Bias adaptationiHiiR(t enumerateR#textendR'R(tbaselentdeltasRRtpointsRts((s.\Lib\encodings\punycode.pytgenerate_integersls $cCs[t|<00>\}}|jd<00>}t||<00>}tt|<00>|<00>}|rW|d|S|S(NRt-(R RRR.R(ttextR R
R+((s.\Lib\encodings\punycode.pytpunycode_encodews c
Cs;d}d}d}x"yt||<19>}Wn4tk
r_|dkrQtd<00>n|dd fSX|d7}d|ko<>dknr<>|d}nVd|ko<>dknr<>|d }n-|dkr<>td
||<16><00>n
|d fSt||<00>} |||7}|| kr||fS|d | }|d7}qd S( s(3.3 Generalized variable-length integersiitstrictsincomplete punicode stringiAiZi0i9is Invalid extended code point '%s'i$N(Rt
IndexErrort UnicodeErrortNoneR(
R
textposRterrorsRtwRRtdigitR"((s.\Lib\encodings\punycode.pytdecode_generalized_number<65>s2   
   
 
c Csd}d}d}d}x<>|t|<00>kr t||||<00>\}}|d
krX|S||d7}||t|<00>d7}|dkr<>|dkr<>td|<16>ntd <00>}n|t|<00>d}|| t|<00>||}t||dkt|<00><00>}|}qW|S( s3.2 Insertion unsort codingi<67>i<><69><EFBFBD><EFBFBD>iHiii<><69>R2sInvalid character U+%xt?N(RR:R5R4RtunichrR'( R R
R7RRRR6tnewposR((s.\Lib\encodings\punycode.pytinsertion_sort<72>s(    
cCsp|jd<00>}|dkr*d}|}n|| }||d}t|d|<00>}|j<00>}t|||<00>S(NR/i<><69><EFBFBD><EFBFBD>RiR(trfindtunicodetupperR>(R0R7RR R
((s.\Lib\encodings\punycode.pytpunycode_decode<64>s  
 tCodeccBs eZdd<00>Zdd<00>ZRS(R2cCst|<00>}|t|<00>fS(N(R1R(tselftinputR7R((s.\Lib\encodings\punycode.pyR<00>s cCs;|dkrtd|<17>nt||<00>}|t|<00>fS(NR2treplacetignoresUnsupported error handling (sstrictsreplacesignore(R4RBR(RDRER7R((s.\Lib\encodings\punycode.pytdecode<64>s (t__name__t
__module__RRH(((s.\Lib\encodings\punycode.pyRC<00>s tIncrementalEncodercBseZed<00>ZRS(cCs
t|<00>S(N(R1(RDREtfinal((s.\Lib\encodings\punycode.pyR<00>s(RIRJtFalseR(((s.\Lib\encodings\punycode.pyRK<00>stIncrementalDecodercBseZed<00>ZRS(cCs2|jdkr"td|j<17>nt||j<00>S(NR2RFRGsUnsupported error handling (sstrictsreplacesignore(R7R4RB(RDRERL((s.\Lib\encodings\punycode.pyRH<00>s(RIRJRMRH(((s.\Lib\encodings\punycode.pyRN<00>st StreamWritercBseZRS((RIRJ(((s.\Lib\encodings\punycode.pyRO<00>st StreamReadercBseZRS((RIRJ(((s.\Lib\encodings\punycode.pyRP<00>scCs@tjdddt<00>jdt<00>jdtdtdtdt<00>S( NtnametpunycodeRRHtincrementalencodertincrementaldecodert streamwritert streamreader( tcodecst CodecInfoRCRRHRKRNRORP(((s.\Lib\encodings\punycode.pyt getregentry<72>s   (t__doc__RWR RRRRR R#R'R.R1R:R>RBRCRKRNRORPRY(((s.\Lib\encodings\punycode.pyt<module>s(