a =b @sDddlmZddlmZddlmZmZgdZddZddZ d S) )UniversalDetector) InputState) __version__VERSION)rdetect detect_allrrcCsHt|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 TypeErrorformattyperfeedclose)byte_strdetectorr4/usr/lib/python3.9/site-packages/chardet/__init__.pyrs   rcCst|ts0t|ts(tdt|nt|}t}||||j t j krg}|j D]X}| |jkr^|j}|j}|dr|jr|j||}||| |jdq^t|dkrt|dddS|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`` rziso-8859)encoding confidencelanguagecSs |d S)Nrr)resultrrrQzdetect_all..)key)r r r r r rrrrZ _input_staterZ HIGH_BYTEZ_charset_probersZget_confidenceZMINIMUM_THRESHOLD charset_namelower startswithZ_has_win_bytesZ ISO_WIN_MAPgetappendrlensortedr)rrresultsZproberrZlower_charset_namerrrr-s8         rN) ZuniversaldetectorrZenumsrversionrr__all__rrrrrrs