
    <h                     l    S r SSKrSSKrSSKJr  SSKJs  Jr   " S S\5      r	S r
S\4S jrS	 rS
 rg)z2Utilities for accessing the platform's clipboard.
    N)TryNextc                       \ rS rSrSrg)ClipboardEmpty    N)__name__
__module____qualname____firstlineno____static_attributes__r       hC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\IPython/lib/clipboard.pyr   r      s    r   r   c                      SSK n U R                  5          U R	                  U R
                  5      nU R                  5         U$ ! [         a  n[        S5      UeSnAff = f! [        U R                  4 ai     U R	                  U R                  5      n[        R                  " U[        R                  5      n N! [        U R                  4 a  n[        UeSnAff = ff = f! U R                  5         f = f)zZGet the current clipboard's text on Windows.

Requires Mark Hammond's pywin32 extensions.
r   NziGetting text from the clipboard requires the pywin32 extensions: http://sourceforge.net/projects/pywin32/)win32clipboardImportErrorr   OpenClipboardGetClipboardDataCF_UNICODETEXT	TypeErrorerrorCF_TEXT	py3compatcast_unicodeDEFAULT_ENCODINGr   CloseClipboard)r   etexts      r   win32_clipboard_getr      s    
U   "	(..~/L/LM 	%%'K  U M NST	UU ~++, (	(!22>3I3IJD))$	0J0JKD>//0 	( a'	(	( 	%%'sS   A A" 
AAA"C!9A B;9C$ ;CCCC!!C$ $C6returnc                      [         R                  " / SQ[         R                  S9n U R                  5       u  pUR	                  SS5      n[
        R                  " U5      nU$ )z&Get the clipboard's text on OS X.
    )pbpastez-Preferasciistdout      
)
subprocessPopenPIPEcommunicatereplacer   decode)pbytes_stderrr   s       r   osx_clipboard_getr0   '   sP     	8	 A]]_NF^^E5)FF#DKr   c                  d    SSK Jn Jn  U " 5       nUR                  5          UR                  5       n UR                  5         [        R                  " U[        R                  5      nU$ ! [         a  n[	        S5      UeSnAff = f! U a  n[        UeSnAff = f! UR                  5         f = f)zGet 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   )TkTclErrorzBGetting text from the clipboard on this platform requires tkinter.N)tkinterr2   r3   r   r   withdrawclipboard_getr   destroyr   r   r   )r2   r3   r   rootr   s        r   tkinter_clipboard_getr9   3   s    c( 4DMMO!!# 	!!$	(B(BCDK  cZ[abbc  $!#$ 	s:   A* B *
B4B  BBBBB B/c                     [         R                  R                  S5      S:w  a  [        S5      e [        R
                  " S/[        R                  S9 n U R                  5       u  pU R                  5       (       a  [        U5      e SSS5        W(       d  [        e [        R                  " U5      nU$ ! , (       d  f       N4= f! [         a  n[        S5      UeSnAff = f! [         a  n[        UeSnAff = f)z~Get the clipboard's text under Wayland using wl-paste command.

This requires Wayland and wl-clipboard installed and running.
XDG_SESSION_TYPEwaylandzwayland is not detectedzwl-paster#   NzzGetting text from the clipboard under Wayland requires the wl-clipboard extension: https://github.com/bugaevc/wl-clipboard)osenvirongetr   r'   r(   r)   r*   waitFileNotFoundErrorr   r   r,   UnicodeDecodeError)r-   rawerrr   r   s        r   wayland_clipboard_getrE   K   s    
 
zz~~()Y6/00	zl:??Cq}}HCvvxxcl"  D $$ K% DC  A
 	  $!#$sM   $C 3B6C C% 6
C C C 
C"CC"%
C;/C66C;)__doc__r=   r'   IPython.core.errorr   IPython.utils.py3compatutilsr   
ValueErrorr   r   strr0   r9   rE   r   r   r   <module>rL      sB    
  & + +	Z 	0	3 	0r   