%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__/chardistribution.cpython-312.pyc

�

�d0'��2�ddlmZmZddlmZmZmZddlmZm	Z	m
Z
ddlmZm
Z
mZddlmZmZmZddlmZmZmZddlmZGd	�d
�ZGd�de�ZGd
�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Z y)�)�Tuple�Union�)�BIG5_CHAR_TO_FREQ_ORDER�BIG5_TABLE_SIZE�BIG5_TYPICAL_DISTRIBUTION_RATIO)�EUCKR_CHAR_TO_FREQ_ORDER�EUCKR_TABLE_SIZE� EUCKR_TYPICAL_DISTRIBUTION_RATIO)�EUCTW_CHAR_TO_FREQ_ORDER�EUCTW_TABLE_SIZE� EUCTW_TYPICAL_DISTRIBUTION_RATIO)�GB2312_CHAR_TO_FREQ_ORDER�GB2312_TABLE_SIZE�!GB2312_TYPICAL_DISTRIBUTION_RATIO)�JIS_CHAR_TO_FREQ_ORDER�JIS_TABLE_SIZE�JIS_TYPICAL_DISTRIBUTION_RATIO)�JOHAB_TO_EUCKR_ORDER_TABLEc�|�eZdZdZdZdZdZdd�Zdd�Zd	e	e
efd
eddfd�Z
defd�Zdefd
�Zde	e
efdefd�Zy)�CharDistributionAnalysisig�G�z��?g{�G�z�?��returnNc��t�|_d|_d|_d|_d|_d|_|j�y)NrgF)�tuple�_char_to_freq_order�_table_size�typical_distribution_ratio�_done�_total_chars�_freq_chars�reset��selfs �:/usr/lib/python3/dist-packages/chardet/chardistribution.py�__init__z!CharDistributionAnalysis.__init__@s@��5:�G�� ����
+.��'���
��������
�
��c�.�d|_d|_d|_y)zreset analyser, clear any stateFrN)rr r!r#s r%r"zCharDistributionAnalysis.resetOs����
������r'�char�char_lenc���|dk(r|j|�}nd}|dk\rN|xjdz
c_||jkr)d|j|kDr|xjdz
c_yyyy)z"feed a character with known length����rriN)�	get_orderr rrr!)r$r)r*�orders    r%�feedzCharDistributionAnalysis.feedXsu���q�=��N�N�4�(�E��E��A�:�����"���t�'�'�'���1�1�%�8�8��$�$��)�$�9�(�r'c�<�|jdks|j|jkr|jS|j|jk7rD|j|j|jz
|jzz}||j
kr|S|j
S)z(return confidence based on existing datar)r r!�MINIMUM_DATA_THRESHOLD�SURE_NOr�SURE_YES)r$�rs  r%�get_confidencez'CharDistributionAnalysis.get_confidencefs�������!�T�%5�%5��9T�9T�%T��<�<������ 0� 0�0�� � ��"�"�T�%5�%5�5��9X�9X�X��A��4�=�=� ����}�}�r'c�4�|j|jkDS�N)r �ENOUGH_DATA_THRESHOLDr#s r%�got_enough_dataz(CharDistributionAnalysis.got_enough_dataws��� � �4�#=�#=�=�=r'�_c��y)Nr-�)r$r;s  r%r.z"CharDistributionAnalysis.get_order|s��
r'�rN)�__name__�
__module__�__qualname__r9r4r3r2r&r"r�bytes�	bytearray�intr0�floatr6�boolr:r.r=r'r%rr:s{�� ���H��G���
��*��u�i�/�0�*�C�*�D�*����">��>�
�5��	�!1�2��s�r'rc�:��eZdZd�fd�Zdeeefdefd�Z�xZ	S)�EUCTWDistributionAnalysisrc�d��t�|��t|_t|_t|_yr8)�superr&rrr
rrr�r$�	__class__s �r%r&z"EUCTWDistributionAnalysis.__init__��&���
����#;�� �+���*J��'r'�byte_strc�:�|d}|dk\rd|dz
z|dzdz
Sy)Nr���^r�r-r=�r$rN�
first_chars   r%r.z#EUCTWDistributionAnalysis.get_order��6��
�a�[�
������d�*�+�h�q�k�9�D�@�@�r'r>�
r?r@rAr&rrBrCrDr.�
__classcell__�rLs@r%rHrH��&���K��%��y�(8�"9��c�r'rHc�:��eZdZd�fd�Zdeeefdefd�Z�xZ	S)�EUCKRDistributionAnalysisrc�d��t�|��t|_t|_t|_yr8�rJr&r	rr
rrrrKs �r%r&z"EUCKRDistributionAnalysis.__init__�rMr'rNc�:�|d}|dk\rd|dz
z|dzdz
Sy)Nr�rQrrRr-r=rSs   r%r.z#EUCKRDistributionAnalysis.get_order�rUr'r>rVrXs@r%r[r[�rYr'r[c�:��eZdZd�fd�Zdeeefdefd�Z�xZ	S)�JOHABDistributionAnalysisrc�d��t�|��t|_t|_t|_yr8r]rKs �r%r&z"JOHABDistributionAnalysis.__init__�rMr'rNc�l�|d}d|cxkrdkr$ny|dz|dz}tj|d�Sy)Nr����rr-)r�get)r$rNrT�codes    r%r.z#JOHABDistributionAnalysis.get_order�sH���a�[�
��:�$��$����#�h�q�k�1�D�-�1�1�$��;�;�r'r>rVrXs@r%rara�s&���K��%��y�(8�"9��c�r'rac�:��eZdZd�fd�Zdeeefdefd�Z�xZ	S)�GB2312DistributionAnalysisrc�d��t�|��t|_t|_t|_yr8)rJr&rrrrrrrKs �r%r&z#GB2312DistributionAnalysis.__init__�s&���
����#<�� �,���*K��'r'rNc�H�|d|d}}|dk\r|dk\rd|dz
z|zdz
Sy)Nrrr_rRrQr-r=�r$rNrT�second_chars    r%r.z$GB2312DistributionAnalysis.get_order�sA��
#+�1�+�x��{�K�
��$��[�D�%8���d�*�+�k�9�D�@�@�r'r>rVrXs@r%rjrj�s&���L��%��y�(8�"9��c�r'rjc�:��eZdZd�fd�Zdeeefdefd�Z�xZ	S)�Big5DistributionAnalysisrc�d��t�|��t|_t|_t|_yr8)rJr&rrrrrrrKs �r%r&z!Big5DistributionAnalysis.__init__�s&���
����#:�� �*���*I��'r'rNc�j�|d|d}}|dk\r$|dk\rd|dz
z|zdz
dzSd|dz
z|zdz
Sy)	Nrr�rR��?�@r-r=rms    r%r.z"Big5DistributionAnalysis.get_order�sa��
#+�1�+�x��{�K�
�����d�"��j�4�/�0�;�>��E��J�J��*�t�+�,�{�:�T�A�A�r'r>rVrXs@r%rprp�s&���J�
�%��y�(8�"9�
�c�
r'rpc�:��eZdZd�fd�Zdeeefdefd�Z�xZ	S)�SJISDistributionAnalysisrc�d��t�|��t|_t|_t|_yr8�rJr&rrrrrrrKs �r%r&z!SJISDistributionAnalysis.__init__��&���
����#9�� �)���*H��'r'rNc��|d|d}}d|cxkrdkrnn	d|dz
z}nd|cxkrdkrny	d|dz
dzz}ny	||zd
z
}|dkDrd	}|S)Nrr��������r-rv�r=)r$rNrTrnr/s     r%r.z"SJISDistributionAnalysis.get_order�s}��
#+�1�+�x��{�K�
��:�%��%��:��,�-�E�
�Z�
'�4�
'���:��,�r�1�2�E����#�d�*������E��r'r>rVrXs@r%rxrx�s&���I��%��y�(8�"9��c�r'rxc�:��eZdZd�fd�Zdeeefdefd�Z�xZ	S)�EUCJPDistributionAnalysisrc�d��t�|��t|_t|_t|_yr8rzrKs �r%r&z"EUCJPDistributionAnalysis.__init__�r{r'rNc�:�|d}|dk\rd|dz
z|dzdz
Sy)Nr�rQrRrr-r=)r$rNr)s   r%r.z#EUCJPDistributionAnalysis.get_order�s4��
��{���4�<�����%����3�d�:�:�r'r>rVrXs@r%r�r��s&���I��%��y�(8�"9��c�r'r�N)!�typingrr�big5freqrrr�	euckrfreqr	r
r�	euctwfreqrr
r�
gb2312freqrrr�jisfreqrrr�	johabfreqrrrHr[rarjrprxr�r=r'r%�<module>r�s���8 ���
��
��
��
��
2�G�G�T� 8��$� 8��$� 8���!9��$�7��(�7��2� 8�r'

Zerion Mini Shell 1.0