o
    w¨ÊhÄ  ã                   @  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   úK/var/www/html/env/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+