Your IP : 3.144.37.178


Current Path : /opt/alt/python311/lib64/python3.11/encodings/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/encodings/__pycache__/punycode.cpython-311.pyc

�

c��f���&�dZddlZd�Zd�Zd�Zd�Zd�ZdZd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�ZGd�dej��ZGd�dej��ZGd�dej��ZGd�deej��ZGd�deej��Zd�ZdS)uY Codec for the Punicode encoding, as specified in RFC 3492

Written by Martin v. Löwis.
�Nc��t��}t��}|D]M}t|��dkr#|�t|�����8|�|���Nt|��}t
|��|fS)z 3.1 Basic code point segregation�)�	bytearray�set�ord�append�add�sorted�bytes)�str�base�extended�cs    �9/opt/alt/python311/lib64/python3.11/encodings/punycode.py�	segregater
s|���;�;�D��u�u�H�
�����q�6�6�C�<�<��K�K��A��������L�L��O�O�O�O��h���H���;�;�� � �c�D�d}|D]}t|��|kr|dz
}�|S)z@Return the length of str, considering only characters below max.r�)r)r�max�resrs    r�
selective_lenrs4��
�C�
�����q�6�6�C�<�<��1�H�C���Jrc�~�t|��}	|dz
}||krdS||}||kr|dz|fS||kr|dz
}�.)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.r)���r)�len)r�char�index�pos�lrs      r�selective_findrsb��	�C���A���q����!�8�8��8���H����9�9���7�C�<��
��X�X��Q�J�E�rc��d}g}d}|D]t}dx}}t|��}t||��}	|	dz||z
z}
	t||||��\}}|dkrn%|
||z
z
}
|�|
dz
��|}d}
�A|}�u|S)�3.2 Insertion unsort codingrrrr)rrrr)rr�oldchar�result�oldindexrrrr�curlen�deltas           r�insertion_unsortr'0s����G�
�F��H�
�
�
�������1�v�v���s�D�)�)�����d�W�n�-��	�&�s�1�U�3�7�7�I�E�#���{�{���U�X�%�%�E��M�M�%��'�"�"�"��H��E�	�����Mrc�<�d|dzz|z
}|dkrdS|dkrdS|S)N�$r��)�j�biasrs   r�Tr.Fs3��
��A��,��
�C�
�Q�w�w�q�q�
�R�x�x����Jrs$abcdefghijklmnopqrstuvwxyz0123456789c�(�t��}d}	t||��}||kr/|�t|��t	|��S|�t|||z
d|z
zz��||z
d|z
z}|dz
}��)�(3.3 Generalized variable-length integersrrr))rr.r�digitsr)�Nr-r#r,�ts     r�generate_generalized_integerr4Ns���
�[�[�F�	�A��
�a��J�J���q�5�5��M�M�&��)�$�$�$���=�=� ��
�
�f�Q�1�q�5�R�!�V�"4�5�6�7�7�7�
��U��Q����	�Q���rc�|�|r|dz}n|dz}|||zz
}d}|dkr|dz}|dz
}|dk�|d|z|dzzz}|S)Ni��ri��#r)�&r+)r&�first�numchars�	divisionsr-s     r�adaptr<[sv����
�#�
���
�!���	�U�h�
��E��I�
�#�+�+������R��	��#�+�+���U�
�u�r�z�2�3�D��Krc���t��}d}t|��D]E\}}t||��}|�|��t	||dk||zdz��}�Ft|��S)z3.4 Bias adaptation�Hrr)r�	enumerater4�extendr<r)�baselen�deltasr#r-�pointsr&�ss       r�generate_integersrEjsz���[�[�F�
�D�"�6�*�*�9�9�
���(���5�5���
�
�a�����U�F�A�I�w�v�~�a�'7�8�8�����=�=�rc��t|��\}}t||��}tt|��|��}|r|dz|zS|S)N�-)rr'rEr)�textr
rrBs    r�punycode_encoderIusQ���t�_�_�N�D�(�
�d�H�
-�
-�F� ��T���F�3�3�H��&��d�{�X�%�%��Orc��d}d}d}		t||��}n,#t$r|dkrtd���|dzdfcYSwxYw|dz
}d|cxkrdkr	nn|dz
}n;d|cxkrd	kr	nn|d
z
}n%|dkrtd||dz
z���|dfSt||��}	|||zz
}||	kr||fS|d|	z
z}|dz
}��)
r0rr�strictzincomplete punicode stringN�A�Z�0�9�z Invalid extended code point '%s'r))r�
IndexError�UnicodeErrorr.)
r�extposr-�errorsr#�wr,r�digitr3s
          r�decode_generalized_numberrWsd��
�F�	�A�	�A��	$��x��'�(�(�D�D���	$�	$�	$���!�!�"�#?�@�@�@��A�:�t�#�#�#�#�	$����	�!����4�����4�������4�K�E�E�
�T�
!�
!�
!�
!�T�
!�
!�
!�
!�
!��2�I�E�E�
�x�
�
��A�!)�&��(�!3� 4�5�5�
5��4�<��
�a��J�J���%�!�)����1�9�9��6�>�!�
��a��L��	�Q���-s��&A�Ac���d}d}d}d}|t|��kr�t||||��\}}|�|S||dzz
}||t|��dzzz
}|dkr'|dkrtd	|z���td
��}|t|��dzz}|d|�t	|��z||d�z}t||dkt|����}|}|t|��k��|S)r!rrr>rNri��rKzInvalid character U+%x�?)rrWrRr�chrr<)	r
rrTrrr-rS�newposr&s	         r�insertion_sortr\�s���D�
�C�
�D�
�F�
�3�x�=�=�
 �
 �1�(�F�26��@�@�
����=��K��u�Q�w������D�	�	�A�
�&�&���(�?�?���!�!�"�#;�d�#B�C�C�C��s�8�8�D��S��Y�Y��]�#���D�S�D�z�C��I�I�%��S�T�T�
�2���U�V�q�[�3�t�9�9�5�5����!�3�x�=�=�
 �
 �"�Krc���t|t��r|�d��}t|t��rt	|��}|�d��}|dkr%d}t|d�����}nFt|d|�d|��}t||dzd�d�����}t|||��S)N�asciirGr�r)�
isinstancer�encode�
memoryviewr�rfind�upperr\)rHrTrr
rs     r�punycode_decodere�s����$����$��{�{�7�#�#���$�
�#�#���T�{�{��
�*�*�T�
�
�C�
�b�y�y����t�W�%�%�+�+�-�-����4����:�w��/�/���t�C��E�F�F�|�W�-�-�3�3�5�5���$��&�1�1�1rc��eZdZdd�Zdd�ZdS)�CodecrKc�B�t|��}|t|��fS�N)rIr��self�inputrTrs    rrazCodec.encode�s���e�$�$���C��J�J��rc�p�|dvrtd|z���t||��}|t|��fS�N)rK�replace�ignorezUnsupported error handling )rRrerrjs    r�decodezCodec.decode�sA���8�8�8��<�V�C�D�D�D��e�V�,�,���C��J�J��rN)rK)�__name__�
__module__�__qualname__rarqr+rrrgrg�s<���������������rrgc��eZdZdd�ZdS)�IncrementalEncoderFc� �t|��Sri)rI�rkrl�finals   rrazIncrementalEncoder.encode�s���u�%�%�%rN�F)rrrsrtrar+rrrvrv�s(������&�&�&�&�&�&rrvc��eZdZdd�ZdS)�IncrementalDecoderFc�l�|jdvrtd|jz���t||j��Srn)rTrRrerxs   rrqzIncrementalDecoder.decode�s8���;�=�=�=��<�T�[�H�I�I�I��u�d�k�2�2�2rNrz)rrrsrtrqr+rrr|r|�s(������3�3�3�3�3�3rr|c��eZdZdS)�StreamWriterN�rrrsrtr+rrrr���������Drrc��eZdZdS)�StreamReaderNr�r+rrr�r��r�rr�c	��tjdt��jt��jt
ttt���S)N�punycode)�namerarq�incrementalencoder�incrementaldecoder�streamwriter�streamreader)	�codecs�	CodecInforgrarqrvr|rr�r+rr�getregentryr��s=����
��w�w�~��w�w�~�-�-�!�!����r)�__doc__r�rrrr'r.r1r4r<rErIrWr\rergrvr|rr�r�r+rr�<module>r�s�����
�
�
�
�
!�
!�
!�������$���,���
1��������	�	�	�������<���22�2�2� 
�
�
�
�
�F�L�
�
�
�&�&�&�&�&��2�&�&�&�3�3�3�3�3��2�3�3�3�	�	�	�	�	�5��,�	�	�	�	�	�	�	�	�5��,�	�	�	�
	�	�	�	�	r

?>