o
    ˷e	                     @   s|   d Z ddlmZmZ ddlmZ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.
    )ABCMetaabstractmethod)CallableOptional)SelectionType)	ClipboardClipboardDataDummyClipboardDynamicClipboardc                   @   s.   e Zd ZdZdejfdededdfddZdS )	r   z{
    Text on the clipboard.

    :param text: string
    :param type: :class:`~prompt_toolkit.selection.SelectionType`
     texttypereturnNc                 C   s   || _ || _d S N)r   r   )selfr   r    r   T/var/www/ideatree/venv/lib/python3.10/site-packages/prompt_toolkit/clipboard/base.py__init__   s   
zClipboardData.__init__)__name__
__module____qualname____doc__r   
CHARACTERSstrr   r   r   r   r   r      s    r   c                   @   sT   e Zd ZdZededdfddZdeddfdd	Zdd
dZ	edef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   Nc                 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   c                 C   s   |  t| dS )z?
        Shortcut for setting plain text on clipboard.
        N)r   r   r   r   r   r   r   set_text0   s   zClipboard.set_textc                 C   r   )z7
        For Emacs mode, rotate the kill ring.
        Nr   r   r   r   r   rotate6   r   zClipboard.rotatec                 C   r   )z(
        Return clipboard data.
        Nr   r!   r   r   r   get_data;   r   zClipboard.get_datar   N)r   r   r   r   r   r   r   r   r    r"   r#   r   r   r   r   r   !   s    
r   )	metaclassc                   @   sL   e Zd ZdZdeddfddZdeddfdd	Zdd
dZdefddZ	dS )r	   zB
    Clipboard implementation that doesn't remember anything.
    r   r   Nc                 C      d S r   r   r   r   r   r   r   G      zDummyClipboard.set_datar   c                 C   r&   r   r   r   r   r   r   r    J   r'   zDummyClipboard.set_textc                 C   r&   r   r   r!   r   r   r   r"   M   r'   zDummyClipboard.rotatec                 C   s   t  S r   )r   r!   r   r   r   r#   P   s   zDummyClipboard.get_datar$   )
r   r   r   r   r   r   r   r    r"   r#   r   r   r   r   r	   B   s    
r	   c                   @   sx   e Zd ZdZdeg ee f ddfddZdefddZd	e	ddfd
dZ
deddfddZdddZde	f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_clipboardr   Nc                 C   s
   || _ d S r   )r(   )r   r(   r   r   r   r   [   s   
zDynamicClipboard.__init__c                 C   s   |   pt S r   )r(   r	   r!   r   r   r   
_clipboard^   s   zDynamicClipboard._clipboardr   c                 C      |   | d S r   )r)   r   r   r   r   r   r   a      zDynamicClipboard.set_datar   c                 C   r*   r   )r)   r    r   r   r   r   r    d   r+   zDynamicClipboard.set_textc                 C   s   |     d S r   )r)   r"   r!   r   r   r   r"   g   s   zDynamicClipboard.rotatec                 C   s   |    S r   )r)   r#   r!   r   r   r   r#   j   s   zDynamicClipboard.get_datar$   )r   r   r   r   r   r   r   r   r)   r   r   r   r    r"   r#   r   r   r   r   r
   T   s    
r
   N)r   abcr   r   typingr   r   prompt_toolkit.selectionr   __all__r   r   r	   r
   r   r   r   r   <module>   s    !