o
    Df                     @  s   d Z ddlmZ ddlmZmZmZ ddlmZ ddl	m
Z
mZmZ ddlmZ g dZG dd	 d	ed
ZG dd deZG dd deZedddZdS )z
Abstraction of CLI Input.
    )annotations)ABCMetaabstractmethodabstractproperty)contextmanager)CallableContextManager	Generator)KeyPress)Input	PipeInput
DummyInputc                   @  s   e Zd ZdZed"ddZed#ddZed$d
dZd$ddZd%ddZ	e
d&ddZed'ddZed'ddZed(ddZed'ddZd%dd Zd!S ))r   z
    Abstraction for any input.

    An instance of this class can be given to the constructor of a
    :class:`~prompt_toolkit.application.Application` and will also be
    passed to the :class:`~prompt_toolkit.eventloop.base.EventLoop`.
    returnintc                 C     dS )z;
        Fileno for putting this in an event loop.
        N selfr   r   R/home/ubuntu/webapp/venv/lib/python3.10/site-packages/prompt_toolkit/input/base.pyfileno       zInput.filenostrc                 C  r   )z@
        Identifier for storing type ahead key presses.
        Nr   r   r   r   r   typeahead_hash#   r   zInput.typeahead_hashlist[KeyPress]c                 C  r   )zT
        Return a list of Key objects which are read/parsed from the input.
        Nr   r   r   r   r   	read_keys)   r   zInput.read_keysc                 C     g S )zk
        Flush the underlying parser. and return the pending keys.
        (Used for vt100 input.)
        r   r   r   r   r   
flush_keys/   s   zInput.flush_keysNonec                 C  r   )z>The event loop can call this when the input has to be flushed.Nr   r   r   r   r   flush6      zInput.flushboolc                 C  r   )z/Should be true when the input stream is closed.Fr   r   r   r   r   closed:   s   zInput.closedContextManager[None]c                 C  r   )zE
        Context manager that turns the input into raw mode.
        Nr   r   r   r   r   raw_mode?   r   zInput.raw_modec                 C  r   )zH
        Context manager that turns the input into cooked mode.
        Nr   r   r   r   r   cooked_modeE   r   zInput.cooked_modeinput_ready_callbackCallable[[], None]c                 C  r   )zj
        Return a context manager that makes this input active in the current
        event loop.
        Nr   r   r%   r   r   r   attachK   r   zInput.attachc                 C  r   )z{
        Return a context manager that makes sure that this input is not active
        in the current event loop.
        Nr   r   r   r   r   detachR   r   zInput.detachc                 C  r   )zClose input.Nr   r   r   r   r   closeY   r   zInput.closeNr   r   r   r   r   r   )r   r   r   r    r   r"   r%   r&   r   r"   )__name__
__module____qualname____doc__r   r   r   r   r   r   r   r!   r#   r$   r(   r)   r*   r   r   r   r   r      s*    

r   )	metaclassc                   @  s,   e Zd ZdZedddZedd	d
ZdS )r   z%
    Abstraction for pipe input.
    databytesr   r   c                 C  r   )zFeed byte string into the pipeNr   r   r6   r   r   r   
send_bytesc   r   zPipeInput.send_bytesr   c                 C  r   )z Feed a text string into the pipeNr   r8   r   r   r   	send_textg   r   zPipeInput.send_textN)r6   r7   r   r   )r6   r   r   r   )r1   r2   r3   r4   r   r9   r:   r   r   r   r   r   ^   s    r   c                   @  sd   e Zd ZdZdddZdddZdd
dZedddZdddZ	dddZ
d ddZdddZdS )!r   z
    Input for use in a `DummyApplication`

    If used in an actual application, it will make the application render
    itself once and exit immediately, due to an `EOFError`.
    r   r   c                 C  s   t N)NotImplementedErrorr   r   r   r   r   t      zDummyInput.filenor   c                 C  s   dt |  S )Nzdummy-)idr   r   r   r   r   w   s   zDummyInput.typeahead_hashr   c                 C  r   r;   r   r   r   r   r   r   z   r=   zDummyInput.read_keysr    c                 C  r   )NTr   r   r   r   r   r!   }   s   zDummyInput.closedr"   c                 C     t  S r;   _dummy_context_managerr   r   r   r   r#         zDummyInput.raw_modec                 C  r?   r;   r@   r   r   r   r   r$      rB   zDummyInput.cooked_moder%   r&   c                 C  s   |  t  S r;   r@   r'   r   r   r   r(      s   zDummyInput.attachc                 C  r?   r;   r@   r   r   r   r   r)      rB   zDummyInput.detachNr+   r,   r-   r.   r/   r0   )r1   r2   r3   r4   r   r   r   propertyr!   r#   r$   r(   r)   r   r   r   r   r   l   s    






r   r   Generator[None, None, None]c                   c  s    d V  d S r;   r   r   r   r   r   rA      s   
rA   N)r   rD   )r4   
__future__r   abcr   r   r   
contextlibr   typingr   r   r	   prompt_toolkit.key_bindingr
   __all__r   r   r   rA   r   r   r   r   <module>   s    J+