HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/chardet/__pycache__/chardistribution.cpython-312.pyc
�

�H�_�$���ddlmZmZmZddlmZmZmZddlm	Z	m
Z
mZddlm
Z
mZmZddlmZmZmZGd�de�ZGd�d	e�ZGd
�de�ZGd�d
e�ZGd�de�ZGd�de�ZGd�de�Zy)�)�EUCTW_CHAR_TO_FREQ_ORDER�EUCTW_TABLE_SIZE� EUCTW_TYPICAL_DISTRIBUTION_RATIO)�EUCKR_CHAR_TO_FREQ_ORDER�EUCKR_TABLE_SIZE� EUCKR_TYPICAL_DISTRIBUTION_RATIO)�GB2312_CHAR_TO_FREQ_ORDER�GB2312_TABLE_SIZE�!GB2312_TYPICAL_DISTRIBUTION_RATIO)�BIG5_CHAR_TO_FREQ_ORDER�BIG5_TABLE_SIZE�BIG5_TYPICAL_DISTRIBUTION_RATIO)�JIS_CHAR_TO_FREQ_ORDER�JIS_TABLE_SIZE�JIS_TYPICAL_DISTRIBUTION_RATIOc�@�eZdZdZdZdZdZd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�CharDistributionAnalysisig�G�z��?g{�G�z�?�c�x�d|_d|_d|_d|_d|_d|_|j
�y�N)�_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>��$(�� ����
+/��'���
� �������
�
��c�.�d|_d|_d|_y)zreset analyser, clear any stateF�N)rrrrs r rzCharDistributionAnalysis.reset=s����
������r"c���|dk(r|j|�}nd}|dk\rN|xjdz
c_||jkr)d|j|kDr|xjdz
c_yyyy)z"feed a character with known length����r$riN)�	get_orderrrrr)r�char�char_len�orders    r �feedzCharDistributionAnalysis.feedFsu���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$)rr�MINIMUM_DATA_THRESHOLD�SURE_NOr�SURE_YES)r�rs  r �get_confidencez'CharDistributionAnalysis.get_confidenceTs�������!�T�%5�%5��9T�9T�%T��<�<������ 0� 0�0��!�!�d�&7�&7�$�:J�:J�&J��2�2�&3�4�A��4�=�=� ����}�}�r"c�4�|j|jkDSr)r�ENOUGH_DATA_THRESHOLDrs r �got_enough_dataz(CharDistributionAnalysis.got_enough_datads��� � �4�#=�#=�=�=r"c��y)Nr'�)r�byte_strs  r r(z"CharDistributionAnalysis.get_orderis��
r"N)
�__name__�
__module__�__qualname__r4r0r/r.r!rr,r2r5r(r7r"r rr(s6�� ���H��G���
��*�� >�
r"rc�$��eZdZ�fd�Zd�Z�xZS)�EUCTWDistributionAnalysisc�l��tt|��t|_t
|_t|_yr)	�superr=r!rrrrrr�r�	__class__s �r r!z"EUCTWDistributionAnalysis.__init__r�)���
�'��7�9�#;�� �+���*J��'r"c�:�|d}|dk\rd|dz
z|dzdz
Sy)Nr$���^r�r'r7�rr8�
first_chars   r r(z#EUCTWDistributionAnalysis.get_orderx�6��
�a�[�
������d�*�+�h�q�k�9�D�@�@�r"�r9r:r;r!r(�
__classcell__�rAs@r r=r=q����K�	r"r=c�$��eZdZ�fd�Zd�Z�xZS)�EUCKRDistributionAnalysisc�l��tt|��t|_t
|_t|_yr)	r?rOr!rrrrrrr@s �r r!z"EUCKRDistributionAnalysis.__init__�rBr"c�:�|d}|dk\rd|dz
z|dzdz
Sy)Nr$�rErrFr'r7rGs   r r(z#EUCKRDistributionAnalysis.get_order�rIr"rJrLs@r rOrO�rMr"rOc�$��eZdZ�fd�Zd�Z�xZS)�GB2312DistributionAnalysisc�l��tt|��t|_t
|_t|_yr)	r?rTr!r	rr
rrrr@s �r r!z#GB2312DistributionAnalysis.__init__�s)���
�(�$�8�:�#<�� �,���*K��'r"c�H�|d|d}}|dk\r|dk\rd|dz
z|zdz
Sy)Nr$rrRrFrEr'r7�rr8rH�second_chars    r r(z$GB2312DistributionAnalysis.get_order�sA��
#+�1�+�x��{�K�
��$��[�D�%8���d�*�+�k�9�D�@�@�r"rJrLs@r rTrT�s���L�	r"rTc�$��eZdZ�fd�Zd�Z�xZS)�Big5DistributionAnalysisc�l��tt|��t|_t
|_t|_yr)	r?rZr!rrr
rrrr@s �r r!z!Big5DistributionAnalysis.__init__�s)���
�&��6�8�#:�� �*���*I��'r"c�j�|d|d}}|dk\r$|dk\rd|dz
z|zdz
dzSd|dz
z|zdz
Sy)	Nr$r�rF��?�@r'r7rWs    r r(z"Big5DistributionAnalysis.get_order�sa��
#+�1�+�x��{�K�
�����d�"��j�4�/�0�;�>��E��J�J��j�4�/�0�;�>��E�E�r"rJrLs@r rZrZ�s���J�r"rZc�$��eZdZ�fd�Zd�Z�xZS)�SJISDistributionAnalysisc�l��tt|��t|_t
|_t|_yr)	r?rbr!rrrrrrr@s �r r!z!SJISDistributionAnalysis.__init__�s)���
�&��6�8�#9�� �)���*H��'r"c��|d|d}}|dk\r|dkr	d|dz
z}n|dk\r|dkrd|dz
dzz}ny	||zd
z
}|dkDrd	}|S)Nr$r��������r'r`�r7)rr8rHrXr+s     r r(z"SJISDistributionAnalysis.get_order�sz��
#+�1�+�x��{�K�
��$��Z�4�%7��:��,�-�E��D� �z�T�'9��:��,�r�1�2�E����#�d�*������E��r"rJrLs@r rbrb�s���I�r"rbc�$��eZdZ�fd�Zd�Z�xZS)�EUCJPDistributionAnalysisc�l��tt|��t|_t
|_t|_yr)	r?rmr!rrrrrrr@s �r r!z"EUCJPDistributionAnalysis.__init__�s)���
�'��7�9�#9�� �)���*H��'r"c�:�|d}|dk\rd|dz
z|dzdz
Sy)Nr$�rErFrr'r7)rr8r)s   r r(z#EUCJPDistributionAnalysis.get_order�s4��
��{���4�<�����%����3�d�:�:�r"rJrLs@r rmrm�s���I�	r"rmN)�	euctwfreqrrr�	euckrfreqrrr�
gb2312freqr	r
r�big5freqrr
r�jisfreqrrr�objectrr=rOrTrZrbrmr7r"r �<module>rws���8:�:�:�:�<�<�8�8�6�6�F�v�F�R� 8��&� 8��&�!9��&�7��,�7��2� 8�r"