%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__/screen.cpython-312.pyc

�

��e�5����dZddlZddlZddlZddlZej
dd��dZdZdZdZ	d	Z
d
ZdZdZ
d
ZdZdZdZdZdZdZdZdZdZej0ddk\ZereZd�ZGd�d�Zy)a�This implements a virtual screen. This is used to support ANSI terminal
emulation. The screen representation and state is implemented in this class.
Most of the methods are inspired by ANSI screen control codes. The
:class:`~pexpect.ANSI.ANSI` class extends this class to add parsing of ANSI
escape codes.

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.

�Nz�pexpect.screen and pexpect.ANSI are deprecated. We recommend using pyte to emulate a terminal screen: https://pypi.python.org/pypi/pyte�)�
stacklevel����	�
���
��������� �c�"�||kr|S||kDr|S|S)z@This returns a number, n constrained to the min and max bounds. �)�n�min�maxs   �0/usr/lib/python3/dist-packages/pexpect/screen.py�	constrainr<s!��	�3�w��
��3�w��
��H�c�@�eZdZdZd0d�Zd�Zd�ZereZneZ	d�Zd�Z
d�Zefd�Z
efd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd1d�Zd2d�Zd2d�Zd2d�Zd2d�Zd�Z d�Z!d�Z"d�Z#d�Z$d �Z%d!�Z&d"�Z'd#�Z(d$�Z)d%�Z*d&�Z+d'�Z,d(�Z-d)�Z.d*�Z/d+�Z0d,�Z1d-�Z2d.�Z3y/)3�screena5This object maintains the state of a virtual text screen as a
    rectangular array. This maintains a virtual cursor position and handles
    scrolling as characters are added. This supports most of the methods needed
    by an ANSI text screen. Row and column indexes are 1-based (not zero-based,
    like arrays).

    Characters are represented internally using unicode. Methods that accept
    input characters, when passed 'bytes' (which in Python 2 is equivalent to
    'str'), convert them from the encoding specified in the 'encoding'
    parameter to the constructor. Methods that return screen contents return
    unicode strings, with the exception of __str__() under Python 2. Passing
    ``encoding=None`` limits the API to only accept unicode input, so passing
    bytes in will raise :exc:`TypeError`.
    c�v�||_||_||_||_|�!t	j
|�|�|_nd|_d|_d|_d|_	d|_
d|_|j|_t|j�D�cgc]}tg|jz��c}|_ycc}w)z8This initializes a blank screen of the given dimensions.N�)�rows�cols�encoding�encoding_errors�codecs�getincrementaldecoder�decoder�cur_r�cur_c�cur_saved_r�cur_saved_c�scroll_row_start�scroll_row_end�range�SPACE�w)�self�r�cr%r&�_s      r�__init__zscreen.__init__Us�����	���	� ��
�.�����A�6�7�7��A�/�R�D�L��D�L���
���
������� !���"�i�i���05�d�i�i�0@�A�1�E�7�T�Y�Y�&�A����As�B6c�f�|j�|jj|�Std��)ztThis converts from the external coding system (as passed to
        the constructor) to the internal one (unicode). zLThis screen was constructed with encoding=None, so it does not handle bytes.)r)�decode�	TypeError)r3�ss  r�_decodezscreen._decodehs5���<�<�#��<�<�&�&�q�)�)��;�<�
<rc�|�dj|jD�cgc]}dj|���c}�Scc}w)z�This returns a printable representation of the screen as a unicode
        string (which, under Python 3.x, is the same as 'str'). The end of each
        screen line is terminated by a newline.�
���joinr2�r3r5s  r�_unicodezscreen._unicodeqs-��
�z�z�$�&�&�:�Q�S�X�X�a�[�:�;�;��:��9c�b�|jxsd}|j�j|d�S)z{This returns a printable representation of the screen. The end of
            each screen line is terminated by a newline. �ascii�replace)r%rC�encode)r3r%s  r�__str__zscreen.__str__}s+���}�}�/��H��=�=�?�)�)�(�I�>�>rc�|�dj|jD�cgc]}dj|���c}�Scc}w)z�This returns a copy of the screen as a unicode string. This is similar to
        __str__/__unicode__ except that lines are not terminated with line
        feeds.r?r@rBs  r�dumpzscreen.dump�s-��
�x�x����8�1�3�8�8�A�;�8�9�9��8rDc���dd|jzzdz}|djt|�jd�D�cgc]
}d|zdz��c}�zdz|zScc}w)z�This returns a copy of the screen as a unicode string with an ASCII
        text box around the screen border. This is similar to
        __str__/__unicode__ except that it adds a box.�+�-z+
r>�|)r$rA�unicode�split)r3�top_bot�lines   r�prettyz
screen.pretty�sa��
��d�i�i��'�&�0��������
�@S�@S�TY�@Z�$[��T�$�Y�t�^�$[�\�\�_d�d�gn�n�n��$[s�A
c��t|t�r|j|�}|jdd|j|j
|�y�Nr")�
isinstance�bytesr<�fill_regionr#r$�r3�chs  r�fillzscreen.fill�s8���b�%� ����b�!�B����!�A�d�i�i��	�	�2�6rc��t|t�r|j|�}t|d|j�}t|d|j�}t|d|j
�}t|d|j
�}||kDr||}}||kDr||}}t
||dz�D])}t
||dz�D]}|j|||���+yrV)rWrXr<rr#r$r0�put_abs)r3�rs�cs�re�cer[r4r5s        rrYzscreen.fill_region�s����b�%� ����b�!�B�
��A�t�y�y�
)��
��A�t�y�y�
)��
��A�t�y�y�
)��
��A�t�y�y�
)��
��7����B�
��7����B���B�q�D�!�	&�A��B��Q��'�
&�����a��"�%�
&�	&rc�<�|j|jd�y)zKThis moves the cursor to the beginning (col 1) of the current row.
        r"N)�cursor_homer*�r3s r�crz	screen.cr�s��	
���$�*�*�a�(rc��|j}|j�||jk(r!|j�|j�yy)z3This moves the cursor down with scrolling.
        N)r*�cursor_down�	scroll_up�
erase_line�r3�old_rs  r�lfz	screen.lf�s>���
�
�������D�J�J���N�N���O�O��rc�D�|j�|j�y)ztThis advances the cursor with CRLF properties.
        The cursor will line wrap and the screen may scroll.
        N)rfrmres r�crlfzscreen.crlf�s��
	
���
����
rc�$�|j�y)z%This is an alias for crlf().
        N)rores r�newlinezscreen.newline�s
��	
�	�	�rc���t|d|j�}t|d|j�}t|t�r|j|�d}n|d}||j|dz
|dz
<y)zScreen array starts at 1 index.r"rN)rr#r$rWrXr<r2)r3r4r5r[s    rr^zscreen.put_abs�sh��
�q�!�T�Y�Y�'���q�!�T�Y�Y�'���b�%� ����b�!�!�$�B��A��B�����q��s��A�a�C�rc��t|t�r|j|�}|j|j|j
|�y)z?This puts a characters at the current cursor position.
        N)rWrXr<r^r*r+rZs  r�putz
screen.put�s4���b�%� ����b�!�B����d�j�j�$�*�*�b�1rc
�L�t|t�r|j|�}t|d|j�}t|d|j
�}t
|j
|d�D](}|j|||j||dz
���*|j|||�y)z�This inserts a character at (r,c). Everything under
        and to the right is shifted right one character.
        The last character of the line is lost.
        r"���N)	rWrXr<rr#r$r0r^�get_abs)r3r4r5r[�cis     r�
insert_abszscreen.insert_abs�s����b�%� ����b�!�B��q�!�T�Y�Y�'���q�!�T�Y�Y�'������A�r�*�	6�B��L�L�!�B����Q�r�!�t� 4�5�	6����a��"�rc��t|t�r|j|�}|j|j|j
|�y�N)rWrXr<ryr*r+rZs  r�insertz
screen.insert�s2���b�%� ����b�!�B�������T�Z�Z��4rc��t|d|j�}t|d|j�}|j|dz
|dz
SrV)rr#r$r2�r3r4r5s   rrwzscreen.get_abs�sA���q�!�T�Y�Y�'���q�!�T�Y�Y�'���v�v�a��c�{�1�Q�3��rc�P�|j|j|j�yr{)rwr*r+res r�getz
screen.get�s�����d�j�j�$�*�*�-rc��t|d|j�}t|d|j�}t|d|j�}t|d|j�}||kDr||}}||kDr||}}g}t||dz�D]@}d}t||dz�D]}|j	||�}	||	z}�|j|��B|S)z>This returns a list of lines representing the region.
        r"r?)rr#r$r0rw�append)
r3r_r`rarb�scr4rSr5r[s
          r�
get_regionzscreen.get_region�s�����A�t�y�y�
)��
��A�t�y�y�
)��
��A�t�y�y�
)��
��A�t�y�y�
)��
��7����B�
��7����B�
����B�q�D�!�	�A��D��B��Q��'�
!���\�\�1�Q�'���b�y��
!�
�I�I�t��	��	rc��t|jd|j�|_t|jd|j�|_y)z6This keeps the cursor within the screen area.
        r"N)rr*r#r+r$res r�cursor_constrainzscreen.cursor_constrains4����
�
�A�t�y�y�9��
���
�
�A�t�y�y�9��
rc�@�||_||_|j�yr{)r*r+r�r~s   rrdzscreen.cursor_homes����
���
���� rc�L�|j|z
|_|j�yr{�r+r��r3�counts  r�cursor_backzscreen.cursor_back����Z�Z�%�'��
���� rc�L�|j|z|_|j�yr{�r*r�r�s  rrhzscreen.cursor_down#r�rc�L�|j|z|_|j�yr{r�r�s  r�cursor_forwardzscreen.cursor_forward(r�rc�L�|j|z
|_|j�yr{r�r�s  r�	cursor_upzscreen.cursor_up-r�rc�|�|j}|j�||jk(r|j�yyr{)r*r�rirks  r�cursor_up_reversezscreen.cursor_up_reverse2s0���
�
�������D�J�J���N�N��rc�(�|j||�y)zIdentical to Cursor Home.N)rdr~s   r�cursor_force_positionzscreen.cursor_force_position9s��	
���!�Q�rc�$�|j�y�zSave current cursor position.N)�cursor_save_attrsres r�cursor_savezscreen.cursor_save>s��	
��� rc�$�|j�y�z-Restores cursor position after a Save Cursor.N)�cursor_restore_attrsres r�
cursor_unsavezscreen.cursor_unsaveCs��	
�!�!�#rc�H�|j|_|j|_yr�)r*r,r+r-res rr�zscreen.cursor_save_attrsHs�� �:�:����:�:��rc�P�|j|j|j�yr�)rdr,r-res rr�zscreen.cursor_restore_attrsNs ��	
���$�*�*�D�,<�,<�=rc��|jdkrd|_|j|jkDr|j|_yy)z6This keeps the scroll region within the screen region.rr"N)r.r/r#res r�scroll_constrainzscreen.scroll_constrainSs=��� � �A�%�$%�D�!�������*�"&�)�)�D��+rc�4�d|_|j|_y)z$Enable scrolling for entire display.r"N)r.r#r/res r�
scroll_screenzscreen.scroll_screen[s��!"���"�i�i��rc�@�||_||_|j�y)z/Enable scrolling from row {start} to row {end}.N)r.r/r�)r3r_ras   r�scroll_screen_rowszscreen.scroll_screen_rowsas ��!#��� ������rc��|jdz
}|jdz
}tj|j||�|j|dz|dzy)zScroll display down one line.r"N�r.r/�copy�deepcopyr2�r3r;�es   r�scroll_downzscreen.scroll_downhsN��
�!�!�A�%�����!�#���-�-����q���4����q��s�1�Q�3�rc��|jdz
}|jdz
}tj|j|dz|dz�|j||y)zScroll display up one line.r"Nr�r�s   rrizscreen.scroll_uppsN��
�!�!�A�%�����!�#���m�m�D�F�F�1�Q�3�q��s�O�4����q��rc�|�|j|j|j|j|j�y)zOErases from the current cursor position to the end of the current
        line.N)rYr*r+r$res r�erase_end_of_linezscreen.erase_end_of_linexs(��	
���$�*�*�d�j�j�$�*�*�d�i�i�Hrc�h�|j|jd|j|j�y)zQErases from the current cursor position to the start of the current
        line.r"N)rYr*r+res r�erase_start_of_linezscreen.erase_start_of_line~s$��	
���$�*�*�a����T�Z�Z�@rc�h�|j|jd|j|j�y)zErases the entire current line.r"N)rYr*r$res rrjzscreen.erase_line�s$��	
���$�*�*�a����T�Y�Y�?rc��|j�|j|jdzd|j|j�y)zQErases the screen from the current line down to the bottom of the
        screen.r"N)r�rYr*r#r$res r�
erase_downzscreen.erase_down�s4��	
���!����$�*�*�q�.�!�T�Y�Y��	�	�Brc�z�|j�|j|jdz
dd|j�y)zLErases the screen from the current line up to the top of the
        screen.r"N)r�rYr*r$res r�erase_upzscreen.erase_up�s0��	
� � �#����$�*�*�Q�,��1�d�i�i�8rc�$�|j�y)z,Erases the screen with the background color.N)r\res r�erase_screenzscreen.erase_screen�s
��	
�	�	�rc��y)z#Sets a tab at the current position.Nrres r�set_tabzscreen.set_tab����	
rc��y)z#Clears tab at the current position.Nrres r�	clear_tabzscreen.clear_tab�r�rc��y)zClears all tabs.Nrres r�clear_all_tabszscreen.clear_all_tabs�r�rN)r�Pzlatin-1rG)r"r")r")4�__name__�
__module__�__qualname__�__doc__r7r<rC�PY3rI�__unicode__rKrTr1r\rYrfrmrorqr^rtryr|rwr�r�r�rdr�rhr�r�r�r�r�r�r�r�r�r�r�r�rir�r�rjr�r�r�r�r�r�rrrr r Fs��
�B�&<�<������	?�:�o��7�-2�&�")����	�2�
�5� �.��*:�!�!�
!�
!�
!�
� �
!�
$�
&�>�
,�(� �5�5�I�A�@�
C�9��

�

�

rr )r�r'r��sys�warnings�warn�NUL�ENQ�BEL�BS�HT�LF�VT�FF�CR�SO�SI�XON�XOFF�CAN�SUB�ESC�DELr1�version_infor��strrPrr rrr�<module>r�s����2��
��
��
�
�3���
������������������������	��������	����
�����a�����G�
�c
�c
r

Zerion Mini Shell 1.0