Your IP : 3.133.153.110


Current Path : /opt/alt/python33/lib64/python3.3/encodings/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/encodings/__pycache__/punycode.cpython-33.pyc

�
��f�c@s;dZddlZdd�Zdd�Zdd�Zd	d
�Zdd�Zd
Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�ZGdd�dej�ZGdd�dej�ZGd d!�d!ej�ZGd"d#�d#eej�ZGd$d%�d%eej�Zd&d'�ZdS((uY Codec for the Punicode encoding, as specified in RFC 3492

Written by Martin v. Löwis.
iNcCstt�}t�}xC|D];}t|�dkrG|jt|��q|j|�qWt|�}t|�|fS(u 3.1 Basic code point segregationi�(u	bytearrayusetuorduappenduaddusortedubytes(ustrubaseuextendeduc((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyu	segregate
s		
u	segregatecCs:d}x-|D]%}t|�|kr
|d7}q
q
W|S(u@Return the length of str, considering only characters below max.ii(uord(ustrumaxuresuc((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyu
selective_lens

u
selective_lencCsmt|�}xZ|d7}||kr)dS||}||krM|d|fS||kr|d7}qqdS(uReturn 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.iNi����i����(i����i����(ulen(ustrucharuindexuposuluc((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuselective_finds

uselective_findcCs�d}g}d}x�|D]�}d}}t|�}t||�}	|	d||}
xYt||||�\}}|dkr�Pn|
||7}
|j|
d�|}d}
qY|}qW|S(u3.2 Insertion unsort codingi�iii����i����i����(uordu
selective_lenuselective_finduappend(ustruextendeduoldcharuresultuoldindexucuindexuposucharucurlenudelta((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuinsertion_unsort0s$

	
uinsertion_unsortcCs6d|d|}|dkr"dS|dkr2dS|S(Ni$ii((ujubiasures((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuTFsuTs$abcdefghijklmnopqrstuvwxyz0123456789cCs�t�}d}xvt||�}||krH|jt|�t|�S|jt|||d|�||d|}|d7}qdS(u(3.3 Generalized variable-length integersii$iN(u	bytearrayuTuappendudigitsubytes(uNubiasuresultujut((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyugenerate_generalized_integerNs	
!ugenerate_generalized_integercCsr|r|d}n
|d}|||7}d}x$|dkrW|d}|d7}q4W|d||d}|S(Ni�iii�i#i$i&((udeltaufirstunumcharsu	divisionsubias((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuadapt[s


uadaptcCsrt�}d}xVt|�D]H\}}t||�}|j|�t||dk||d�}qWt|�S(u3.4 Bias adaptationiHii(u	bytearrayu	enumerateugenerate_generalized_integeruextenduadaptubytes(ubaselenudeltasuresultubiasupointsudeltaus((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyugenerate_integersjs	
$ugenerate_integerscCsLt|�\}}t||�}tt|�|�}|rH|d|S|S(Ns-(u	segregateuinsertion_unsortugenerate_integersulen(utextubaseuextendedudeltas((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyupunycode_encodeusupunycode_encodec
CsBd}d}d}x)yt||�}Wn;tk
rf|dkrTtd��n|ddfSYnX|d7}d|ko�dknr�|d}nVd|ko�dknr�|d	}n-|dkr�td
||��n
|dfSt||�}	|||7}||	kr#||fS|d|	}|d7}qdS(
u(3.3 Generalized variable-length integersiiustrictuincomplete punicode stringiAiZi0i9iu Invalid extended code point '%s'i$N(uordu
IndexErroruUnicodeErroruNoneuT(
uextendeduextposubiasuerrorsuresultuwujucharudigitut((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyudecode_generalized_numbers2





udecode_generalized_numberc	Cs d}d
}d}d}x|t|�krt||||�\}}|d	krX|S||d7}||t|�d7}|dkr�|dkr�td|��ntd�}n|t|�d}|d	|�t|�||d	�}t||dkt|��}|}qW|S(u3.2 Insertion unsort codingi�iiHii��ustrictuInvalid character U+%xu?Ni����(ulenudecode_generalized_numberuNoneuUnicodeErroruorduchruadapt(	ubaseuextendeduerrorsucharuposubiasuextposunewposudelta((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuinsertion_sort�s(	(
uinsertion_sortcCs�t|t�r!|jd�}nt|t�r?t|�}n|jd�}|dkrxd}t|d�j�}n?t|d|�d|�}t||dd�d�j�}t|||�S(Nuasciis-iui����(u
isinstanceustruencodeu
memoryviewubytesurfinduupperuinsertion_sort(utextuerrorsuposubaseuextended((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyupunycode_decode�s#upunycode_decodecBs2|EeZdZddd�Zddd�ZdS(uCodecustrictcCst|�}|t|�fS(N(upunycode_encodeulen(uselfuinputuerrorsures((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuencode�suCodec.encodecCs>|dkrtd|��nt||�}|t|�fS(NustrictureplaceuignoreuUnsupported error handling (ustrictureplaceuignore(uUnicodeErrorupunycode_decodeulen(uselfuinputuerrorsures((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyudecode�suCodec.decodeN(u__name__u
__module__u__qualname__uencodeudecode(u
__locals__((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuCodec�suCodeccBs#|EeZdZddd�ZdS(uIncrementalEncodercCs
t|�S(N(upunycode_encode(uselfuinputufinal((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuencode�suIncrementalEncoder.encodeNF(u__name__u
__module__u__qualname__uFalseuencode(u
__locals__((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuIncrementalEncoder�suIncrementalEncodercBs#|EeZdZddd�ZdS(uIncrementalDecodercCs5|jdkr%td|j��nt||j�S(NustrictureplaceuignoreuUnsupported error handling (ustrictureplaceuignore(uerrorsuUnicodeErrorupunycode_decode(uselfuinputufinal((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyudecode�suIncrementalDecoder.decodeNF(u__name__u
__module__u__qualname__uFalseudecode(u
__locals__((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuIncrementalDecoder�suIncrementalDecodercBs|EeZdZdS(uStreamWriterN(u__name__u
__module__u__qualname__(u
__locals__((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuStreamWriter�suStreamWritercBs|EeZdZdS(uStreamReaderN(u__name__u
__module__u__qualname__(u
__locals__((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyuStreamReader�suStreamReadercCs@tjdddt�jdt�jdtdtdtdt�S(	Nunameupunycodeuencodeudecodeuincrementalencoderuincrementaldecoderustreamwriterustreamreader(	ucodecsu	CodecInfouCodecuencodeudecodeuIncrementalEncoderuIncrementalDecoderuStreamWriteruStreamReader(((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyugetregentry�s	ugetregentry(u__doc__ucodecsu	segregateu
selective_lenuselective_finduinsertion_unsortuTudigitsugenerate_generalized_integeruadaptugenerate_integersupunycode_encodeudecode_generalized_numberuinsertion_sortupunycode_decodeuCodecuIncrementalEncoderuIncrementalDecoderuStreamWriteruStreamReaderugetregentry(((u7/opt/alt/python33/lib64/python3.3/encodings/punycode.pyu<module>s(



?>