Файловый менеджер - Редактировать - /home/digitalm/venv/lib/python3.7/site-packages/pip/_vendor/chardet/__pycache__/universaldetector.cpython-37.pyc
Назад
B �5�g : � @ s� d Z ddlZddlZddlZddlmZmZmZ ddlm Z ddl mZ ddlm Z mZmZ ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ G dd� d�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)�List�Optional�Union� )�CharSetGroupProber)� CharSetProber)� InputState�LanguageFilter�ProbingState)�EscCharSetProber)�Latin1Prober)�MacRomanProber)�MBCSGroupProber)� ResultDict)�SBCSGroupProber)� UTF1632Proberc @ s� e Zd ZdZdZe�d�Ze�d�Ze�d�Z dddd d ddd d�Z dddddddd�Zej dfeedd�dd�Zeed�dd��Zeed�dd��Zeee d�dd��Zdd�d d!�Zeeef dd"�d#d$�Zed�d%d&�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-13zISO-8859-11ZGB18030�CP949zUTF-16)�asciiz iso-8859-1ztis-620z iso-8859-9�gb2312zeuc-krzutf-16leFN)�lang_filter�should_rename_legacy�returnc C sd d | _ d | _g | _d dd d�| _d| _d| _tj| _d| _ || _ t�t �| _d| _|| _| �� d S )Ng )�encoding� confidence�languageF� )�_esc_charset_prober�_utf1632_prober�_charset_probers�result�done� _got_datar � PURE_ASCII�_input_state� _last_charr �logging� getLogger�__name__�logger�_has_win_bytesr �reset)�selfr r � r- �F/tmp/pip-install-251nq386/pip/pip/_vendor/chardet/universaldetector.py�__init__d s zUniversalDetector.__init__)r c C s | j S )N)r$ )r, r- r- r. �input_state{ s zUniversalDetector.input_statec C s | j S )N)r* )r, r- r- r. � has_win_bytes s zUniversalDetector.has_win_bytesc C s | j S )N)r )r, r- r- r. �charset_probers� s z!UniversalDetector.charset_probersc C sj dddd�| _ d| _d| _d| _tj| _d| _| jr>| j� � | j rN| j � � x| jD ]}|� � qVW 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. Ng )r r r Fr )r r! r"