
    Q?h                     8    S SK r SSKJr  SSKJr   " S S5      rg)    N   )CodingStateMachineDict)MachineStatec                   z    \ rS rSrSrS\SS4S jrSS jrS\S\4S	 jr	S\4S
 jr
S\4S jr\S\4S j5       rSrg)CodingStateMachine"   aR  
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.
smreturnNc                     Xl         SU l        SU l        [        R                  U l        SU l        [        R                  " [        5      U l
        U R                  5         g )Nr   T)_model_curr_byte_pos_curr_char_lenr   START_curr_stateactivelogging	getLogger__name__loggerreset)selfr	   s     L/var/www/html/env/lib/python3.13/site-packages/chardet/codingstatemachine.py__init__CodingStateMachine.__init__9   sG    '--''1

    c                 .    [         R                  U l        g N)r   r   r   r   s    r   r   CodingStateMachine.resetB   s    '--r   cc                 L   U R                   S   U   nU R                  [        R                  :X  a  SU l        U R                   S   U   U l        U R                  U R                   S   -  U-   nU R                   S   U   U l        U =R                  S-  sl        U R                  $ )Nclass_tabler   char_len_tableclass_factorstate_tabler   )r   r   r   r   r   r   )r   r    
byte_class
curr_states       r   
next_stateCodingStateMachine.next_stateE   s     [[/2
|111"#D"&++.>"?
"KD%%N(CCjP
;;}5jAq r   c                     U R                   $ r   )r   r   s    r   get_current_charlen&CodingStateMachine.get_current_charlenR   s    """r   c                      U R                   S   $ )Nnamer   r   s    r   get_coding_state_machine+CodingStateMachine.get_coding_state_machineU   s    {{6""r   c                      U R                   S   $ )Nlanguager/   r   s    r   r3   CodingStateMachine.languageX   s    {{:&&r   )r   r   r   r   r   r   )r
   N)r   
__module____qualname____firstlineno____doc__r   r   r   intr(   r+   strr0   propertyr3   __static_attributes__ r   r   r   r   "   sf    ,1 d . C  C  #S ### # '# ' 'r   r   )r   codingstatemachinedictr   enumsr   r   r=   r   r   <module>r@      s   8  : 8' 8'r   