
    Xh                        d Z ddlmZ ddl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	e
      Z G d de      Z G d de      Zedd       Zy)z
Abstraction of CLI Input.
    )annotations)ABCMetaabstractmethod)contextmanager)CallableContextManager	Generator)KeyPress)Input	PipeInput
DummyInputc                      e Zd ZdZedd       Zedd       Zedd       ZddZddZ	e
edd              Zedd       Zedd	       Zedd
       Zedd       ZddZy)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`.
    c                     y)z;
        Fileno for putting this in an event loop.
        N selfs    M/var/www/html/myenv/lib/python3.12/site-packages/prompt_toolkit/input/base.pyfilenozInput.fileno           c                     y)z@
        Identifier for storing type ahead key presses.
        Nr   r   s    r   typeahead_hashzInput.typeahead_hash#   r   r   c                     y)zT
        Return a list of Key objects which are read/parsed from the input.
        Nr   r   s    r   	read_keyszInput.read_keys)   r   r   c                    g S )zk
        Flush the underlying parser. and return the pending keys.
        (Used for vt100 input.)
        r   r   s    r   
flush_keyszInput.flush_keys/   s	    
 	r   c                     y)z>The event loop can call this when the input has to be flushed.Nr   r   s    r   flushzInput.flush6       r   c                     y)z/Should be true when the input stream is closed.Fr   r   s    r   closedzInput.closed:   s     r   c                     y)zE
        Context manager that turns the input into raw mode.
        Nr   r   s    r   raw_modezInput.raw_mode@   r   r   c                     y)zH
        Context manager that turns the input into cooked mode.
        Nr   r   s    r   cooked_modezInput.cooked_modeF   r   r   c                     y)zj
        Return a context manager that makes this input active in the current
        event loop.
        Nr   r   input_ready_callbacks     r   attachzInput.attachL   r   r   c                     y)z{
        Return a context manager that makes sure that this input is not active
        in the current event loop.
        Nr   r   s    r   detachzInput.detachS   r   r   c                     y)zClose input.Nr   r   s    r   closezInput.closeZ   r   r   Nreturnintr/   strr/   zlist[KeyPress])r/   Noner/   boolr/   ContextManager[None]r(   zCallable[[], None]r/   r8   )__name__
__module____qualname____doc__r   r   r   r   r   r   propertyr!   r#   r%   r)   r+   r-   r   r   r   r   r      s      
  
  
     
  
    r   r   )	metaclassc                  4    e Zd ZdZedd       Zedd       Zy)r   z%
    Abstraction for pipe input.
    c                     y)zFeed byte string into the pipeNr   r   datas     r   
send_byteszPipeInput.send_bytesd   r   r   c                     y)z Feed a text string into the pipeNr   rB   s     r   	send_textzPipeInput.send_texth   r   r   N)rC   bytesr/   r4   )rC   r2   r/   r4   )r:   r;   r<   r=   r   rD   rF   r   r   r   r   r   _   s/     - - / /r   r   c                  Z    e Zd ZdZddZddZddZedd       ZddZ	ddZ
ddZdd	Zy
)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`.
    c                    t         N)NotImplementedErrorr   s    r   r   zDummyInput.filenou   s    !!r   c                    dt        |        S )Nzdummy-)idr   s    r   r   zDummyInput.typeahead_hashx   s    4z""r   c                    g S rJ   r   r   s    r   r   zDummyInput.read_keys{   s    	r   c                     y)NTr   r   s    r   r!   zDummyInput.closed~   s     r   c                    t               S rJ   _dummy_context_managerr   s    r   r#   zDummyInput.raw_mode       %''r   c                    t               S rJ   rQ   r   s    r   r%   zDummyInput.cooked_mode   rS   r   c                $     |        t               S rJ   rQ   r'   s     r   r)   zDummyInput.attach   s     	%''r   c                    t               S rJ   rQ   r   s    r   r+   zDummyInput.detach   rS   r   Nr.   r1   r3   r5   r7   r9   )r:   r;   r<   r=   r   r   r   r>   r!   r#   r%   r)   r+   r   r   r   r   r   m   s>    "#  
((((r   r   c               #     K   d  y wrJ   r   r   r   r   rR   rR      s	     	s   N)r/   zGenerator[None, None, None])r=   
__future__r   abcr   r   
contextlibr   typingr   r   r	   prompt_toolkit.key_bindingr
   __all__r   r   r   rR   r   r   r   <module>r^      sa    # ' % 6 6 /Hg HV/ /(( ((V 
 
r   