Turn text object into `ClipboardData` instance.
425439
def cut(self, buffer):
        
        from_, to = self.operator_range(buffer.document)

        from_ += buffer.cursor_position
        to += buffer.cursor_position
        to -= 1  # SelectionState does not include the end position, `operator_range` does.

        document = Document(buffer.text, to, SelectionState(
            original_cursor_position=from_, type=self.selection_type))

        new_document, clipboard_data = document.cut_selection()
        return new_document, clipboard_data
1052679
def set_text(self, text):  # Not abstract.
        
        assert isinstance(text, six.string_types)
        self.set_data(ClipboardData(text))
1058421
def paste_clipboard_data(self, data, paste_mode=PasteMode.EMACS, count=1):
        
        assert isinstance(data, ClipboardData)
        assert paste_mode in (PasteMode.VI_BEFORE, PasteMode.VI_AFTER, PasteMode.EMACS)

        before = (paste_mode == PasteMode.VI_BEFORE)
        after = (paste_mode == PasteMode.VI_AFTER)

        if data.type == SelectionType.CHARACTERS:
            if after:
                new_text = (self.text[:self.cursor_position + 1] + data.text * count +
                            self.text[self.cursor_position + 1:])
            else:
                new_text = self.text_before_cursor + data.text * count + self.text_after_cursor

            new_cursor_position = self.cursor_position + len(data.text) * count
            if before:
                new_cursor_position -= 1

        elif data.type == SelectionType.LINES:
            l = self.cursor_position_row
            if before:
                lines = self.lines[:l] + [data.text] * count + self.lines[l:]
                new_text = '\n'.join(lines)
                new_cursor_position = len(''.join(self.lines[:l])) + l
            else:
                lines = self.lines[:l + 1] + [data.text] * count + self.lines[l + 1:]
                new_cursor_position = len(''.join(self.lines[:l + 1])) + l + 1
                new_text = '\n'.join(lines)

        elif data.type == SelectionType.BLOCK:
            lines = self.lines[:]
            start_line = self.cursor_position_row
            start_column = self.cursor_position_col + (0 if before else 1)

            for i, line in enumerate(data.text.split('\n')):
                index = i + start_line
                if index >= len(lines):
                    lines.append('')

                lines[index] = lines[index].ljust(start_column)
                lines[index] = lines[index][:start_column] + line * count + lines[index][start_column:]

            new_text = '\n'.join(lines)
            new_cursor_position = self.cursor_position + (0 if before else 1)

        return Document(text=new_text, cursor_position=new_cursor_position)
795797
def paste( self ):
        
        text = nativestring(QApplication.clipboard().text())
        for tag in text.split(','):
            tag = tag.strip()
            if ( self.isTagValid(tag) ):
                self.addTag(tag)
1111250
public static void writeToClipboard(String text) {
        Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        Transferable transferableText = new StringSelection(text);
        systemClipboard.setContents(transferableText, null);
    }
342005
def paste(self,e):
        """ #(Control-v)
        if self.enable_win32_clipboard:
                txt=clipboard.get_clipboard_text_and_convert(False)
                txt=txt.split("\n")[0].strip("\r").strip("\n")
                log("paste: >%s<"%map(ord,txt))
                self.insert_text(txt)
        self.finalize()
1106619
def create_clipboard(self, text, selection=Gdk.SELECTION_CLIPBOARD):
        
        clipboard = Gtk.Clipboard.get(selection)
        clipboard.set_text('\n'.join(text), -1)
        clipboard.store()
        return clipboard
598266
def NewData(self, text):
        '''
        
        '''
        sint = ignore_exception(ValueError)(int)
        if len(self.tags) > 0:
            if self.tags[-1] == "beat-type" or self.tags[-1] == "beats":
                if sint(text) is int:
                    self.chars[self.tags[-1]] = text

        if self.validateData(text):
            if len(self.tags) > 0:
                if self.tags[-1] not in self.chars:
                    self.chars[self.tags[-1]] = text
                else:
                    self.chars[self.tags[-1]] += text
918967
def paste(self):
        
        html = QApplication.clipboard().text()
        if not self.isRichTextEditEnabled():
            self.insertPlainText(projex.text.toAscii(html))
        else:
            super(XTextEdit, self).paste()
407301
def copy( self ):
        
        text = []
        for item in self.selectedItems():
            text.append(nativestring(item.text()))
        
        QApplication.clipboard().setText(','.join(text))
932532
def copy(self):
        """"""
        clipboard = QApplication.clipboard()
        clipl = []
        for idx in self.selectedIndexes():
            if not idx.isValid():
                continue
            obj = self.delegate.get_value(idx)
            # Check if we are trying to copy a numpy array, and if so make sure
            # to copy the whole thing in a tab separated format
            if isinstance(obj, (ndarray, MaskedArray)) \
              and ndarray is not FakeObject:
                if PY3:
                    output = io.BytesIO()
                else:
                    output = io.StringIO()
                try:
                    np_savetxt(output, obj, delimiter='\t')
                except:
                    QMessageBox.warning(self, _("Warning"),
                                        _("It was not possible to copy "
                                          "this array"))
                    return
                obj = output.getvalue().decode('utf-8')
                output.close()
            elif isinstance(obj, (DataFrame, Series)) \
              and DataFrame is not FakeObject:
                output = io.StringIO()
                try:
                    obj.to_csv(output, sep='\t', index=True, header=True)
                except Exception:
                    QMessageBox.warning(self, _("Warning"),
                                        _("It was not possible to copy "
                                          "this dataframe"))
                    return
                if PY3:
                    obj = output.getvalue()
                else:
                    obj = output.getvalue().decode('utf-8')
                output.close()
            elif is_binary_string(obj):
                obj = to_text_string(obj, 'utf8')
            else:
                obj = to_text_string(obj)
            clipl.append(obj)
        clipboard.setText('\n'.join(clipl))
781272
def copy(string, **kwargs):
    """"""
    window = Tk()
    window.withdraw()
    window.clipboard_clear()
    window.clipboard_append(string)
    window.destroy()
    return
731919
def paste(**kwargs):
    """"""

    clip.OpenClipboard() 
    d = clip.GetClipboardData(win32con.CF_UNICODETEXT)
    clip.CloseClipboard() 
    return d
912625
function(clipboardData) {
        var clipboardModel = this.clipboardModel;
        var data = clipboardData.getData('text/html');
        var table;

        if (data && $(data).find('tbody').length > 0) {
            // step 1: Append copied data on contenteditable element to parsing correctly table data.
            this.$el.html('<table>' + $(data).find('tbody').html() + '</table>');

            // step 2: Make grid data from cell data of appended table element.
            table = this.$el.find('table')[0];
            data = clipboardUtil.convertTableToData(table);

            // step 3: Empty contenteditable element to reset.
            this.$el.html('');
        } else {
            data = clipboardData.getData('text/plain');
            data = clipboardUtil.convertTextToData(data);
        }

        clipboardModel.pasteClipboardDataToGrid(data);
    }
1151763
def copy_without_prompts(self):
        """"""
        text = self.get_selected_text()
        lines = text.split(os.linesep)
        for index, line in enumerate(lines):
            if line.startswith('>>> ') or line.startswith('... '):
                lines[index] = line[4:]
        text = os.linesep.join(lines)
        QApplication.clipboard().setText(text)
1180653
def fromstring(text, schema=None):
    """"""
    if schema:
        parser = objectify.makeparser(schema = schema.schema)
        return objectify.fromstring(text, parser=parser)
    else:
        return objectify.fromstring(text)
163261
def _restore_clipboard_text(self, backup: str):
        """"""
        # Pasting takes some time, so wait a bit before restoring the content. Otherwise the restore is done before
        # the pasting happens, causing the backup to be pasted instead of the desired clipboard content.
        time.sleep(0.2)
        self.clipboard.text = backup if backup is not None else ""