관리-도구
편집 파일: universaldetector.cpython-311.pyc
� �Re�0 � � � d Z ddlZddlZddlZddlmZ ddlmZmZm Z ddl mZ ddlm Z ddlmZ dd lmZ G d � de� � ZdS )a Module containing the UniversalDetector detector class, which is the primary class a user of ``chardet`` should use. :author: Mark Pilgrim (initial port to Python) :author: Shy Shalom (original C code) :author: Dan Blanchard (major refactoring for 3.0) :author: Ian Cordasco � N� )�CharSetGroupProber)� InputState�LanguageFilter�ProbingState)�EscCharSetProber)�Latin1Prober)�MBCSGroupProber)�SBCSGroupProberc � � e Zd ZdZdZ ej d� � Z ej d� � Z ej d� � Z dddd d ddd d�Z ej fd�Z d� Zd� Zd� ZdS )�UniversalDetectoraq The ``UniversalDetector`` class underlies the ``chardet.detect`` function and coordinates all of the different charset probers. To get a ``dict`` containing an encoding and its confidence, you can simply run: .. code:: u = UniversalDetector() u.feed(some_bytes) u.close() detected = u.result g�������?s [�-�]s (|~{)s [�-�]zWindows-1252zWindows-1250zWindows-1251zWindows-1256zWindows-1253zWindows-1255zWindows-1254zWindows-1257)z iso-8859-1z iso-8859-2z iso-8859-5z iso-8859-6z iso-8859-7z iso-8859-8z iso-8859-9ziso-8859-13c �� � d | _ g | _ d | _ d | _ d | _ d | _ d | _ || _ t j t � � | _ d | _ | � � � d S )N)�_esc_charset_prober�_charset_probers�result�done� _got_data�_input_state� _last_char�lang_filter�logging� getLogger�__name__�logger�_has_win_bytes�reset)�selfr s ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-3.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/chardet/universaldetector.py�__init__zUniversalDetector.__init__Q si � �#'�� � "�������� ���� ������&����'��1�1���"���� � ������ c �� � dddd�| _ d| _ d| _ d| _ t j | _ d| _ | j r| j � � � | j D ]}|� � � �dS )z� Reset the UniversalDetector and all of its probers back to their initial states. This is called by ``__init__``, so you only need to call this directly in between analyses of different documents. N� ��encoding� confidence�languageFr )r r r r r � PURE_ASCIIr r r r r )r �probers r r zUniversalDetector.reset^ s� � � $(�s��M�M����� ����#���&�1�������#� -��$�*�*�,�,�,��+� � �F��L�L�N�N�N�N� � r c � � | j rdS t |� � sdS t |t � � st |� � }| j s�|� t j � � rdddd�| _ n�|� t j t j f� � rdddd�| _ nx|� d� � rdddd�| _ nW|� d � � rd ddd�| _ n6|� t j t j f� � rdddd�| _ d| _ | j d � d| _ dS | j t j k rt| j � |� � rt j | _ nH| j t j k r3| j � | j |z � � rt j | _ |dd� | _ | j t j k r�| j st/ | j � � | _ | j � |� � t4 j k r?| j j | j � � � | j j d�| _ d| _ dS dS | j t j k �r| j sztA | j � � g| _ | j tB j"