o
    �õ±jÜ	  ã                   @  s„   d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 g d¢Z
G dd„ dƒZG d	d
„ d
ed�ZG dd„ deƒZG dd„ deƒZdS )z'
Clipboard for command line interface.
é    )Úannotations)ÚABCMetaÚabstractmethod)ÚCallable)ÚSelectionType)Ú	ClipboardÚClipboardDataÚDummyClipboardÚDynamicClipboardc                   @  s"   e Zd ZdZdejfdd	d
„ZdS )r   z{
    Text on the clipboard.

    :param text: string
    :param type: :class:`~prompt_toolkit.selection.SelectionType`
    Ú ÚtextÚstrÚtyper   ÚreturnÚNonec                 C  s   || _ || _d S ©N)r   r   )Úselfr   r   © r   ú�/root/aizidognhua/tmp/workspace/projects/ec89d86c-575f-41c9-af57-ac45cbdbf775/venv/lib/python3.10/site-packages/prompt_toolkit/clipboard/base.pyÚ__init__   s   
zClipboardData.__init__N)r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú
CHARACTERSr   r   r   r   r   r      s    ÿr   c                   @  s@   e Zd ZdZeddd„ƒZdd
d„Zddd„Zeddd„ƒZdS )r   zš
    Abstract baseclass for clipboards.
    (An implementation can be in memory, it can share the X11 or Windows
    keyboard, or can be persistent.)
    Údatar   r   r   c                 C  ó   dS )ze
        Set data to the clipboard.

        :param data: :class:`~.ClipboardData` instance.
        Nr   ©r   r   r   r   r   Úset_data*   ó    zClipboard.set_datar   r   c                 C  s   |   t|ƒ¡ dS )z?
        Shortcut for setting plain text on clipboard.
        N)r   r   ©r   r   r   r   r   Úset_text2   s   zClipboard.set_textc                 C  r   )z7
        For Emacs mode, rotate the kill ring.
        Nr   ©r   r   r   r   Úrotate8   r   zClipboard.rotatec                 C  r   )z(
        Return clipboard data.
        Nr   r"   r   r   r   Úget_data=   r   zClipboard.get_dataN©r   r   r   r   ©r   r   r   r   ©r   r   ©r   r   )	r   r   r   r   r   r   r!   r#   r$   r   r   r   r   r   #   s    

r   )Ú	metaclassc                   @  s8   e Zd ZdZddd„Zdd
d„Zddd„Zddd„ZdS )r	   zB
    Clipboard implementation that doesn't remember anything.
    r   r   r   r   c                 C  ó   d S r   r   r   r   r   r   r   I   ó   zDummyClipboard.set_datar   r   c                 C  r*   r   r   r    r   r   r   r!   L   r+   zDummyClipboard.set_textc                 C  r*   r   r   r"   r   r   r   r#   O   r+   zDummyClipboard.rotatec                 C  s   t ƒ S r   )r   r"   r   r   r   r$   R   s   zDummyClipboard.get_dataNr%   r&   r'   r(   )r   r   r   r   r   r!   r#   r$   r   r   r   r   r	   D   s    


r	   c                   @  sL   e Zd ZdZddd„Zdd	d
„Zddd„Zddd„Zddd„Zddd„Z	dS )r
   z–
    Clipboard class that can dynamically returns any Clipboard.

    :param get_clipboard: Callable that returns a :class:`.Clipboard` instance.
    Úget_clipboardúCallable[[], Clipboard | None]r   r   c                 C  s
   || _ d S r   )r,   )r   r,   r   r   r   r   ]   s   
zDynamicClipboard.__init__r   c                 C  s   |   ¡ ptƒ S r   )r,   r	   r"   r   r   r   Ú
_clipboard`   s   zDynamicClipboard._clipboardr   r   c                 C  ó   |   ¡  |¡ d S r   )r.   r   r   r   r   r   r   c   ó   zDynamicClipboard.set_datar   r   c                 C  r/   r   )r.   r!   r    r   r   r   r!   f   r0   zDynamicClipboard.set_textc                 C  s   |   ¡  ¡  d S r   )r.   r#   r"   r   r   r   r#   i   s   zDynamicClipboard.rotatec                 C  s   |   ¡  ¡ S r   )r.   r$   r"   r   r   r   r$   l   s   zDynamicClipboard.get_dataN)r,   r-   r   r   )r   r   r%   r&   r'   r(   )
r   r   r   r   r   r.   r   r!   r#   r$   r   r   r   r   r
   V   s    




r
   N)r   Ú
__future__r   Úabcr   r   Úcollections.abcr   Úprompt_toolkit.selectionr   Ú__all__r   r   r	   r
   r   r   r   r   Ú<module>   s    !