zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
U
L±d½ã@s¬ddlmZmZddlmZddlmZddlmZddl    m
Z
ddl m Z ddl mZmZd    d
d d d gZdeeefee
dœdd
„Zdeeefeeee
dœdd „ZdS)é)ÚListÚUnioné)ÚCharSetGroupProber)Ú CharSetProber)Ú
InputState)Ú
ResultDict)ÚUniversalDetector)ÚVERSIONÚ __version__r    ÚdetectÚ
detect_allr r
F)Úbyte_strÚshould_rename_legacyÚreturncCsJt|tƒs.t|tƒs&tdt|ƒ›ƒ‚t|ƒ}t|d}| |¡| ¡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Ú    bytearrayÚbytesÚ    TypeErrorÚtyper    ÚfeedÚclose)rrÚdetector©rúGd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\chardet/__init__.pyr s
 
 ÿ
 
)rÚignore_thresholdrrc    Cs8t|tƒs.t|tƒs&tdt|ƒ›ƒ‚t|ƒ}t|d}| |¡| ¡|jt    j
kr0g}g}|j D]0}t|t ƒrŒ|  dd„|jDƒ¡qf| |¡qf|D]t}|s²| ¡|jkrœ|jpºd}| ¡}| d¡râ|jrâ|j ||¡}|rø|j | ¡|¡}| || ¡|jdœ¡qœt|ƒdkr0t|d    d
„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``
    rrcss|]
}|VqdS)Nr)Ú.0ÚprrrÚ    <genexpr>Wszdetect_all.<locals>.<genexpr>Úziso-8859)ÚencodingÚ
confidenceÚlanguagercSs
|d S)Nr#r)ÚresultrrrÚ<lambda>qózdetect_all.<locals>.<lambda>)Úkey)rrrrrr    rrZ input_staterÚ    HIGH_BYTEZcharset_probersrÚextendÚprobersÚappendÚget_confidenceÚMINIMUM_THRESHOLDÚ charset_nameÚlowerÚ
startswithZ has_win_bytesÚ ISO_WIN_MAPÚgetZ
LEGACY_MAPr$ÚlenÚsortedr%)    rrrrÚresultsr+Úproberr/Úlower_charset_namerrrr 5sN
 
 ÿ
 
 
 
 
ÿÿýÿN)F)FF)ÚtypingrrÚcharsetgroupproberrÚ charsetproberrÚenumsrZ
resultdictrÚuniversaldetectorr    Úversionr
r Ú__all__rrÚboolr r rrrrÚ<module>s*     ÿ
þ ý
ü