()
| 265 | |
| 266 | |
| 267 | def init_dev_clipboard_clipboard(): |
| 268 | def copy_dev_clipboard(text): |
| 269 | text = _PYTHON_STR_TYPE(text) # Converts non-str values to str. |
| 270 | if text == '': |
| 271 | warnings.warn('Pyperclip cannot copy a blank string to the clipboard on Cygwin. This is effectively a no-op.') |
| 272 | if '\r' in text: |
| 273 | warnings.warn('Pyperclip cannot handle \\r characters on Cygwin.') |
| 274 | |
| 275 | fo = open('/dev/clipboard', 'wt') |
| 276 | fo.write(text) |
| 277 | fo.close() |
| 278 | |
| 279 | def paste_dev_clipboard(): |
| 280 | fo = open('/dev/clipboard', 'rt') |
| 281 | content = fo.read() |
| 282 | fo.close() |
| 283 | return content |
| 284 | |
| 285 | return copy_dev_clipboard, paste_dev_clipboard |
| 286 | |
| 287 | |
| 288 | def init_no_clipboard(): |
no outgoing calls
no test coverage detected
searching dependent graphs…