__init__.py 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667
  1. """
  2. Pyperclip
  3. A cross-platform clipboard module for Python,
  4. with copy & paste functions for plain text.
  5. By Al Sweigart al@inventwithpython.com
  6. BSD License
  7. Usage:
  8. import pyperclip
  9. pyperclip.copy('The text to be copied to the clipboard.')
  10. spam = pyperclip.paste()
  11. if not pyperclip.is_available():
  12. print("Copy functionality unavailable!")
  13. On Windows, no additional modules are needed.
  14. On Mac, the pyobjc module is used, falling back to the pbcopy and pbpaste cli
  15. commands. (These commands should come with OS X.).
  16. On Linux, install xclip or xsel via package manager. For example, in Debian:
  17. sudo apt-get install xclip
  18. sudo apt-get install xsel
  19. Otherwise on Linux, you will need the PyQt5 modules installed.
  20. This module does not work with PyGObject yet.
  21. Cygwin is currently not supported.
  22. Security Note: This module runs programs with these names:
  23. - which
  24. - where
  25. - pbcopy
  26. - pbpaste
  27. - xclip
  28. - xsel
  29. - klipper
  30. - qdbus
  31. A malicious user could rename or add programs with these names, tricking
  32. Pyperclip into running them with whatever permissions the Python process has.
  33. """
  34. __version__ = "1.7.0"
  35. import contextlib
  36. import ctypes
  37. from ctypes import c_size_t, c_wchar, c_wchar_p, get_errno, sizeof
  38. import os
  39. import platform
  40. import subprocess
  41. import time
  42. import warnings
  43. # `import PyQt4` sys.exit()s if DISPLAY is not in the environment.
  44. # Thus, we need to detect the presence of $DISPLAY manually
  45. # and not load PyQt4 if it is absent.
  46. HAS_DISPLAY = os.getenv("DISPLAY", False)
  47. EXCEPT_MSG = """
  48. Pyperclip could not find a copy/paste mechanism for your system.
  49. For more information, please visit
  50. https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error
  51. """
  52. ENCODING = "utf-8"
  53. # The "which" unix command finds where a command is.
  54. if platform.system() == "Windows":
  55. WHICH_CMD = "where"
  56. else:
  57. WHICH_CMD = "which"
  58. def _executable_exists(name):
  59. return (
  60. subprocess.call(
  61. [WHICH_CMD, name], stdout=subprocess.PIPE, stderr=subprocess.PIPE
  62. )
  63. == 0
  64. )
  65. # Exceptions
  66. class PyperclipException(RuntimeError):
  67. pass
  68. class PyperclipWindowsException(PyperclipException):
  69. def __init__(self, message):
  70. message += f" ({ctypes.WinError()})"
  71. super().__init__(message)
  72. def _stringifyText(text) -> str:
  73. acceptedTypes = (str, int, float, bool)
  74. if not isinstance(text, acceptedTypes):
  75. raise PyperclipException(
  76. f"only str, int, float, and bool values "
  77. f"can be copied to the clipboard, not {type(text).__name__}"
  78. )
  79. return str(text)
  80. def init_osx_pbcopy_clipboard():
  81. def copy_osx_pbcopy(text):
  82. text = _stringifyText(text) # Converts non-str values to str.
  83. p = subprocess.Popen(["pbcopy", "w"], stdin=subprocess.PIPE, close_fds=True)
  84. p.communicate(input=text.encode(ENCODING))
  85. def paste_osx_pbcopy():
  86. p = subprocess.Popen(["pbpaste", "r"], stdout=subprocess.PIPE, close_fds=True)
  87. stdout, stderr = p.communicate()
  88. return stdout.decode(ENCODING)
  89. return copy_osx_pbcopy, paste_osx_pbcopy
  90. def init_osx_pyobjc_clipboard():
  91. def copy_osx_pyobjc(text):
  92. """Copy string argument to clipboard"""
  93. text = _stringifyText(text) # Converts non-str values to str.
  94. newStr = Foundation.NSString.stringWithString_(text).nsstring()
  95. newData = newStr.dataUsingEncoding_(Foundation.NSUTF8StringEncoding)
  96. board = AppKit.NSPasteboard.generalPasteboard()
  97. board.declareTypes_owner_([AppKit.NSStringPboardType], None)
  98. board.setData_forType_(newData, AppKit.NSStringPboardType)
  99. def paste_osx_pyobjc():
  100. "Returns contents of clipboard"
  101. board = AppKit.NSPasteboard.generalPasteboard()
  102. content = board.stringForType_(AppKit.NSStringPboardType)
  103. return content
  104. return copy_osx_pyobjc, paste_osx_pyobjc
  105. def init_qt_clipboard():
  106. global QApplication
  107. # $DISPLAY should exist
  108. # Try to import from qtpy, but if that fails try PyQt5 then PyQt4
  109. try:
  110. from qtpy.QtWidgets import QApplication
  111. except ImportError:
  112. try:
  113. from PyQt5.QtWidgets import QApplication
  114. except ImportError:
  115. from PyQt4.QtGui import QApplication
  116. app = QApplication.instance()
  117. if app is None:
  118. app = QApplication([])
  119. def copy_qt(text):
  120. text = _stringifyText(text) # Converts non-str values to str.
  121. cb = app.clipboard()
  122. cb.setText(text)
  123. def paste_qt() -> str:
  124. cb = app.clipboard()
  125. return str(cb.text())
  126. return copy_qt, paste_qt
  127. def init_xclip_clipboard():
  128. DEFAULT_SELECTION = "c"
  129. PRIMARY_SELECTION = "p"
  130. def copy_xclip(text, primary=False):
  131. text = _stringifyText(text) # Converts non-str values to str.
  132. selection = DEFAULT_SELECTION
  133. if primary:
  134. selection = PRIMARY_SELECTION
  135. p = subprocess.Popen(
  136. ["xclip", "-selection", selection], stdin=subprocess.PIPE, close_fds=True
  137. )
  138. p.communicate(input=text.encode(ENCODING))
  139. def paste_xclip(primary=False):
  140. selection = DEFAULT_SELECTION
  141. if primary:
  142. selection = PRIMARY_SELECTION
  143. p = subprocess.Popen(
  144. ["xclip", "-selection", selection, "-o"],
  145. stdout=subprocess.PIPE,
  146. stderr=subprocess.PIPE,
  147. close_fds=True,
  148. )
  149. stdout, stderr = p.communicate()
  150. # Intentionally ignore extraneous output on stderr when clipboard is empty
  151. return stdout.decode(ENCODING)
  152. return copy_xclip, paste_xclip
  153. def init_xsel_clipboard():
  154. DEFAULT_SELECTION = "-b"
  155. PRIMARY_SELECTION = "-p"
  156. def copy_xsel(text, primary=False):
  157. text = _stringifyText(text) # Converts non-str values to str.
  158. selection_flag = DEFAULT_SELECTION
  159. if primary:
  160. selection_flag = PRIMARY_SELECTION
  161. p = subprocess.Popen(
  162. ["xsel", selection_flag, "-i"], stdin=subprocess.PIPE, close_fds=True
  163. )
  164. p.communicate(input=text.encode(ENCODING))
  165. def paste_xsel(primary=False):
  166. selection_flag = DEFAULT_SELECTION
  167. if primary:
  168. selection_flag = PRIMARY_SELECTION
  169. p = subprocess.Popen(
  170. ["xsel", selection_flag, "-o"], stdout=subprocess.PIPE, close_fds=True
  171. )
  172. stdout, stderr = p.communicate()
  173. return stdout.decode(ENCODING)
  174. return copy_xsel, paste_xsel
  175. def init_klipper_clipboard():
  176. def copy_klipper(text):
  177. text = _stringifyText(text) # Converts non-str values to str.
  178. p = subprocess.Popen(
  179. [
  180. "qdbus",
  181. "org.kde.klipper",
  182. "/klipper",
  183. "setClipboardContents",
  184. text.encode(ENCODING),
  185. ],
  186. stdin=subprocess.PIPE,
  187. close_fds=True,
  188. )
  189. p.communicate(input=None)
  190. def paste_klipper():
  191. p = subprocess.Popen(
  192. ["qdbus", "org.kde.klipper", "/klipper", "getClipboardContents"],
  193. stdout=subprocess.PIPE,
  194. close_fds=True,
  195. )
  196. stdout, stderr = p.communicate()
  197. # Workaround for https://bugs.kde.org/show_bug.cgi?id=342874
  198. # TODO: https://github.com/asweigart/pyperclip/issues/43
  199. clipboardContents = stdout.decode(ENCODING)
  200. # even if blank, Klipper will append a newline at the end
  201. assert len(clipboardContents) > 0
  202. # make sure that newline is there
  203. assert clipboardContents.endswith("\n")
  204. if clipboardContents.endswith("\n"):
  205. clipboardContents = clipboardContents[:-1]
  206. return clipboardContents
  207. return copy_klipper, paste_klipper
  208. def init_dev_clipboard_clipboard():
  209. def copy_dev_clipboard(text):
  210. text = _stringifyText(text) # Converts non-str values to str.
  211. if text == "":
  212. warnings.warn(
  213. "Pyperclip cannot copy a blank string to the clipboard on Cygwin."
  214. "This is effectively a no-op."
  215. )
  216. if "\r" in text:
  217. warnings.warn("Pyperclip cannot handle \\r characters on Cygwin.")
  218. with open("/dev/clipboard", "wt") as fo:
  219. fo.write(text)
  220. def paste_dev_clipboard() -> str:
  221. with open("/dev/clipboard", "rt") as fo:
  222. content = fo.read()
  223. return content
  224. return copy_dev_clipboard, paste_dev_clipboard
  225. def init_no_clipboard():
  226. class ClipboardUnavailable:
  227. def __call__(self, *args, **kwargs):
  228. raise PyperclipException(EXCEPT_MSG)
  229. def __bool__(self) -> bool:
  230. return False
  231. return ClipboardUnavailable(), ClipboardUnavailable()
  232. # Windows-related clipboard functions:
  233. class CheckedCall:
  234. def __init__(self, f):
  235. super().__setattr__("f", f)
  236. def __call__(self, *args):
  237. ret = self.f(*args)
  238. if not ret and get_errno():
  239. raise PyperclipWindowsException("Error calling " + self.f.__name__)
  240. return ret
  241. def __setattr__(self, key, value):
  242. setattr(self.f, key, value)
  243. def init_windows_clipboard():
  244. global HGLOBAL, LPVOID, DWORD, LPCSTR, INT
  245. global HWND, HINSTANCE, HMENU, BOOL, UINT, HANDLE
  246. from ctypes.wintypes import (
  247. HGLOBAL,
  248. LPVOID,
  249. DWORD,
  250. LPCSTR,
  251. INT,
  252. HWND,
  253. HINSTANCE,
  254. HMENU,
  255. BOOL,
  256. UINT,
  257. HANDLE,
  258. )
  259. windll = ctypes.windll
  260. msvcrt = ctypes.CDLL("msvcrt")
  261. safeCreateWindowExA = CheckedCall(windll.user32.CreateWindowExA)
  262. safeCreateWindowExA.argtypes = [
  263. DWORD,
  264. LPCSTR,
  265. LPCSTR,
  266. DWORD,
  267. INT,
  268. INT,
  269. INT,
  270. INT,
  271. HWND,
  272. HMENU,
  273. HINSTANCE,
  274. LPVOID,
  275. ]
  276. safeCreateWindowExA.restype = HWND
  277. safeDestroyWindow = CheckedCall(windll.user32.DestroyWindow)
  278. safeDestroyWindow.argtypes = [HWND]
  279. safeDestroyWindow.restype = BOOL
  280. OpenClipboard = windll.user32.OpenClipboard
  281. OpenClipboard.argtypes = [HWND]
  282. OpenClipboard.restype = BOOL
  283. safeCloseClipboard = CheckedCall(windll.user32.CloseClipboard)
  284. safeCloseClipboard.argtypes = []
  285. safeCloseClipboard.restype = BOOL
  286. safeEmptyClipboard = CheckedCall(windll.user32.EmptyClipboard)
  287. safeEmptyClipboard.argtypes = []
  288. safeEmptyClipboard.restype = BOOL
  289. safeGetClipboardData = CheckedCall(windll.user32.GetClipboardData)
  290. safeGetClipboardData.argtypes = [UINT]
  291. safeGetClipboardData.restype = HANDLE
  292. safeSetClipboardData = CheckedCall(windll.user32.SetClipboardData)
  293. safeSetClipboardData.argtypes = [UINT, HANDLE]
  294. safeSetClipboardData.restype = HANDLE
  295. safeGlobalAlloc = CheckedCall(windll.kernel32.GlobalAlloc)
  296. safeGlobalAlloc.argtypes = [UINT, c_size_t]
  297. safeGlobalAlloc.restype = HGLOBAL
  298. safeGlobalLock = CheckedCall(windll.kernel32.GlobalLock)
  299. safeGlobalLock.argtypes = [HGLOBAL]
  300. safeGlobalLock.restype = LPVOID
  301. safeGlobalUnlock = CheckedCall(windll.kernel32.GlobalUnlock)
  302. safeGlobalUnlock.argtypes = [HGLOBAL]
  303. safeGlobalUnlock.restype = BOOL
  304. wcslen = CheckedCall(msvcrt.wcslen)
  305. wcslen.argtypes = [c_wchar_p]
  306. wcslen.restype = UINT
  307. GMEM_MOVEABLE = 0x0002
  308. CF_UNICODETEXT = 13
  309. @contextlib.contextmanager
  310. def window():
  311. """
  312. Context that provides a valid Windows hwnd.
  313. """
  314. # we really just need the hwnd, so setting "STATIC"
  315. # as predefined lpClass is just fine.
  316. hwnd = safeCreateWindowExA(
  317. 0, b"STATIC", None, 0, 0, 0, 0, 0, None, None, None, None
  318. )
  319. try:
  320. yield hwnd
  321. finally:
  322. safeDestroyWindow(hwnd)
  323. @contextlib.contextmanager
  324. def clipboard(hwnd):
  325. """
  326. Context manager that opens the clipboard and prevents
  327. other applications from modifying the clipboard content.
  328. """
  329. # We may not get the clipboard handle immediately because
  330. # some other application is accessing it (?)
  331. # We try for at least 500ms to get the clipboard.
  332. t = time.time() + 0.5
  333. success = False
  334. while time.time() < t:
  335. success = OpenClipboard(hwnd)
  336. if success:
  337. break
  338. time.sleep(0.01)
  339. if not success:
  340. raise PyperclipWindowsException("Error calling OpenClipboard")
  341. try:
  342. yield
  343. finally:
  344. safeCloseClipboard()
  345. def copy_windows(text):
  346. # This function is heavily based on
  347. # http://msdn.com/ms649016#_win32_Copying_Information_to_the_Clipboard
  348. text = _stringifyText(text) # Converts non-str values to str.
  349. with window() as hwnd:
  350. # http://msdn.com/ms649048
  351. # If an application calls OpenClipboard with hwnd set to NULL,
  352. # EmptyClipboard sets the clipboard owner to NULL;
  353. # this causes SetClipboardData to fail.
  354. # => We need a valid hwnd to copy something.
  355. with clipboard(hwnd):
  356. safeEmptyClipboard()
  357. if text:
  358. # http://msdn.com/ms649051
  359. # If the hMem parameter identifies a memory object,
  360. # the object must have been allocated using the
  361. # function with the GMEM_MOVEABLE flag.
  362. count = wcslen(text) + 1
  363. handle = safeGlobalAlloc(GMEM_MOVEABLE, count * sizeof(c_wchar))
  364. locked_handle = safeGlobalLock(handle)
  365. ctypes.memmove(
  366. c_wchar_p(locked_handle),
  367. c_wchar_p(text),
  368. count * sizeof(c_wchar),
  369. )
  370. safeGlobalUnlock(handle)
  371. safeSetClipboardData(CF_UNICODETEXT, handle)
  372. def paste_windows():
  373. with clipboard(None):
  374. handle = safeGetClipboardData(CF_UNICODETEXT)
  375. if not handle:
  376. # GetClipboardData may return NULL with errno == NO_ERROR
  377. # if the clipboard is empty.
  378. # (Also, it may return a handle to an empty buffer,
  379. # but technically that's not empty)
  380. return ""
  381. return c_wchar_p(handle).value
  382. return copy_windows, paste_windows
  383. def init_wsl_clipboard():
  384. def copy_wsl(text):
  385. text = _stringifyText(text) # Converts non-str values to str.
  386. p = subprocess.Popen(["clip.exe"], stdin=subprocess.PIPE, close_fds=True)
  387. p.communicate(input=text.encode(ENCODING))
  388. def paste_wsl():
  389. p = subprocess.Popen(
  390. ["powershell.exe", "-command", "Get-Clipboard"],
  391. stdout=subprocess.PIPE,
  392. stderr=subprocess.PIPE,
  393. close_fds=True,
  394. )
  395. stdout, stderr = p.communicate()
  396. # WSL appends "\r\n" to the contents.
  397. return stdout[:-2].decode(ENCODING)
  398. return copy_wsl, paste_wsl
  399. # Automatic detection of clipboard mechanisms
  400. # and importing is done in deteremine_clipboard():
  401. def determine_clipboard():
  402. """
  403. Determine the OS/platform and set the copy() and paste() functions
  404. accordingly.
  405. """
  406. global Foundation, AppKit, qtpy, PyQt4, PyQt5
  407. # Setup for the CYGWIN platform:
  408. if (
  409. "cygwin" in platform.system().lower()
  410. ): # Cygwin has a variety of values returned by platform.system(),
  411. # such as 'CYGWIN_NT-6.1'
  412. # FIXME: pyperclip currently does not support Cygwin,
  413. # see https://github.com/asweigart/pyperclip/issues/55
  414. if os.path.exists("/dev/clipboard"):
  415. warnings.warn(
  416. "Pyperclip's support for Cygwin is not perfect,"
  417. "see https://github.com/asweigart/pyperclip/issues/55"
  418. )
  419. return init_dev_clipboard_clipboard()
  420. # Setup for the WINDOWS platform:
  421. elif os.name == "nt" or platform.system() == "Windows":
  422. return init_windows_clipboard()
  423. if platform.system() == "Linux":
  424. with open("/proc/version", "r") as f:
  425. if "Microsoft" in f.read():
  426. return init_wsl_clipboard()
  427. # Setup for the MAC OS X platform:
  428. if os.name == "mac" or platform.system() == "Darwin":
  429. try:
  430. import Foundation # check if pyobjc is installed
  431. import AppKit
  432. except ImportError:
  433. return init_osx_pbcopy_clipboard()
  434. else:
  435. return init_osx_pyobjc_clipboard()
  436. # Setup for the LINUX platform:
  437. if HAS_DISPLAY:
  438. if _executable_exists("xsel"):
  439. return init_xsel_clipboard()
  440. if _executable_exists("xclip"):
  441. return init_xclip_clipboard()
  442. if _executable_exists("klipper") and _executable_exists("qdbus"):
  443. return init_klipper_clipboard()
  444. try:
  445. # qtpy is a small abstraction layer that lets you write applications
  446. # using a single api call to either PyQt or PySide.
  447. # https://pypi.python.org/project/QtPy
  448. import qtpy # check if qtpy is installed
  449. except ImportError:
  450. # If qtpy isn't installed, fall back on importing PyQt4.
  451. try:
  452. import PyQt5 # check if PyQt5 is installed
  453. except ImportError:
  454. try:
  455. import PyQt4 # check if PyQt4 is installed
  456. except ImportError:
  457. pass # We want to fail fast for all non-ImportError exceptions.
  458. else:
  459. return init_qt_clipboard()
  460. else:
  461. return init_qt_clipboard()
  462. else:
  463. return init_qt_clipboard()
  464. return init_no_clipboard()
  465. def set_clipboard(clipboard):
  466. """
  467. Explicitly sets the clipboard mechanism. The "clipboard mechanism" is how
  468. the copy() and paste() functions interact with the operating system to
  469. implement the copy/paste feature. The clipboard parameter must be one of:
  470. - pbcopy
  471. - pbobjc (default on Mac OS X)
  472. - qt
  473. - xclip
  474. - xsel
  475. - klipper
  476. - windows (default on Windows)
  477. - no (this is what is set when no clipboard mechanism can be found)
  478. """
  479. global copy, paste
  480. clipboard_types = {
  481. "pbcopy": init_osx_pbcopy_clipboard,
  482. "pyobjc": init_osx_pyobjc_clipboard,
  483. "qt": init_qt_clipboard, # TODO - split this into 'qtpy', 'pyqt4', and 'pyqt5'
  484. "xclip": init_xclip_clipboard,
  485. "xsel": init_xsel_clipboard,
  486. "klipper": init_klipper_clipboard,
  487. "windows": init_windows_clipboard,
  488. "no": init_no_clipboard,
  489. }
  490. if clipboard not in clipboard_types:
  491. allowed_clipboard_types = [repr(_) for _ in clipboard_types.keys()]
  492. raise ValueError(
  493. f"Argument must be one of {', '.join(allowed_clipboard_types)}"
  494. )
  495. # Sets pyperclip's copy() and paste() functions:
  496. copy, paste = clipboard_types[clipboard]()
  497. def lazy_load_stub_copy(text):
  498. """
  499. A stub function for copy(), which will load the real copy() function when
  500. called so that the real copy() function is used for later calls.
  501. This allows users to import pyperclip without having determine_clipboard()
  502. automatically run, which will automatically select a clipboard mechanism.
  503. This could be a problem if it selects, say, the memory-heavy PyQt4 module
  504. but the user was just going to immediately call set_clipboard() to use a
  505. different clipboard mechanism.
  506. The lazy loading this stub function implements gives the user a chance to
  507. call set_clipboard() to pick another clipboard mechanism. Or, if the user
  508. simply calls copy() or paste() without calling set_clipboard() first,
  509. will fall back on whatever clipboard mechanism that determine_clipboard()
  510. automatically chooses.
  511. """
  512. global copy, paste
  513. copy, paste = determine_clipboard()
  514. return copy(text)
  515. def lazy_load_stub_paste():
  516. """
  517. A stub function for paste(), which will load the real paste() function when
  518. called so that the real paste() function is used for later calls.
  519. This allows users to import pyperclip without having determine_clipboard()
  520. automatically run, which will automatically select a clipboard mechanism.
  521. This could be a problem if it selects, say, the memory-heavy PyQt4 module
  522. but the user was just going to immediately call set_clipboard() to use a
  523. different clipboard mechanism.
  524. The lazy loading this stub function implements gives the user a chance to
  525. call set_clipboard() to pick another clipboard mechanism. Or, if the user
  526. simply calls copy() or paste() without calling set_clipboard() first,
  527. will fall back on whatever clipboard mechanism that determine_clipboard()
  528. automatically chooses.
  529. """
  530. global copy, paste
  531. copy, paste = determine_clipboard()
  532. return paste()
  533. def is_available() -> bool:
  534. return copy != lazy_load_stub_copy and paste != lazy_load_stub_paste
  535. # Initially, copy() and paste() are set to lazy loading wrappers which will
  536. # set `copy` and `paste` to real functions the first time they're used, unless
  537. # set_clipboard() or determine_clipboard() is called first.
  538. copy, paste = lazy_load_stub_copy, lazy_load_stub_paste
  539. __all__ = ["copy", "paste", "set_clipboard", "determine_clipboard"]
  540. # pandas aliases
  541. clipboard_get = paste
  542. clipboard_set = copy