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)
| 638 | |
| 639 | |
| 640 | def 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 | |
| 662 | def lazy_load_stub_paste(): |
nothing calls this directly
no test coverage detected