관리-도구
편집 파일: chardistribution.cpython-310.pyc
o ƚRe�$ � @ s� d dl mZmZmZ d dlmZmZmZ d dlm Z m Z mZ d dlm Z mZmZ d dlmZmZmZ G dd� de�ZG dd � d e�ZG d d� de�ZG dd � d e�ZG dd� de�ZG dd� de�ZG dd� 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 @ sL e Zd ZdZdZdZdZdd� Zdd� Zd d � Z dd� Z d d� Zdd� ZdS )�CharDistributionAnalysisi g�G�z��?g{�G�z�?� c C s0 d | _ d | _d | _d | _d | _d | _| �� d S �N)�_char_to_freq_order�_table_size�typical_distribution_ratio�_done�_total_chars�_freq_chars�reset��self� r ��/builddir/build/BUILDROOT/alt-python310-pip-21.3.1-3.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_vendor/chardet/chardistribution.py�__init__. s z!CharDistributionAnalysis.__init__c C s d| _ d| _d| _dS )zreset analyser, clear any stateF� N)r r r r r r r r = s zCharDistributionAnalysis.resetc C sd |dkr | � |�}nd}|dkr,| jd7 _|| jk r.d| j| kr0| jd7 _dS dS dS dS )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 sT | j dks| j| jkr| jS | j | jkr'| j| j | j | j }|| jk r'|S | jS )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 | jkS r )r �ENOUGH_DATA_THRESHOLDr r r r �got_enough_datad s z(CharDistributionAnalysis.got_enough_datac C s dS )Nr"