MCPcopy
hub / github.com/pandas-dev/pandas / lazy_load_stub_copy

Function lazy_load_stub_copy

pandas/io/clipboard/__init__.py:640–659  ·  view source on GitHub ↗

A stub function for copy(), which will load the real copy() function when called so that the real copy() function is used for later calls. This allows users to import pyperclip without having determine_clipboard() automatically run, which will automatically select a clipboard mecha

(text)

Source from the content-addressed store, hash-verified

638
639
640def lazy_load_stub_copy(text):
641 """
642 A stub function for copy(), which will load the real copy() function when
643 called so that the real copy() function is used for later calls.
644
645 This allows users to import pyperclip without having determine_clipboard()
646 automatically run, which will automatically select a clipboard mechanism.
647 This could be a problem if it selects, say, the memory-heavy PyQt4 module
648 but the user was just going to immediately call set_clipboard() to use a
649 different clipboard mechanism.
650
651 The lazy loading this stub function implements gives the user a chance to
652 call set_clipboard() to pick another clipboard mechanism. Or, if the user
653 simply calls copy() or paste() without calling set_clipboard() first,
654 will fall back on whatever clipboard mechanism that determine_clipboard()
655 automatically chooses.
656 """
657 global copy, paste
658 copy, paste = determine_clipboard()
659 return copy(text)
660
661
662def lazy_load_stub_paste():

Callers

nothing calls this directly

Calls 1

determine_clipboardFunction · 0.85

Tested by

no test coverage detected