1j
d dl mZmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZmZ g d Z ddeeef ded
e
fdZ ddeeef deded
ee
fdZdS ) )ListUnion )CharSetGroupProber)
CharSetProber)
InputState)
ResultDict)UniversalDetector)VERSION__version__)r
detect
detect_allr r Fbyte_strshould_rename_legacyreturnc $ 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 bytearraybytes TypeErrortyper
feedclose)r r detectors G/opt/cloudlinux/venv/lib64/python3.11/site-packages/chardet/__init__.pyr
r
s h ** '(E** TDNNTT
X&& 6JKKKHMM(>> 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 ).0ps r