B
    't\3  ใ               @   sz   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
 ddgZG dd de
eeZG d	d deZed
d ZdS )z
Abstraction of CLI Input.
้    )ฺunicode_literals)ฺABCMetaฺabstractmethodฺabstractproperty)ฺcontextmanager)ฺwith_metaclassฺInputฺ
DummyInputc               @   s   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
dd Zedd Zedd Zedd Zedd Zedd Z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`.
    c             C   s   dS )z;
        Fileno for putting this in an event loop.
        Nฉ )ฺselfr
   r
   ๚8lib/python3.7/site-packages/prompt_toolkit/input/base.pyฺfileno   s    zInput.filenoc             C   s   dS )z@
        Identifier for storing type ahead key presses.
        Nr
   )r   r
   r
   r   ฺtypeahead_hash   s    zInput.typeahead_hashc             C   s   dS )zT
        Return a list of Key objects which are read/parsed from the input.
        Nr
   )r   r
   r
   r   ฺ	read_keys$   s    zInput.read_keysc             C   s   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_keysc             C   s   dS )z@ The event loop can call this when the input has to be flushed. Nr
   )r   r
   r
   r   ฺflush1   s    zInput.flushc             C   s   dS )ze
        `True` if the `Application` can expect to receive a CPR response from
        here.
        Fr
   )r   r
   r
   r   ฺresponds_to_cpr5   s    zInput.responds_to_cprc             C   s   dS )z1 Should be true when the input stream is closed. Fr
   )r   r
   r
   r   ฺclosed=   s    zInput.closedc             C   s   dS )zE
        Context manager that turns the input into raw mode.
        Nr
   )r   r
   r
   r   ฺraw_modeB   s    zInput.raw_modec             C   s   dS )zH
        Context manager that turns the input into cooked mode.
        Nr
   )r   r
   r
   r   ฺcooked_modeH   s    zInput.cooked_modec             C   s   dS )zj
        Return a context manager that makes this input active in the current
        event loop.
        Nr
   )r   ฺinput_ready_callbackr
   r
   r   ฺattachN   s    zInput.attachc             C   s   dS )z{
        Return a context manager that makes sure that this input is not active
        in the current event loop.
        Nr
   )r   r
   r
   r   ฺdetachU   s    zInput.detachc             C   s   dS )z Close input. Nr
   )r   r
   r
   r   ฺclose\   s    zInput.closeN)ฺ__name__ฺ
__module__ฺ__qualname__ฺ__doc__r   r   r   r   r   r   ฺpropertyr   r   r   r   r   r   r   r   r
   r
   r
   r   r      s   c               @   sT   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dS )r	   z/
    Input for use in a `DummyApplication`
    c             C   s   t d S )N)ฺNotImplementedError)r   r
   r
   r   r   e   s    zDummyInput.filenoc             C   s   dt |  S )Nzdummy-%s)ฺid)r   r
   r
   r   r   h   s    zDummyInput.typeahead_hashc             C   s   g S )Nr
   )r   r
   r
   r   r   k   s    zDummyInput.read_keysc             C   s   dS )NTr
   )r   r
   r
   r   r   n   s    zDummyInput.closedc             C   s   t  S )N)ฺ_dummy_context_manager)r   r
   r
   r   r   r   s    zDummyInput.raw_modec             C   s   t  S )N)r!   )r   r
   r
   r   r   u   s    zDummyInput.cooked_modec             C   s   t  S )N)r!   )r   r   r
   r
   r   r   x   s    zDummyInput.attachc             C   s   t  S )N)r!   )r   r
   r
   r   r   {   s    zDummyInput.detachN)r   r   r   r   r   r   r   r   r   r   r   r   r   r
   r
   r
   r   r	   a   s   c               c   s
   d V  d S )Nr
   r
   r
   r
   r   r!      s    r!   N)r   Z
__future__r   ฺabcr   r   r   ฺ
contextlibr   Zsixr   ฺ__all__ฺobjectr   r	   r!   r
   r
   r
   r   ฺ<module>   s   Q