zmc
2023-08-08 e792e9a60d958b93aef96050644f369feb25d61b
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
U
L±d”ã@s2ddlZddlmZddlmZGdd„dƒZdS)éNé)ÚCodingStateMachineDict)Ú MachineStatec@sleZdZdZeddœdd„Zddœdd„Zeed    œd
d „Zedœd d „Z    e
dœdd„Z e e
dœdd„ƒZ dS)ÚCodingStateMachinea–
    A state machine to verify a byte sequence for a particular encoding. For
    each byte the detector receives, it will feed that byte to every active
    state machine available, one byte at a time. The state machine changes its
    state based on its previous state and the byte it receives. There are 3
    states in a state machine that are of interest to an auto-detector:
 
    START state: This is the state to start with, or a legal byte sequence
                 (i.e. a valid code point) for character has been identified.
 
    ME state:  This indicates that the state machine identified a byte sequence
               that is specific to the charset it is designed for and that
               there is no other possible encoding which can contain this byte
               sequence. This will to lead to an immediate positive answer for
               the detector.
 
    ERROR state: This indicates the state machine identified an illegal byte
                 sequence for that encoding. This will lead to an immediate
                 negative answer for this encoding. Detector will exclude this
                 encoding from consideration from here on.
    N)ÚsmÚreturncCs8||_d|_d|_tj|_d|_t t    ¡|_
|  ¡dS)NrT) Ú_modelÚ_curr_byte_posÚ_curr_char_lenrÚSTARTÚ _curr_stateÚactiveÚloggingÚ    getLoggerÚ__name__ÚloggerÚreset)Úselfr©rúQd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\chardet/codingstatemachine.pyÚ__init__9s zCodingStateMachine.__init__)rcCs tj|_dS©N)rr r ©rrrrrBszCodingStateMachine.reset)ÚcrcCsh|jd|}|jtjkr0d|_|jd||_|j|jd|}|jd||_|jd7_|jS)NÚ class_tablerÚchar_len_tableÚ class_factorÚ state_tabler)rr rr r    r
)rrÚ
byte_classÚ
curr_staterrrÚ
next_stateEs zCodingStateMachine.next_statecCs|jSr)r
rrrrÚget_current_charlenRsz&CodingStateMachine.get_current_charlencCs
|jdS)NÚname©rrrrrÚget_coding_state_machineUsz+CodingStateMachine.get_coding_state_machinecCs
|jdS)NÚlanguager#rrrrr%XszCodingStateMachine.language)rÚ
__module__Ú __qualname__Ú__doc__rrrÚintr r!Ústrr$Úpropertyr%rrrrr"s     r)rZcodingstatemachinedictrÚenumsrrrrrrÚ<module>s