a
=b @ sD d dl mZ d dlmZ d dlmZmZ g dZdd Zdd Z d S )
)UniversalDetector)
InputState)__version__VERSION)r detect
detect_allr r c C sH t | ts0t | ts(tdt| nt| } 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``
3Expected object of type bytes or bytearray, got: {})
isinstance bytearraybytes TypeErrorformattyper feedclose)byte_strdetector r 4/usr/lib/python3.9/site-packages/chardet/__init__.pyr s
r c C s t | ts0t | ts(tdt| nt| } t }|| | |j t
jkrg }|jD ]X}|
|jkr^|j}|j }|dr|jr|j||}|||
|jd q^t|dkrt|dd dS |jgS )z
Detect all the possible encodings of the given byte string.
:param byte_str: The byte sequence to examine.
:type byte_str: ``bytes`` or ``bytearray``
r ziso-8859)encoding
confidencelanguage c S s
| d S )Nr r )resultr r r