bg ddlmZmZddlmZddlmZddlmZddl m Z ddl m Z ddl mZmZgd Z dd eeefd ed e fdZ dd eeefded ed ee fdZdS))ListUnion)CharSetGroupProber) CharSetProber) InputState) ResultDict)UniversalDetector)VERSION __version__)r detect detect_allr r Fbyte_strshould_rename_legacyreturnc$t|tsCt|tstdt |t|}t |}|||S)aV Detect the encoding of the given byte string. :param byte_str: The byte sequence to examine. :type byte_str: ``bytes`` or ``bytearray`` :param should_rename_legacy: Should we rename legacy encodings to their more modern equivalents? :type should_rename_legacy: ``bool`` 1Expected object of type bytes or bytearray, got: r) isinstance bytearraybytes TypeErrortyper feedclose)rrdetectors G/opt/cloudlinux/venv/lib64/python3.11/site-packages/chardet/__init__.pyr r s h * *'(E** TDNNTT X&& 6JKKKH MM( >>  ignore_thresholdct|tsCt|tstdt |t|}t |}||||jtj krYg}g}|j D]Q}t|tr%| d|jD<||R|D]}|s||jkr|jpd}|}|dr"|jr|j||}|r-|j||}||||jdt5|dkrt7|d S|jgS) aD 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`` :param should_rename_legacy: Should we rename legacy encodings to their more modern equivalents? :type should_rename_legacy: ``bool`` rrc3K|]}|VdS)N).0ps r zdetect_all..Ws"99Qq999999rziso-8859)encoding confidencelanguagerc|d S)Nr(r")results rzdetect_all..qsvl7K6Kr)key)rrrrrr rr input_stater HIGH_BYTEcharset_probersrextendprobersappendget_confidenceMINIMUM_THRESHOLD charset_namelower startswith has_win_bytes ISO_WIN_MAPget LEGACY_MAPr)lensortedr+) rrrrresultsr2proberr6lower_charset_names rrr5s8$ h * *'(E** TDNNTT X&& 6JKKKH MM( NNz333$&'). ' 'F&"455 '99&.9999999v&&&&  F 6#8#8#:#:X=W#W#W%28b %1%7%7%9%9"&00<<AW#+#7#;#;*L$$L(#+#6#:#:$**,,l$$L$0&,&;&;&=&=$*O w<rKs<$222222((((((""""""000000)))))))) Q Q QEJE9$%=A2#!&>>E9$%>>> * >>>>>>r