R`i
d dl mZmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZ ddl
mZmZ g d Z dd
eeef dede
fd
Z dd
eeef dededee
fdZy) )ListUnion )CharSetGroupProber)
CharSetProber)
InputState)
ResultDict)UniversalDetector)VERSION__version__)r
detect
detect_allr r byte_strshould_rename_legacyreturnc t | t s2t | t st dt | t | } t | }|j
| |j 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 /builddir/build/BUILDROOT/alt-python312-pip-23.3.1-3.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/pip/_vendor/chardet/__init__.pyr
r
sd h *(E*CDNCST
X& 6JKHMM(>> ignore_thresholdc t | t s2t | t st dt | t | } t | }|j
| |j |j t j k( rNg }g }|j D ]F }t |t r#|j d |j D 6|j | H |D ] }|s|j! |j" kD s#|j$ xs d}|j' }|j) d r(|j* r|j, j/ || }|r*|j0 j/ |j' | }|j ||j! |j2 d t5 | dkD rt7 |d S |j8 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 | ] }| y w)N ).0ps r