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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
Ë
ê^i)[ãó@—ddlmZddlZddlmZddlmZddlmZm    Z    m
Z
m Z ddl m Z mZmZmZddlmZdd    lmZmZdd
lmZmZmZmZmZmZmZej<d «Zej@«Z!e!jEejFd ««                                    d                                                                                    dd „Z$                                    d                                                                                    dd„Z%                                    d                                                                                    dd„Z&                                    d                                                                                    dd„Z'y)é)Ú annotationsN)ÚPathLike)ÚBinaryIOé)Úcoherence_ratioÚencoding_languagesÚmb_encoding_languagesÚmerge_coherence_ratios)ÚIANA_SUPPORTEDÚTOO_BIG_SEQUENCEÚTOO_SMALL_SEQUENCEÚTRACE)Ú
mess_ratio)Ú CharsetMatchÚCharsetMatches)Úany_specified_encodingÚcut_sequence_chunksÚ    iana_nameÚidentify_sig_or_bomÚ is_cp_similarÚis_multi_byte_encodingÚshould_strip_sig_or_bomÚcharset_normalizerz)%(asctime)s | %(levelname)s | %(message)sc
ó$—t|ttf«s#tdj    t |«««‚|rBt j}
t jt«t jt«t|«} | dk(rqt jd«|r@t jt«t j
xstj «t#t%|dddgd«g«S|Dt j'td    d
j)|««|D cgc]} t+| d«‘Œ}} ng}|Dt j'td d
j)|««|D cgc]} t+| d«‘Œ}} ng}| ||zkr!t j'td ||| «d }| }|d kDr| |z |krt-| |z «}t|«t.k} t|«t0k\}| r*t j'tdj    | ««n+|r)t j'tdj    | ««g}|r t3|«nd}|,|j5|«t j'td|«t7«}g}g}d}d}d}t#«}t#«}t9|«\}}|6|j5|«t j'tdt|«|«|j5d«d|vr|j5d«|t:zD]`}|r||vrŒ |r||vrŒ||vrŒ|j=|«d}||k(}|xr t?|«}|dvr|st j'td|«Œ`|dvr|st j'td|«Œ‚    tA|«}    |r9|dur5tG|dur|dt-d«n|t|«t-d«|¬«ntG|dur|n |t|«d|¬«}d}!|D]}"tM||"«sŒd}!n|!rt j'td|"«Œ"tO|sdn
t|«| t-| |z ««}#|xr|duxrt|«| k}$|$rt j'td|«t-t|#«dz «}%tQ|%d«}%d}&d}'g}(g})    tS|||#||||||«    D]g}*|(j5|*«|)j5tU|*||duxrd t|«cxkxrdknc««|)d |k\r|&d z }&|&|%k\s|sŒb|dusŒgn|'s$|r"|s     |t-d"«djW|d#¬$«|)rtY|)«t|)«z nd}+|+|k\s|&|%k\ro|j5|«t j'td&||&t[|+d'zd(¬)««|    r/|dd|d*d+fvr&|'s$t%||||g||¬,«},||k(r|,}n
|dk(r|,}n|,}Œàt j'td-|t[|+d'zd(¬)««|s t]|«}-n t_|«}-|-r3t j'td.j    |tG|-«««g}.|dk7r8|(D]3}*ta|*||-rd/j)|-«nd«}/|.j5|/«Œ5tc|.«}0|0r*t j'td0j    |0|««t%|||+||0|dus||ddfvr|nd|¬,«}1|j5|1«||ddfvry|+d1krt|+dk(r^t jd2|1jd«|r.t jt«t j
«t#|1g«cS|j5|1«t|«r||||vrvd|vrrd|vrn|jg«}2t jd2|2jd«|r.t jt«t j
«t#|2g«cS||k(sŒ t jd3|«|r.t jt«t j
«t#||g«cSt|«dk(rÆ|s|s|rt j'td4«|r2t jd5|jd«|j5|«nr|r||r|r|jh|jhk7s|'t jd6«|j5|«n(|r&t jd7«|j5|«|r<t jd8|jg«jdt|«d z
«nt jd9«|r.t jt«t j
«|Scc} wcc} w#tBtDf$rt j'td|«YŒôwxYw#tHtJf$rQ} t| tJ«s%t j'td|tG| ««|j5|«Yd} ~ ŒSd} ~ wwxYw#tH$r4} t j'td!|tG| ««|%}&d}'Yd} ~ Œmd} ~ wwxYw#tH$rA} t j'td%|tG| ««|j5|«Yd} ~ Œàd} ~ wwxYw):af
    Given a raw bytes sequence, return the best possibles charset usable to render str objects.
    If there is no results, it is a strong indicator that the source is binary/not text.
    By default, the process will extract 5 blocks of 512o each to assess the mess and coherence of a given sequence.
    And will give up a particular code page after 20% of measured mess. Those criteria are customizable at will.
 
    The preemptive behavior DOES NOT replace the traditional detection workflow, it prioritize a particular code page
    but never take it for granted. Can improve the performance.
 
    You may want to focus your attention to some code page or/and not others, use cp_isolation and cp_exclusion for that
    purpose.
 
    This function will strip the SIG in the payload/sequence every time except on UTF-16, UTF-32.
    By default the library does not setup any handler other than the NullHandler, if you choose to set the 'explain'
    toggle to True it will alter the logger configuration to add a StreamHandler that is suitable for debugging.
    Custom logging format and handler can be set manually.
    z3Expected object of type bytes or bytearray, got: {}rz<Encoding detection on empty bytes, assuming utf_8 intention.Úutf_8gFÚNz`cp_isolation is set. use this flag for debugging purpose. limited list of encoding allowed : %s.z, zacp_exclusion is set. use this flag for debugging purpose. limited list of encoding excluded : %s.z^override steps (%i) and chunk_size (%i) as content does not fit (%i byte(s) given) parameters.rz>Trying to detect encoding from a tiny portion of ({}) byte(s).zIUsing lazy str decoding because the payload is quite large, ({}) byte(s).z@Detected declarative mark in sequence. Priority +1 given for %s.zIDetected a SIG or BOM mark on first %i byte(s). Priority +1 given for %s.Úascii>Úutf_16Úutf_32z\Encoding %s won't be tested as-is because it require a BOM. Will try some sub-encoder LE/BE.>Úutf_7zREncoding %s won't be tested as-is because detection is unreliable without BOM/SIG.z2Encoding %s does not provide an IncrementalDecoderg€„A)Úencodingz9Code page %s does not fit given bytes sequence at ALL. %sTzW%s is deemed too similar to code page %s and was consider unsuited already. Continuing!zpCode page %s is a multi byte encoding table and it appear that at least one character was encoded using n-bytes.éééÿÿÿÿzaLazyStr Loading: After MD chunk decode, code page %s does not fit given bytes sequence at ALL. %sgjè@Ústrict)Úerrorsz^LazyStr Loading: After final lookup, code page %s does not fit given bytes sequence at ALL. %szc%s was excluded because of initial chaos probing. Gave up %i time(s). Computed mean chaos is %f %%.édé)Úndigitsrr)Úpreemptive_declarationz=%s passed initial chaos probing. Mean measured chaos is %f %%z&{} should target any language(s) of {}ú,z We detected language {} using {}皙™™™™¹?z.Encoding detection: %s is most likely the one.zoEncoding detection: %s is most likely the one as we detected a BOM or SIG within the beginning of the sequence.zONothing got out of the detection process. Using ASCII/UTF-8/Specified fallback.z7Encoding detection: %s will be used as a fallback matchz:Encoding detection: utf_8 will be used as a fallback matchz:Encoding detection: ascii will be used as a fallback matchz]Encoding detection: Found %s as plausible (best-candidate) for content. With %i alternatives.z=Encoding detection: Unable to determine any suitable charset.)5Ú
isinstanceÚ    bytearrayÚbytesÚ    TypeErrorÚformatÚtypeÚloggerÚlevelÚ
addHandlerÚexplain_handlerÚsetLevelrÚlenÚdebugÚ removeHandlerÚloggingÚWARNINGrrÚlogÚjoinrÚintr r rÚappendÚsetrr ÚaddrrÚModuleNotFoundErrorÚ ImportErrorÚstrÚUnicodeDecodeErrorÚ LookupErrorrÚrangeÚmaxrrÚdecodeÚsumÚroundrr    rr
r!ÚbestÚ fingerprint)3Ú    sequencesÚstepsÚ
chunk_sizeÚ    thresholdÚ cp_isolationÚ cp_exclusionÚpreemptive_behaviourÚexplainÚlanguage_thresholdÚenable_fallbackÚprevious_logger_levelÚlengthÚcpÚis_too_small_sequenceÚis_too_large_sequenceÚprioritized_encodingsÚspecified_encodingÚtestedÚtested_but_hard_failureÚtested_but_soft_failureÚfallback_asciiÚ fallback_u8Úfallback_specifiedÚresultsÚearly_stop_resultsÚ sig_encodingÚ sig_payloadÚ encoding_ianaÚdecoded_payloadÚbom_or_sig_availableÚstrip_sig_or_bomÚis_multi_byte_decoderÚeÚsimilar_soft_failure_testÚencoding_soft_failedÚr_Úmulti_byte_bonusÚmax_chunk_gave_upÚearly_stop_countÚlazy_str_hard_failureÚ    md_chunksÚ    md_ratiosÚchunkÚmean_mess_ratioÚfallback_entryÚtarget_languagesÚ    cd_ratiosÚchunk_languagesÚcd_ratios_mergedÚ current_matchÚprobable_results3                                                   õiH:\项目\archive\测试组\脚本\Change_password\venv_build\Lib\site-packages\charset_normalizer/api.pyÚ
from_bytesrƒ!sb €ô< i¤)¬UÐ!3Ô 4ÜØ A× HÑ HܐY“ó ó
ð    
ñ Ü%+§\¡\ÐÜ×Ñœ/Ô*܏‰œÔäi“.€Fà ‚{܏ ‰ ÐSÔTÙ Ü ×  Ñ  ¤Ô 1Ü O‰OÐ1ÒD´W·_±_Ô EÜœ|¨I°wÀÀUÈBÐPRÓSÐTÓUÐUàÐ܏
‰
Ü ð 5à I‰IlÓ #ô        
ð 8DÖD°œ     " eÕ,ÐDˆ ÑDàˆ àÐ܏
‰
Ü ð 6à I‰IlÓ #ô        
ð 8DÖD°œ     " eÕ,ÐDˆ ÑDàˆ à *˜uÑ$Ò%܏
‰
Ü Ø lØ Ø Ø ô     
ðˆØˆ
à ˆq‚yV˜e‘^ jÒ0ܘ %™Ó(ˆ
ä"% i£.Ô3EÑ"EÐÜ"% i£.Ô4DÑ"DÐá܏
‰
Ü Ø L× SÑ SØó õ    
ñ
܏
‰
Ü Ø W× ^Ñ ^Øó ô    
ð(*Ðñ.BÔ˜yÔ)ÀtððÐ%Ø×$Ñ$Ð%7Ô8܏
‰
Ü Ø NØ ô    
ô “u€FØ)+ÐØ)+Ðà*.€NØ'+€KØ.2Ðä,Ó.€Gä)7Ó)9Ðä 3°IÓ >Ñ€L+àÐØ×$Ñ$ \Ô2܏
‰
Ü Ø WÜ  Ó Ø ô        
ð× Ñ  Ô)àÐ+Ñ+Ø×$Ñ$ WÔ-à.´Ñ?ó<ˆ Ù ˜M°Ñ=Ø á ˜M¨\Ñ9Ø à ˜FÑ "Ø à
‰
=Ô!à&*ˆØ%1°]Ñ%BÐØ!5ò"
Ô:QØ ó;
Ðð Ð0Ñ 0Ñ9MÜ J‰JÜØnØô ð
Ø ˜IÑ %Ñ.BÜ J‰JÜØdØô ð
ð    Ü*@ÀÓ*OÐ !ð    Ù$Ð)>À%Ñ)GÜð,¨uÑ4ð" +¤C¨£IÑ.à&¤s¨;Ó'7¼#¸d»)ÐDà*ö ô#&ð,¨uÑ4ñ"à&¤s¨;Ó'7Ð'9Ð:à*ô #ð&+0Ð!à$;ò    Ð  Ü˜]Ð,@ÕAØ,0Ð)Ùð    ñ
%Ü J‰JÜØiØØ$ô     ñ ä Ù)‰A¬s°;Ó/?Ø Ü ˜‘Ó ó
ˆð "ò .Ø tÐ+ò .äOÓ$ vÑ-ð    ñ Ü J‰JÜð-àô     ô"%¤S¨£W¨q¡[Ó!1ÐäР1°1Ó5ÐØ !ÐØ %Ðà!ˆ    Øˆ    ð'    )Ü,ØØØØØ$Ø ØØ%Øó
ò ð× Ñ  Ô'à× Ñ ÜØØ!Ø 4˜ÒG¨A´°\Ó1BÖ,GÀaÔ,Góôð˜R‘= IÒ-Ø$¨Ñ)Ð$à$Ð(9Ò9Ú(Ð-=ÀÒ-Fáð7 ñV&Ù%Ù)ð
Øœ#˜d›)˜+Ð&×-Ñ-¨mÀHÐ-ÔMñEN¤ Y£´#°i³.Ò!@ÐSVˆØ ˜iÒ 'Ð+;Ð?PÒ+PØ #× *Ñ *¨=Ô 9Ü J‰JÜð0àØ Üo¨Ñ+°QÔ7ô  ñ Ø!ؘWÐ&8¸(ÀHÐMñNá-ä!-ØØ!ØØ(ØØ#Ø+=ô"ð!Ð$6Ò6Ø)7Ñ&Ø" gÒ-Ø%3‘Nà"0KÙ ä
‰
Ü Ø KØ Ü / CÑ'°Ô 3ô        
ñ%Ü*<¸]Ó*KÑ ä4°]ÓCÐ á Ü J‰JÜØ8×?Ñ?Ø!¤3Ð'7Ó#8óô ðˆ    ð ˜GÒ #Ø"ò 2Ü"1ØØ&Ù2BC—H‘HÐ-Ô.Èó#ð × Ñ  Õ1ð 2ô2°)Ó<Ðá Ü J‰JÜØ2×9Ñ9Ø$ móô ô%Ø Ø Ø Ø  Ø ð*¨UÑ2Ø$Ð);¸WÀgÐ(NÑNñ ð
à#5ô
ˆ ð"    ‰}Ô%ð Ð0°'¸7ÐCÑ CØ #Ò%ð #Ò%Ü— ‘ ØDØ!×*Ñ*ôñÜ×(Ñ(¬Ô9Ü—O‘OÐ$9Ô:Ü% } oÓ6Ò6à × %Ñ % mÔ 4ô Ð"Ô #Ø#Ð+Ð/AÀVÑ/Kؘ6Ñ!ؘ6Ñ!à,>×,CÑ,CÓ,EˆOÜ L‰LØ@Ø×(Ñ(ô ñÜ×$Ñ$¤_Ô5Ü—‘Р5Ô6ä! ?Ð"3Ó4Ò 4à ˜LÔ (Ü L‰Lð1àô ñ
Ü×$Ñ$¤_Ô5Ü—‘Р5Ô6Ü! 7¨=Ñ#9Ð":Ó;Ò ;ð    <ôB
 ˆ7ƒ|qÒÙ ™.Ñ,>Ü J‰JÜØaô ñ
Ü L‰LØIØ"×+Ñ+ô ð N‰NÐ-Õ .á ˜^Ð3áÙ"Ø×+Ñ+¨~×/IÑ/IÒIàÐ'ä L‰LÐUÔ VØ N‰N˜;Õ 'Ù Ü L‰LÐUÔ VØ N‰N˜>Ô *á܏ ‰ Ø kØ L‰L‹N× #Ñ #Ü ‹L˜1Ñ õ    
ô      ‰ ÐTÔUáÜ×Ñœ_Ô-܏‰Ð-Ô.à €NùòGEùòEøôb$¤[Ð1ò    Ü J‰JÜØDØô ò
ð     ûô6#¤KÐ0ò        Ü˜a¤Ô-Ü—
‘
ÜØOØ!ܘ“Fô    ð $× *Ñ *¨=Ô 9Ý ûð        ûôl ò
    )ô J‰JÜØsØÜA“ô     ð  1Ð Ø$(Ö !ûð
    )ûô*&ò Ü—
‘
ÜØtØ!ܘ“Fô    ð (×.Ñ.¨}Ô=Ýûð úsuÄ/g'Å7g,Î- g1Î9Ah"ÓA4jÕjÕ jÕkç1*hèhè"jè1Ai=é=jê    kê)j=ê=kë    lë6l
lc
óF—t|j«|||||||||    «
S)z†
    Same thing than the function from_bytes but using a file pointer that is already ready.
    Will not close the file pointer.
    )rƒÚread)
ÚfprPrQrRrSrTrUrVrWrXs
          r‚Úfrom_fpr‡!s5€ô  Ø
‰‹    Ø ØØØØØØØØó ð óc
ón—t|d«5}
t|
|||||||||    «
cddd«S#1swYyxYw)z•
    Same thing than the function from_bytes but with one extra step. Opening and reading given file path in binary mode.
    Can raise IOError.
    ÚrbN)Úopenr‡) ÚpathrPrQrRrSrTrUrVrWrXr†s            r‚Ú    from_pathr?sK€ô 
ˆdDÓ    ð 
˜RÜØ Ø Ø Ø Ø Ø Ø  Ø Ø Ø ó 
÷ 
÷ 
ò 
ús+«4c
óê—t|ttf«rt||||||||||    ¬«
}
|
St|tt
f«rt ||||||||||    ¬«
}
|
St||||||||||    ¬«
}
|
S)a)
    Detect if the given input (file, bytes, or path) points to a binary file. aka. not a string.
    Based on the same main heuristic algorithms and default kwargs at the sole exception that fallbacks match
    are disabled to be stricter around ASCII-compatible but unlikely to be a string.
    )    rPrQrRrSrTrUrVrWrX)r-rErrr/r.rƒr‡) Úfp_or_path_or_payloadrPrQrRrSrTrUrVrWrXÚguessess            r‚Ú    is_binaryr‘^sǀô"Ð'¬#¬x¨Ô9ÜØ !ØØ!ØØ%Ø%Ø!5ØØ1Ø+ô 
ˆðZˆ;ÐôC
Øä Ü ð    
ô
ôØ !ØØ!ØØ%Ø%Ø!5ØØ1Ø+ô 
ˆð4ˆ;ÐôØ !ØØ!ØØ%Ø%Ø!5ØØ1Ø+ô 
ˆðˆ;Ðrˆ)    éé皙™™™™É?NNTFr,T)rOzbytes | bytearrayrPr?rQr?rRÚfloatrSúlist[str] | NonerTr–rUÚboolrVr—rWr•rXr—Úreturnr)r†rrPr?rQr?rRr•rSr–rTr–rUr—rVr—rWr•rXr—r˜r)rŒzstr | bytes | PathLikerPr?rQr?rRr•rSr–rTr–rUr—rVr—rWr•rXr—r˜r)    r’r“r”NNTFr,F)rz!PathLike | str | BinaryIO | bytesrPr?rQr?rRr•rSr–rTr–rUr—rVr—rWr•rXr—r˜r—)(Ú
__future__rr;ÚosrÚtypingrÚcdrrr    r
Úconstantr r r rÚmdrÚmodelsrrÚutilsrrrrrrrÚ    getLoggerr3Ú StreamHandlerr6Ú setFormatterÚ    Formatterrƒr‡rr‘©rˆr‚ú<module>r¦s¼ðÝ"ãÝÝ÷ó÷ RÓQÝß0÷÷ñð
ˆ×    Ñ    Ð/Ó    0€Ø''×'Ñ'Ó)€Ø×ÑØ€G×ÑÐAÓBôðØØØ%)Ø%)Ø!%ØØ #Ø ð}Ø ð}à ð}ðð}ðð    }ð
#ð }ð #ð }ðð}ðð}ðð}ðð}ðó}ðDØØØ%)Ø%)Ø!%ØØ #Ø ðØðà ððððð    ð
#ð ð #ð ðððððððððóð@ØØØ%)Ø%)Ø!%ØØ #Ø ð
Ø
 ð
à ð
ðð
ðð    
ð
#ð 
ð #ð 
ðð
ðð
ðð
ðð
ðó
ðBØØØ%)Ø%)Ø!%ØØ #Ø!ð?Ø<ð?à ð?ðð?ðð    ?ð
#ð ?ð #ð ?ðð?ðð?ðð?ðð?ð
ô?rˆ