U ʗRey@sLddlmZddlmZddlmZmZdddddgZd dZd d dZ d S)) InputState)UniversalDetector)VERSION __version__rdetect detect_allrrcCsFt|ts.t|ts&tdt|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`` 1Expected object of type bytes or bytearray, got: ) isinstance bytearraybytes TypeErrortyperfeedclose)byte_strdetectorr/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_vendor/chardet/__init__.pyrs    FcCst|ts.t|ts&tdt|t|}t}||||jt j krg}g}|j D]0}t |dr| dd|jDqb||qb|D]^}|s||jkr|jpd}|}|dr|jr|j||}||||jdqt|dkrt|d d d S|jgS) a 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`` rproberscss|] }|VqdS)Nr).0prrr Fszdetect_all..ziso-8859)encoding confidencelanguagecSs |d S)Nrr)resultrrr[zdetect_all..)key)r r r r r rrr input_stater HIGH_BYTEcharset_probershasattrextendrappendget_confidenceMINIMUM_THRESHOLD charset_namelower startswith has_win_bytes ISO_WIN_MAPgetrlensortedr)rignore_thresholdrresultsrproberr)lower_charset_namerrrr+sD        N)F) enumsruniversaldetectorrversionrr__all__rrrrrrs