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-38.pyc
U

�H�_�$�@s�ddlmZmZmZddlmZmZmZddlm	Z	m
Z
mZddlm
Z
mZmZddlmZmZmZGdd�de�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�)�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@sLeZdZdZdZdZdZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�ZdS)�CharDistributionAnalysisig�G�z��?g{�G�z�?�cCs0d|_d|_d|_d|_d|_d|_|��dS�N)�_char_to_freq_order�_table_size�typical_distribution_ratio�_done�_total_chars�_freq_chars�reset��self�r�:/usr/lib/python3/dist-packages/chardet/chardistribution.py�__init__.sz!CharDistributionAnalysis.__init__cCsd|_d|_d|_dS)zreset analyser, clear any stateF�N)rrrrrrrr=szCharDistributionAnalysis.resetcCsX|dkr|�|�}nd}|dkrT|jd7_||jkrTd|j|krT|jd7_dS)z"feed a character with known length����r riN)�	get_orderrrrr)r�char�char_len�orderrrr�feedFs
zCharDistributionAnalysis.feedcCsT|jdks|j|jkr|jS|j|jkrN|j|j|j|j}||jkrN|S|jS)z(return confidence based on existing datar )rr�MINIMUM_DATA_THRESHOLD�SURE_NOr�SURE_YES)r�rrrr�get_confidenceTs�
z'CharDistributionAnalysis.get_confidencecCs|j|jkSr)r�ENOUGH_DATA_THRESHOLDrrrr�got_enough_datadsz(CharDistributionAnalysis.got_enough_datacCsdS)Nr"r)r�byte_strrrrr#isz"CharDistributionAnalysis.get_orderN)
�__name__�
__module__�__qualname__r-r*r)r(rrr'r,r.r#rrrrr(s	rcs$eZdZ�fdd�Zdd�Z�ZS)�EUCTWDistributionAnalysiscs$tt|���t|_t|_t|_dSr)	�superr3rrrrrrrr��	__class__rrrrsz"EUCTWDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr ���^r�r"r�rr/�
first_charrrrr#xsz#EUCTWDistributionAnalysis.get_order�r0r1r2rr#�
__classcell__rrr5rr3qsr3cs$eZdZ�fdd�Zdd�Z�ZS)�EUCKRDistributionAnalysiscs$tt|���t|_t|_t|_dSr)	r4r>rrrrrrrrr5rrr�sz"EUCKRDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr �r8rr9r"rr:rrrr#�sz#EUCKRDistributionAnalysis.get_orderr<rrr5rr>�sr>cs$eZdZ�fdd�Zdd�Z�ZS)�GB2312DistributionAnalysiscs$tt|���t|_t|_t|_dSr)	r4r@rrrr	rr
rrr5rrr�sz#GB2312DistributionAnalysis.__init__cCs>|d|d}}|dkr6|dkr6d|d|dSdSdS)Nr rr?r9r8r"r�rr/r;�second_charrrrr#�sz$GB2312DistributionAnalysis.get_orderr<rrr5rr@�sr@cs$eZdZ�fdd�Zdd�Z�ZS)�Big5DistributionAnalysiscs$tt|���t|_t|_t|_dSr)	r4rCrrrrrr
rrr5rrr�sz!Big5DistributionAnalysis.__init__cCsX|d|d}}|dkrP|dkr:d|d|ddSd|d|dSndSdS)	Nr r�r9��?�@r"rrArrrr#�sz"Big5DistributionAnalysis.get_orderr<rrr5rrC�srCcs$eZdZ�fdd�Zdd�Z�ZS)�SJISDistributionAnalysiscs$tt|���t|_t|_t|_dSr)	r4rHrrrrrrrrr5rrr�sz!SJISDistributionAnalysis.__init__cCsr|d|d}}|dkr0|dkr0d|d}n&|dkrR|dkrRd|dd}nd	S||d
}|dkrnd	}|S)Nr r��������r"rG�r)rr/r;rBr&rrrr#�sz"SJISDistributionAnalysis.get_orderr<rrr5rrH�srHcs$eZdZ�fdd�Zdd�Z�ZS)�EUCJPDistributionAnalysiscs$tt|���t|_t|_t|_dSr)	r4rPrrrrrrrrr5rrr�sz"EUCJPDistributionAnalysis.__init__cCs0|d}|dkr(d|d|ddSdSdS)Nr �r8r9rr"r)rr/r$rrrr#�sz#EUCJPDistributionAnalysis.get_orderr<rrr5rrP�srPN)Z	euctwfreqrrrZ	euckrfreqrrrZ
gb2312freqrr	r
Zbig5freqrrr
Zjisfreqrrr�objectrr3r>r@rCrHrPrrrr�<module>sI