U :a @sJddlmZddlmZddlmZmZdddddgZd dZd dZ d S) )UniversalDetector) InputState) __version__VERSIONrdetect 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_strdetectorrC:\Users\Justin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\chardet/__init__.pyrs   cCst|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 rrrr _input_stater HIGH_BYTE_charset_probersget_confidenceMINIMUM_THRESHOLD charset_namelower startswith_has_win_bytes ISO_WIN_MAPgetappendrlensortedr)rrresultsproberr"lower_charset_namerrrr-s8         N) universaldetectorrenumsrversionrr__all__rrrrrrs