Hacked By AnonymousFox
�
�܋f� � �@ � d dl Z ddlmZ ddlmZ G d� d� � ZdS )� N� )�CodingStateMachineDict)�MachineStatec �n � e Zd ZdZdeddfd�Zdd�Zdedefd�Zdefd �Z de
fd
�Zede
fd�� � 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.
�sm�returnNc �� � || _ d| _ d| _ t j | _ d| _ t j t � � | _
| � � � d S )Nr T)�_model�_curr_byte_pos�_curr_char_lenr �START�_curr_state�active�logging� getLogger�__name__�logger�reset)�selfr s �Q/opt/cloudlinux/venv/lib64/python3.11/site-packages/chardet/codingstatemachine.py�__init__zCodingStateMachine.__init__9 sN � ����������'�-�������'��1�1����
�
������ c �( � t j | _ d S �N)r r r �r s r r zCodingStateMachine.resetB s � �'�-����r �cc � � | j d | }| j t j k rd| _ | j d | | _ | j | j d z |z }| j d | | _ | xj dz
c_ | j S )N�class_tabler �char_len_table�class_factor�state_tabler )r r r r r r
)r r �
byte_class�
curr_states r �
next_statezCodingStateMachine.next_stateE s� � � �[��/��2�
���|�1�1�1�"#�D��"&�+�.>�"?�
�"K�D���%���N�(C�C�j�P�
��;�}�5�j�A������q� �����r c � � | j S r )r
r s r �get_current_charlenz&CodingStateMachine.get_current_charlenR s � ��"�"r c � � | j d S )N�name�r r s r �get_coding_state_machinez+CodingStateMachine.get_coding_state_machineU s � ��{�6�"�"r c � � | j d S )N�languager* r s r r- zCodingStateMachine.languageX s � ��{�:�&�&r )r N)r �
__module__�__qualname__�__doc__r r r �intr% r'