/usr/lib/python3/dist-packages/prompt_toolkit/clipboard/base.py is in python3-prompt-toolkit 1.0.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | """
Clipboard for command line interface.
"""
from __future__ import unicode_literals
from abc import ABCMeta, abstractmethod
from six import with_metaclass
import six
from prompt_toolkit.selection import SelectionType
__all__ = (
'Clipboard',
'ClipboardData',
)
class ClipboardData(object):
"""
Text on the clipboard.
:param text: string
:param type: :class:`~prompt_toolkit.selection.SelectionType`
"""
def __init__(self, text='', type=SelectionType.CHARACTERS):
assert isinstance(text, six.string_types)
assert type in (SelectionType.CHARACTERS, SelectionType.LINES, SelectionType.BLOCK)
self.text = text
self.type = type
class Clipboard(with_metaclass(ABCMeta, object)):
"""
Abstract baseclass for clipboards.
(An implementation can be in memory, it can share the X11 or Windows
keyboard, or can be persistent.)
"""
@abstractmethod
def set_data(self, data):
"""
Set data to the clipboard.
:param data: :class:`~.ClipboardData` instance.
"""
def set_text(self, text): # Not abstract.
"""
Shortcut for setting plain text on clipboard.
"""
assert isinstance(text, six.string_types)
self.set_data(ClipboardData(text))
@abstractmethod
def get_data(self):
"""
Return clipboard data.
"""
|