Converts from clipboard format.
541918
@Override
    public Layout fromClipboard(String data) {
        init(LayoutParser.parseText(data).root);
        return this;
    }
524773
def convert(cls, style_dict, num_format_str=None):
        

        # Create a XlsxWriter format object.
        props = {}

        if num_format_str is not None:
            props['num_format'] = num_format_str

        if style_dict is None:
            return props

        if 'borders' in style_dict:
            style_dict = style_dict.copy()
            style_dict['border'] = style_dict.pop('borders')

        for style_group_key, style_group in style_dict.items():
            for src, dst in cls.STYLE_MAPPING.get(style_group_key, []):
                # src is a sequence of keys into a nested dict
                # dst is a flat key
                if dst in props:
                    continue
                v = style_group
                for k in src:
                    try:
                        v = v[k]
                    except (KeyError, TypeError):
                        break
                else:
                    props[dst] = v

        if isinstance(props.get('pattern'), str):
            # TODO: support other fill patterns
            props['pattern'] = 0 if props['pattern'] == 'none' else 1

        for k in ['border', 'top', 'right', 'bottom', 'left']:
            if isinstance(props.get(k), str):
                try:
                    props[k] = ['none', 'thin', 'medium', 'dashed', 'dotted',
                                'thick', 'double', 'hair', 'mediumDashed',
                                'dashDot', 'mediumDashDot', 'dashDotDot',
                                'mediumDashDotDot',
                                'slantDashDot'].index(props[k])
                except ValueError:
                    props[k] = 2

        if isinstance(props.get('font_script'), str):
            props['font_script'] = ['baseline', 'superscript',
                                    'subscript'].index(props['font_script'])

        if isinstance(props.get('underline'), str):
            props['underline'] = {'none': 0, 'single': 1, 'double': 2,
                                  'singleAccounting': 33,
                                  'doubleAccounting': 34}[props['underline']]

        return props
478416
function copyToClipBoard(content) {
  switch (process.platform) {
  case 'darwin':
    var child = spawn('pbcopy', []);
    child.stdin.end(new Buffer(content, 'utf8'));
    return true;
  case 'win32':
    var child = spawn('clip', []);
    child.stdin.end(new Buffer(content, 'utf8'));
    return true;
  default:
    return false;
  }
}
595937
public String clipString(String str, int width, FontOptions options)
	{
		return clipString(str, width, options, false);
	}
709846
def OnPasteFormat(self, event):
        """"""

        with undo.group(_("Paste format")):
            self.grid.actions.paste_format()

        self.grid.ForceRefresh()
        self.grid.update_attribute_toolbar()
        self.grid.actions.zoom()
926017
def convert(html):
	""""""
	bs = BeautifulSoup(html, 'html.parser')
	_markdownify(bs)
	ret = unicode(bs).replace(u'\xa0', '&nbsp;')
	ret = re.sub(r'\n{3,}', r'\n\n', ret)
	# ! FIXME: hack
	ret = re.sub(r'&lt;&lt;&lt;FLOATING LINK: (.+)&gt;&gt;&gt;', r'<\1>', ret)
	# ! FIXME: hack
	sp = re.split(r'(&lt;&lt;&lt;BLOCKQUOTE: .*?&gt;&gt;&gt;)', ret, flags=re.DOTALL)
	for i,e in enumerate(sp):
		if e[:len('&lt;&lt;&lt;BLOCKQUOTE:')] == '&lt;&lt;&lt;BLOCKQUOTE:':
			sp[i] = '> ' + e[len('&lt;&lt;&lt;BLOCKQUOTE:') : -len('&gt;&gt;&gt;')]
			sp[i] = sp[i].replace('\n', '\n> ')
	ret = ''.join(sp)
	return ret.strip('\n')
461534
def copy(string, **kwargs):
    """"""

    clip.OpenClipboard()
    clip.EmptyClipboard()
    clip.SetClipboardData(win32con.CF_UNICODETEXT, string) 
    clip.CloseClipboard()

    return
1030882
public static void copyToClipboard(String string) {
        ClipboardContent content = new ClipboardContent();
        content.putString(string);
        Clipboard.getSystemClipboard().setContent(content);
        logger.info("copy '" + string + "' to clipboard");
    }
795797
def paste( self ):
        
        text = nativestring(QApplication.clipboard().text())
        for tag in text.split(','):
            tag = tag.strip()
            if ( self.isTagValid(tag) ):
                self.addTag(tag)
651682
function (e) {
    clipboardData.forEach(function (elem) {
      e.clipboardData.setData(elem.format, elem.data);
    });

    e.preventDefault();
    e.stopPropagation();
    e.stopImmediatePropagation();
    fakeElem.removeEventListener('copy', f);
  }
84407
def paste_format(self):
        

        row, col, tab = self.grid.actions.cursor

        selection = self.get_selection()
        if selection:
            # Use selection rather than cursor for top left cell if present
            row, col = [tl if tl is not None else 0
                        for tl in selection.get_bbox()[0]]

        cell_attributes = self.grid.code_array.cell_attributes

        string_data = self.grid.main_window.clipboard.get_clipboard()
        format_data = ast.literal_eval(string_data)

        ca = format_data["cell_attributes"]
        rh = format_data["row_heights"]
        cw = format_data["col_widths"]

        assert isinstance(ca, types.ListType)
        assert isinstance(rh, types.DictType)
        assert isinstance(cw, types.DictType)

        # Cell attributes

        for selection_params, tab, attrs in ca:
            base_selection = Selection(*selection_params)
            shifted_selection = base_selection.shifted(row, col)
            if "merge_area" not in attrs:
                # Do not paste merge areas because this may have
                # inintended consequences for existing merge areas
                new_cell_attribute = shifted_selection, tab, attrs
                cell_attributes.append(new_cell_attribute)

        # Row heights
        row_heights = self.grid.code_array.row_heights
        for __row, __tab in rh:
            row_heights[__row+row, tab] = rh[__row, __tab]

        # Column widths
        col_widths = self.grid.code_array.col_widths
        for __col, __tab in cw:
            col_widths[__col+col, tab] = cw[(__col, __tab)]
1356895
def _copyDPToClipboard(self):
        """"""
        dp = self._dp_menu_on
        if dp and dp.archived:
            path = dp.fullpath.replace(" ", "\\ ")
            QApplication.clipboard().setText(path, QClipboard.Clipboard)
            QApplication.clipboard().setText(path, QClipboard.Selection)
506419
public void pasteClipboard() {
        Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);
        try {
            if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
                addContents((String) t.getTransferData(DataFlavor.stringFlavor));
                table.repaint();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
1281370
def copy_to_clipboard(dat):
    
    p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE)
    p.stdin.write(to_bytes(dat))
    p.stdin.close()
    p.communicate()
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 ""
358706
def read_format_from_metadata(text, ext):
    """"""
    metadata = read_metadata(text, ext)
    rearrange_jupytext_metadata(metadata)
    return format_name_for_ext(metadata, ext, explicit_default=False)
767517
public void copyToClipboard(final int rowIndex, final int colIndex, final int width, final int height) {
        final StringBuilder sb = new StringBuilder();
        if (rowIndex == 0 && colIndex == 0 && width == getColumnCount() && height == getRowCount()) {
            for (int i = 0; i < width; i++) {
                sb.append(getColumnName(i));
                if (i < height - 1) {
                    sb.append("\t");
                }
            }
            sb.append("\n");
        }

        for (int row = rowIndex; row < rowIndex + height; row++) {
            for (int col = colIndex; col < colIndex + width; col++) {
                Object value = getValueAt(row, col);
                if (value == null) {
                    value = "";
                } else if (value instanceof JComponent) {
                    value = WidgetUtils.extractText((JComponent) value);
                }
                sb.append(value);
                sb.append("\t");
            }
            sb.deleteCharAt(sb.length() - 1);
            sb.append("\n");
        }
        final Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
        final StringSelection stsel = new StringSelection(sb.toString());

        clipboard.setContents(stsel, stsel);
    }