관리-도구
편집 파일: __init__.cpython-38.pyc
U ʗRey � @ sL d dl mZ d dlmZ d dlmZmZ dddddgZd d� Zd dd�Z dS )� )� InputState)�UniversalDetector)�VERSION�__version__r �detect� detect_allr r c C sF t | t�s.t | t�s&tdt| �� ���t| �} t� }|�| � |�� S )z� Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` �1Expected object of type bytes or bytearray, got: )� isinstance� bytearray�bytes� TypeError�typer �feed�close)�byte_str�detector� r ��/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/chardet/__init__.pyr s � Fc C s t | t�s.t | t�s&tdt| �� ���t| �} t� }|�| � |�� |jt j k�rg }g }|jD ]0}t|d�r�|� dd� |jD �� qb|�|� qb|D ]^}|s�|�� |jkr�|jp�d}|�� }|�d�r�|jr�|j�||�}|�||�� |jd�� q�t|�dk�rt|d d � d�S |jgS )a� 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`` r �probersc s s | ] }|V qd S )Nr )�.0�pr r r � <genexpr>F s zdetect_all.<locals>.<genexpr>� ziso-8859)�encoding� confidence�language� c S s | d S )Nr r )�resultr r r �<lambda>[ � zdetect_all.<locals>.<lambda>)�key)r r r r r r r r �input_stater � HIGH_BYTE�charset_probers�hasattr�extendr �append�get_confidence�MINIMUM_THRESHOLD�charset_name�lower� startswith� has_win_bytes�ISO_WIN_MAP�getr �len�sortedr )r �ignore_thresholdr �resultsr �proberr) �lower_charset_namer r r r + sD � ���N)F) �enumsr �universaldetectorr �versionr r �__all__r r r r r r �<module> s