%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/pexpect/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/pexpect/__pycache__/ANSI.cpython-312.pyc

�

��e�/���dZddlmZddlmZddlZd�Zd�Zd�Zd	�Zd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZGd�dej�ZGd �d!e�Zy)"a�This implements an ANSI (VT100) terminal emulator as a subclass of screen.

PEXPECT LICENSE

    This license is approved by the OSI and FSF as GPL-compatible.
        http://opensource.org/licenses/isc-license.txt

    Copyright (c) 2012, Noah Spurrier <noah@noah.org>
    PERMISSION TO USE, COPY, MODIFY, AND/OR DISTRIBUTE THIS SOFTWARE FOR ANY
    PURPOSE WITH OR WITHOUT FEE IS HEREBY GRANTED, PROVIDED THAT THE ABOVE
    COPYRIGHT NOTICE AND THIS PERMISSION NOTICE APPEAR IN ALL COPIES.
    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
    ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
    ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

�)�screen)�FSM�Nc�Z�|jd}|j|j�y�Nr)�memory�write_ch�input_symbol��fsmrs  �./usr/lib/python3/dist-packages/pexpect/ANSI.py�DoEmitr$s#��
�Z�Z��]�F��F�O�O�C�$�$�%�c�N�|jj|j�y�N)r�appendr
)rs r
�
DoStartNumberr)s���J�J���s�'�'�(rc��|jj�}||jz}|jj|�yr)r�popr
r)r�nss  r
�
DoBuildNumberr-s4��	�����	�B�	�c���	�B��J�J���r�rc�D�|jd}|j�yr)r�cursor_backrs  r
�	DoBackOner3���
�Z�Z��]�F��F���rc��t|jj��}|jd}|j|�yr)�intrrr�r�countrs   r
�DoBackr 8�4����
�
��� �!�E�
�Z�Z��]�F��F����rc�D�|jd}|j�yr)r�cursor_downrs  r
�	DoDownOner$>rrc��t|jj��}|jd}|j|�yr)rrrr#rs   r
�DoDownr&Cr!rc�D�|jd}|j�yr)r�cursor_forwardrs  r
�DoForwardOner)Is��
�Z�Z��]�F��F���rc��t|jj��}|jd}|j|�yr)rrrr(rs   r
�	DoForwardr+Ns4����
�
��� �!�E�
�Z�Z��]�F��F���5�!rc�D�|jd}|j�yr)r�cursor_up_reversers  r
�DoUpReverser.T���
�Z�Z��]�F��F���rc�D�|jd}|j�yr)r�	cursor_uprs  r
�DoUpOner2Ys��
�Z�Z��]�F��F���rc��t|jj��}|jd}|j|�yr)rrrr1rs   r
�DoUpr4^s4����
�
��� �!�E�
�Z�Z��]�F��F���e�rc���t|jj��}t|jj��}|jd}|j||�yr)rrr�cursor_home�r�c�rrs    r
�DoHomer:dsK���C�J�J�N�N���A��C�J�J�N�N���A�
�Z�Z��]�F��F����!�rc�P�d}d}|jd}|j||�y)Nrr)rr6r7s    r
�DoHomeOriginr<ks+��	�A�	�A�
�Z�Z��]�F��F����!�rc�D�|jd}|j�yr)r�
erase_downrs  r
�DoEraseDownr?rs��
�Z�Z��]�F��F���rc���t|jj��}|jd}|dk(r|j�y|dk(r|j�y|dk(r|j
�yy�Nrr�)rrrr>�erase_up�erase_screen�r�argrs   r
�DoEraserGwsf��

�c�j�j�n�n��
�C�
�Z�Z��]�F�
�a�x������	��������	��������
rc�D�|jd}|j�yr)r�erase_end_of_liners  r
�DoEraseEndOfLinerJ�r/rc���t|jj��}|jd}|dk(r|j�y|dk(r|j�y|dk(r|j
�yyrA)rrrrI�erase_start_of_line�
erase_linerEs   r
�DoEraseLinerN�sh��

�c�j�j�n�n��
�C�
�Z�Z��]�F�
�a�x� �� � �"�	���"��"�"�$�	��������
rc�D�|jd}|j�yr)r�
scroll_screenrs  r
�DoEnableScrollrQ�s��
�Z�Z��]�F��F���rc�D�|jd}|j�yr)r�cursor_save_attrsrs  r
�DoCursorSaverT�r/rc�D�|jd}|j�yr)r�cursor_restore_attrsrs  r
�DoCursorRestorerW�s��
�Z�Z��]�F��F���!rc���|jd}t|jj��}t|jj��}|j||�yr)rrr�scroll_screen_rows)rr�r2�r1s    r
�DoScrollRegionr\�sK��
�Z�Z��]�F�	�S�Z�Z�^�^�
�	�B�	�S�Z�Z�^�^�
�	�B��F���r�"�%rc�V�|jd}|jj�}yr)rr)rr�modes   r
�DoModer_�s��
�Z�Z��]�F��:�:�>�>��Drc���|jd}|g|_tdd�}|j|jdz|jzdz�|j�y)Nr�log�a�,�
)r�open�writer
�
current_state�close)rr�fouts   r
�DoLogrj�sT��
�Z�Z��]�F���C�J�����D��J�J�� � �3�&��):�):�:�T�A�B��J�J�Lrc��eZdZdZdd�Zy)�termz�This class is an abstract, generic terminal.
    This does nothing. This is a placeholder that
    provides a common base class for other terminals
    such as an ANSI terminal. c�N�tjj|||g|��i|��yr)r�__init__��selfr9r8�args�kwargss     r
rnz
term.__init__�s"���
�
���t�Q�q�8�$�8��8rN���P)�__name__�
__module__�__qualname__�__doc__rn�rr
rlrl�s��"�
9rrlc�H�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)
�ANSIz�This class implements an ANSI (VT100) terminal.
    It is a stream filter that recognizes ANSI terminal
    escape sequences and maintains the state of a screen object. c�4�tj|||g|��i|��tjd|g�|_|jj	t
d�|jj
dtd�|jjdddd�|jj
dt
d�|jjdddd�|jjdddd�|jjdddd�|jjdddd�|jjd	dtd�|jjd
dtd�|jjddtd�|jjddtd�|jjd
dtd�|jjdddd�|jjdddd�|jj
ddd�|jjdddd�|jjddtd�|jjddtd�|jjddtd�|jjddt d�|jjddt"d�|jjddt$d�|jjddt&d�|jjddt(d�|jjdd|j*d�|jjdddd�|jjt,j.dt0d�|jjt,j.dt2d�|jjddt4d�|jjddt6d�|jjddt8d�|jjddt:d�|jjddt<d�|jjddt>d�|jjddt@d�|jjdd|j*d�|jjd d|jBd�|jjt,j.dt0d!�|jjt,j.d!t2d!�|jjdd!|jDd�|jjd"d!|jDd�|jjd#ddd$�|jj
d$t
d�|jjt,j.d$t0d%�|jjt,j.d%t2d%�|jj
d%t
d�|jjdd%tFd�|jjd&d%tFd�|jjdd%tHd�|jjdd%|j*d�|jjd d%|jBd�|jjd#d%dd'�|jj
d't
d�|jjt,j.d't0d(�|jjt,j.d(t2d(�|jj
d(t
d�|jjdd(|j*d�|jjd d(|jBd�|jjd#d(dd'�y))N�INIT��ESC�(�G0SCS�)�G1SCS�AB012�7�8�M�>�<�=�#�GRAPHICS_POUND�[�ELB�H�D�B�C�A�J�Kr9�m�?�MODECRAP�NUMBER_1�l�q�MODECRAP_NUM�h�;�	SEMICOLON�NUMBER_2�f�SEMICOLON_X�NUMBER_X)%rlrnr�state�set_default_transitionrj�add_transition_anyr�add_transition�add_transition_listrTrWr.r<rr$r)r2r?rJrQ�do_sgr�string�digitsrrr r&r+r4rGrNr_�	do_decsca�do_modecrapr:r\ros     r
rnz
ANSI.__init__�s���
�
�d�1�Q�.��.�v�.��W�W�f�d�V�,��
��
�
�)�)�5�&�9��
�
�%�%�v�v�v�>��
�
�!�!�6�6�4��?��
�
�%�%�u�e�V�<��
�
�!�!�3��t�W�=��
�
�!�!�3��t�W�=��
�
�&�&���$��G��
�
�&�&���$��G��
�
�!�!�3��|�V�D��
�
�!�!�3����G��
�
�!�!�3��{�F�C��
�
�!�!�3��{�F�C��
�
�!�!�3��{�F�C��
�
�!�!�3��t�V�<��
�
�!�!�3��t�5E�F��
�
�%�%�'7��v�F��
�
�!�!�3��t�U�;��
�
�!�!�3��|�V�D��
�
�!�!�3��y�&�A��
�
�!�!�3��y�&�A��
�
�!�!�3��|�V�D��
�
�!�!�3��w��?��
�
�!�!�3��{�F�C��
�
�!�!�3��/?��H��
�
�!�!�3��~�v�F��
�
�!�!�3��t�{�{�F�C��
�
�!�!�3��t�Z�@��
�
�&�&��
�
�u�m�Z�X��
�
�&�&��
�
�z�=�R\�]��
�
�!�!�3�
�F�F�C��
�
�!�!�3�
�F�F�C��
�
�!�!�3�
�I�v�F��
�
�!�!�3�
�D�&�A��
�
�!�!�3�
�G�V�D��
�
�!�!�3�
�K��H��
�
�!�!�3�
�F�F�C�	
�
�
�!�!�3�
�D�K�K��H��
�
�!�!�3�
�D�N�N�F�K�	
�
�
�&�&��
�
�z�=�R`�a��
�
�&�&��
�
�~�}�Vd�e��
�
�!�!�3���8H�8H�&�Q��
�
�!�!�3���8H�8H�&�Q�	
�
�
�!�!�3�
�D�+�F��
�
�%�%�{�E�6�B��
�
�&�&��
�
�{�M�S]�^��
�
�&�&��
�
�z�=�R\�]��
�
�%�%�z�5�&�A��
�
�!�!�3�
�F�F�C��
�
�!�!�3�
�F�F�C��
�
�!�!�3�
�N�F�K�	
�
�
�!�!�3�
�D�K�K��H��
�
�!�!�3�
�D�N�N�F�K��
�
�!�!�3�
�D�-�H�	
�
�
�%�%�}�e�V�D��
�
�&�&��
�
�}�m�U_�`��
�
�&�&��
�
�z�=�R\�]��
�
�%�%�z�5�&�A��
�
�!�!�3�
�D�K�K��H��
�
�!�!�3�
�D�N�N�F�K��
�
�!�!�3�
�D�-�Hrc�|�t|t�r|j|�}|jj	|�y)z4Process a single character. Called by :meth:`write`.N)�
isinstance�bytes�_decoder��process)rpr8s  r
r�zANSI.processs+���a������Q��A��
�
���1�rc�&�|j|�yr)rf)rpr�s  r
�process_listzANSI.process_lists
���
�
�1�
rc�v�t|t�r|j|�}|D]}|j|��y)zaProcess text, writing it to the virtual screen while handling
        ANSI escape codes.
        N)r�r�r�r�)rp�sr8s   r
rfz
ANSI.write#s5���a������Q��A��	�A��L�L��O�	rc��yrrz)rps r
�flushz
ANSI.flush,s��rc��t|t�r|j|�}|d}|dk(r|j�y|dk(r|j	�y|ttj�k(r|j�y|j|j|j|�|j}|j}|j�||jk(ry|j�||jk7r|j|jd�y|j�|j|jd�|j!�yy)z�This puts a character at the current cursor position. The cursor
        position is moved forward with wrap-around, but no scrolling is done if
        the cursor hits the lower-right corner of the screen. r�
Nrdr)r�r�r��cr�crlf�chrr�BSr�put_abs�cur_r�cur_cr(r#r6�	scroll_uprM)rp�ch�old_r�old_cs    r
r	z
ANSI.write_ch/s��
�b�%� ����b�!�B���U��
��;��G�G�I��
��;��I�I�K��
��V�Y�Y�����������T�Z�Z����R�0��
�
���
�
�������D�J�J��������
�
�"�� � �$�*�*�a�0����!�� � �$�*�*�a�0����!�rc�2�|jd}|g|_y)z&Select Graphic Rendition, e.g. color. rN�r�rprrs   r
r�zANSI.do_sgrP������A����X��
rc�2�|jd}|g|_y)z'Select character protection attribute. rNr�r�s   r
r�zANSI.do_decscaUr�rc�2�|jd}|g|_y)z�Handler for [?<number>h and [?<number>l. If anyone
        wanted to actually use these, they'd need to add more states to the
        FSM rather than just improve or override this method. rNr�r�s   r
r�zANSI.do_modecrapZs�����A����X��
rNrs)
rvrwrxryrnr�r�rfr�r	r�r�r�rzrr
r|r|�s9��E�QI�f���
�"�B�
�
rr|)ry�rrr�rrrrr r$r&r)r+r.r2r4r:r<r?rGrJrNrQrTrWr\r_rjrlr|rzrr
�<module>r�s����8��
�
&�
)���
��
��
"��
�
����
	��
	��
�
"�
&���	9�F�M�M�	9�^�D�^r

Zerion Mini Shell 1.0