관리-도구
편집 파일: codingstatemachine.cpython-35.pyc
��Re � @ s6 d d l Z d d l m Z Gd d � d e � Z d S)� N� )�MachineStatec @ sd e Z d Z d Z d d � Z d d � Z d d � Z d d � Z d d � Z e d d � � Z d S)�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. c C sD | | _ d | _ d | _ d | _ t j t � | _ | j � d S)Nr ) �_model�_curr_byte_pos�_curr_char_len�_curr_state�logging� getLogger�__name__�logger�reset)�self�sm� r ��/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_vendor/chardet/codingstatemachine.py�__init__7 s zCodingStateMachine.__init__c C s t j | _ d S)N)r �STARTr )r r r r r ? s zCodingStateMachine.resetc C s� | j d | } | j t j k r@ d | _ | j d | | _ | j | j d | } | j d | | _ | j d 7_ | j S)N�class_tabler �char_len_table�class_factor�state_tabler )r r r r r r )r �c� byte_class� curr_stater r r � next_stateB s zCodingStateMachine.next_statec C s | j S)N)r )r r r r �get_current_charlenP s z&CodingStateMachine.get_current_charlenc C s | j d S)N�name)r )r r r r �get_coding_state_machineS s z+CodingStateMachine.get_coding_state_machinec C s | j d S)N�language)r )r r r r r V s zCodingStateMachine.languageN)r � __module__�__qualname__�__doc__r r r r r �propertyr r r r r r ! s r )r �enumsr �objectr r r r r �<module> s