관리-도구
편집 파일: __init__.cpython-311.pyc
� �܋f� � �� � d dl mZmZ ddlmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZmZ g d �Z ddeeef ded e fd�Z ddeeef deded ee fd�ZdS )� )�List�Union� )�CharSetGroupProber)� CharSetProber)� InputState)� ResultDict)�UniversalDetector)�VERSION�__version__)r �detect� detect_allr r F�byte_str�should_rename_legacy�returnc �$ � t | t � � sCt | t � � st dt | � � � �� � �t | � � } t |�� � }|� | � � |� � � S )aV Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` :param should_rename_legacy: Should we rename legacy encodings to their more modern equivalents? :type should_rename_legacy: ``bool`` �1Expected object of type bytes or bytearray, got: �r )� isinstance� bytearray�bytes� TypeError�typer �feed�close)r r �detectors �G/opt/cloudlinux/venv/lib64/python3.11/site-packages/chardet/__init__.pyr r s� � � �h� �*�*� '��(�E�*�*� ��T�D��N�N�T�T�� � � �X�&�&�� �6J�K�K�K�H��M�M�(�����>�>���� �ignore_thresholdc � � t | t � � sCt | t � � st dt | � � � �� � �t | � � } t |�� � }|� | � � |� � � |j t j k �rYg }g }|j D ]Q}t |t � � r%|� d� |j D � � � � �<|� |� � �R|D ]�}|s|� � � |j k r�|j pd}|� � � }|� d� � r"|j r|j � ||� � }|r-|j � |� � � |� � }|� ||� � � |j d�� � ��t5 |� � dk rt7 |d� � � � S |j gS ) aD Detect all the possible encodings of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` :param ignore_threshold: Include encodings that are below ``UniversalDetector.MINIMUM_THRESHOLD`` in results. :type ignore_threshold: ``bool`` :param should_rename_legacy: Should we rename legacy encodings to their more modern equivalents? :type should_rename_legacy: ``bool`` r r c 3 � K � | ]}|V � �d S )N� )�.0�ps r � <genexpr>zdetect_all.<locals>.<genexpr>W s"