| Server IP : 162.144.4.212 / Your IP : 216.73.216.108 Web Server : Apache System : Linux gator2125.hostgator.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64 User : cozeellc ( 2980) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/libexec/oracle-cloud-agent/plugins/osms/chardet/ |
Upload File : |
a
i��f� � @ s� d dl mZmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZmZ g d �Zdeeef ee
d�dd
�Zdeeef eeee
d�dd�ZdS )� )�List�Union� )�CharSetGroupProber)�
CharSetProber)�
InputState)�
ResultDict)�UniversalDetector)�VERSION�__version__)r �detect�
detect_allr r
F)�byte_str�should_rename_legacy�returnc C sJ t | t�s.t | t�s&tdt| �� ���t| �} t|d�}|�| � |�� 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 �detector� r �t/sparta/input/_build_configuration/image_build+validate/lib/bmcenv/lib64/python3.9/site-packages/chardet/__init__.pyr s
�
r )r �ignore_thresholdr r c C s8 t | t�s.t | t�s&tdt| �� ���t| �} t|d�}|�| � |�� |jt j
k�r0g }g }|jD ]0}t |t�r�|�
dd� |jD �� qf|�|� qf|D ]t}|s�|�� |jkr�|jp�d}|�� }|�d�r�|jr�|j�||�}|r�|j�|�� |�}|�||�� |jd�� q�t|�dk�r0t|d d
� d�S |jgS )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 s s | ]
}|V qd S )Nr )�.0�pr r r � <genexpr>W � zdetect_all.<locals>.<genexpr>� ziso-8859)�encoding�
confidence�languager c S s
| d S )Nr$ r )�resultr r r �<lambda>q r! zdetect_all.<locals>.<lambda>)�key)r r r r r r r r �input_stater � HIGH_BYTE�charset_probersr �extend�probers�append�get_confidence�MINIMUM_THRESHOLD�charset_name�lower�
startswith�
has_win_bytes�ISO_WIN_MAP�get�
LEGACY_MAPr% �len�sortedr&