o n_ @sDddlmZddlmZddlmZmZgdZddZddZ d S) )UniversalDetector) InputState) __version__VERSION)rdetect detect_allrrcCsFt|tst|tstdt|t|}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_strdetectorr2/usr/lib/python3/dist-packages/chardet/__init__.pyrs    rcCst|tst|tstdt|t|}t}||||j t j krig}|j D],}| |jkrZ|j}|j}|drN|jrN|j||}||| |jdq.t|dkrit|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)resultrrrQs zdetect_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-s:         rN) universaldetectorrenumsrversionrr__all__rrrrrrs