wL i jdZddlZddlZddlmZddlmcmZGddeZ dZ de fdZ d Z d Zy) z3 Utilities for accessing the platform's clipboard. N)TryNextc eZdZy)ClipboardEmptyN)__name__ __module__ __qualname__[/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/IPython/lib/clipboard.pyrr sr rc ddl}|j |j |j }|j|S#t$r}td|d}~wwxYw#t |jf$rh |j |j}tj|tj}n$#t |jf$r }t|d}~wwxYwYwxYw#|jwxYw)zc Get the current clipboard's text on Windows. Requires Mark Hammond's pywin32 extensions. rNziGetting text from the clipboard requires the pywin32 extensions: http://sourceforge.net/projects/pywin32/)win32clipboard ImportErrorr OpenClipboardGetClipboardDataCF_UNICODETEXT TypeErrorerrorCF_TEXT py3compat cast_unicodeDEFAULT_ENCODINGrCloseClipboard)r etexts r win32_clipboard_getrs U  " (..~/L/LM %%' K UMNST UU ~++ ,( (!22>3I3IJD))$ 0J0JKD>//0 ( a ' ( ( %%'s^AA! A AA!C7?B76C7C CCCC!CC!!C3returnctjgdtj}|j\}}|j dd}t j |}|S)z' Get the clipboard's text on OS X. )pbpastez-Preferasciistdout  ) subprocessPopenPIPE communicatereplacerdecode)pbytes_stderrrs r osx_clipboard_getr-'sR 8 A]]_NFF ^^E5 )F   F #D Kr c^ ddlm}m}|}|j  |j } |jtj|tj}|S#t$r}t d|d}~wwxYw#|$r }t|d}~wwxYw#|jwxYw)z Get the clipboard's text using Tkinter. This is the default on systems that are not Windows or OS X. It may interfere with other UI toolkits and should be replaced with an implementation that uses that toolkit. r)TkTclErrorzBGetting text from the clipboard on this platform requires tkinter.N) tkinterr/r0rrwithdraw clipboard_getrdestroyrrr)r/r0rrootrs r tkinter_clipboard_getr63sc( 4DMMO!!#   ! !$ (B(B CD K cZ[abbc $!#$ s:A)B) B2 A>>BB BBBB,ctjjddk7r td t j dgtj 5}|j\}}|jr t| dddst tj|}|S#1swY)xYw#t$r}td|d}~wwxYw#t$r }t|d}~wwxYw)zGet the clipboard's text under Wayland using wl-paste command. This requires Wayland and wl-clipboard installed and running. XDG_SESSION_TYPEwaylandzwayland is not detectedzwl-paster NzzGetting text from the clipboard under Wayland requires the wl-clipboard extension: https://github.com/bugaevc/wl-clipboard)osenvirongetrr$r%r&r'waitFileNotFoundErrorrrr)UnicodeDecodeError)r*rawerrrrs r wayland_clipboard_getrBKs  zz~~()Y6/00    zl:?? C #q}}HCvvxcl" # $$ K% # #  A   $!#$sG&B9/B-B9C-B62B99 C CC C+C&&C+)__doc__r:r$IPython.core.errorrIPython.utils.py3compatutilsr ValueErrorrrstrr-r6rBr r r rIsB &++ Z 0 3 0r