관리-도구
편집 파일: chardistribution.cpython-35.pyc
��Re�$ � @ s* d d l m Z m Z m Z d d l m Z m Z m Z d d l m Z m Z m Z d d l m Z m Z m Z d d l m Z m Z m Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z d S)� )�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 @ sp e Z d Z d Z d Z d Z d Z d d � Z d d � Z d d � Z d d � Z d d � Z d d � Z d S)�CharDistributionAnalysisi g�G�z��?g{�G�z�?� c C sD d | _ d | _ d | _ d | _ d | _ d | _ | j � d S)N)�_char_to_freq_order�_table_size�typical_distribution_ratio�_done�_total_chars�_freq_chars�reset)�self� r ��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/chardet/chardistribution.py�__init__. s z!CharDistributionAnalysis.__init__c C s d | _ d | _ d | _ d S)zreset analyser, clear any stateF� N)r r r )r r r r r = s zCharDistributionAnalysis.resetc C st | d k r | j | � } n d } | d k rp | j d 7_ | | j k rp d | j | k rp | j d 7_ d S)z"feed a character with known length� r r i N���)� get_orderr r r r )r �char�char_len�orderr r r �feedF s zCharDistributionAnalysis.feedc C sr | j d k s! | j | j k r( | j S| j | j k rk | j | j | j | j } | | j k rk | S| j S)z(return confidence based on existing datar )r r �MINIMUM_DATA_THRESHOLD�SURE_NOr �SURE_YES)r �rr r r �get_confidenceT s !z'CharDistributionAnalysis.get_confidencec C s | j | j k S)N)r �ENOUGH_DATA_THRESHOLD)r r r r �got_enough_datad s z(CharDistributionAnalysis.got_enough_datac C s d S)Nr r r )r �byte_strr r r r! i s z"CharDistributionAnalysis.get_orderN) �__name__� __module__�__qualname__r+ r( r'