Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/io/clipboard/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/io/clipboard/__pycache__/__init__.cpython-312.pyc

�

Mٜg�^���dZdZddlZddlZddlmZmZmZmZmZddl	Z	ddl
Z
ddlmZ
ddlZddlZddlZddlmZmZddlmZe	j,d�Zd	Zd
ZGd�de�Zd
efd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#d�Z$d�Z%Gd�d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d
e-fd �Z.e+e,ca/a0d$d!�Z1d$d"�Z2gd#�Z3t`Z4t^Z5y)%a�
Pyperclip

A cross-platform clipboard module for Python,
with copy & paste functions for plain text.
By Al Sweigart al@inventwithpython.com
Licence at LICENSES/PYPERCLIP_LICENSE

Usage:
  import pyperclip
  pyperclip.copy('The text to be copied to the clipboard.')
  spam = pyperclip.paste()

  if not pyperclip.is_available():
    print("Copy functionality unavailable!")

On Windows, no additional modules are needed.
On Mac, the pyobjc module is used, falling back to the pbcopy and pbpaste cli
    commands. (These commands should come with OS X.).
On Linux, install xclip, xsel, or wl-clipboard (for "wayland" sessions) via
package manager.
For example, in Debian:
    sudo apt-get install xclip
    sudo apt-get install xsel
    sudo apt-get install wl-clipboard

Otherwise on Linux, you will need the PyQt5 modules installed.

This module does not work with PyGObject yet.

Cygwin is currently not supported.

Security Note: This module runs programs with these names:
    - pbcopy
    - pbpaste
    - xclip
    - xsel
    - wl-copy/wl-paste
    - klipper
    - qdbus
A malicious user could rename or add programs with these names, tricking
Pyperclip into running them with whatever permissions the Python process has.

z1.8.2�N)�c_size_t�c_wchar�	c_wchar_p�	get_errno�sizeof)�which)�PyperclipException�PyperclipWindowsException)�find_stack_level�DISPLAYz�
    Pyperclip could not find a copy/paste mechanism for your system.
    For more information, please visit
    https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error
    �utf-8c��eZdZy)�PyperclipTimeoutExceptionN)�__name__�
__module__�__qualname__���G/usr/local/lib/python3.12/site-packages/pandas/io/clipboard/__init__.pyrrUs��rr�returnc��ttttf}t	||�s!tdt
|�j����t|�S)NzJonly str, int, float, and bool values can be copied to the clipboard, not )�str�int�float�bool�
isinstancer	�typer)�text�
acceptedTypess  r�_stringifyTextr YsN���#�u�d�+�M��d�M�*� �3�37��:�3F�3F�2G�
I�
�	
��t�9�rc��d�}d�}||fS)Nc���t|�}tjddgtjd��5}|j	|jt���ddd�y#1swYyxYw)N�pbcopy�wT��stdin�	close_fds��input�r �
subprocess�Popen�PIPE�communicate�encode�ENCODING�r�ps  r�copy_osx_pbcopyz2init_osx_pbcopy_clipboard.<locals>.copy_osx_pbcopydsS���d�#��
�
�
�
�s�O�:�?�?�d�
�
�
�M�M����H� 5�M�6�
�
�
�s�&A#�#A,c���tjddgtjd��5}|j�d}ddd�j	t
�S#1swY�xYw)N�pbpaste�rT��stdoutr'r�r+r,r-r.�decoder0�r2r8s  r�paste_osx_pbcopyz3init_osx_pbcopy_clipboard.<locals>.paste_osx_pbcopyksT��
�
�
�
���Z�_�_��
�
��]�]�_�Q�'�F�
��}�}�X�&�&�	
�
�s�A�A#r)r3r<s  r�init_osx_pbcopy_clipboardr=cs��7�'��,�,�,rc��d�}d�}||fS)Nc�p�t|�}tjj|�j	�}|jtj�}tjj�}|jtjgd�|j|tj�y)z!Copy string argument to clipboardN)
r �
Foundation�NSString�stringWithString_�nsstring�dataUsingEncoding_�NSUTF8StringEncoding�AppKit�NSPasteboard�generalPasteboard�declareTypes_owner_�NSStringPboardType�setData_forType_)r�newStr�newData�boards    r�copy_osx_pyobjcz2init_osx_pyobjc_clipboard.<locals>.copy_osx_pyobjcvs����d�#���$�$�6�6�t�<�E�E�G���+�+�J�,K�,K�L���#�#�5�5�7��
�!�!�6�#<�#<�"=�t�D�
���w��(A�(A�Brc��tjj�}|jtj�}|S)zReturns contents of clipboard)rFrGrH�stringForType_rJ)rN�contents  r�paste_osx_pyobjcz3init_osx_pyobjc_clipboard.<locals>.paste_osx_pyobjcs1���#�#�5�5�7���&�&�v�'@�'@�A���rr)rOrSs  r�init_osx_pyobjc_clipboardrTus��C���,�,�,rc����	ddlmatj����tg���fd�}dtf�fd�}||fS#t$r 	ddlman#t$r	ddlmaYnwxYwY�^wxYw)Nr)�QApplicationc�^��t|�}�j�}|j|�y�N)r �	clipboard�setText)r�cb�apps  �r�copy_qtz"init_qt_clipboard.<locals>.copy_qt�s$����d�#��
�]�]�_��
�
�
�4�rrc�V���j�}t|j��SrX)rYrr)r[r\s �r�paste_qtz#init_qt_clipboard.<locals>.paste_qt�s���
�]�]�_���2�7�7�9�~�r)�qtpy.QtWidgetsrV�ImportError�PyQt5.QtWidgets�PyQt4.QtGui�instancer)r]r_r\s  @r�init_qt_clipboardre�ss���
1�/��
�
�
!�C�
�{��2����
�c���H����'�1�	1�4���	1�0�	1��1�s3�?�	A(�	A�A(�A"�A(�!A"�"A(�'A(c�2���d�d�d��fd�	}d��fd�	}||fS)N�cr2c����t|�}�}|r�}tjdd|gtjd��5}|j	|jt���ddd�y#1swYyxYw)N�xclip�
-selectionTr%r(r*)r�primary�	selectionr2�DEFAULT_SELECTION�PRIMARY_SELECTIONs    ��r�
copy_xclipz(init_xclip_clipboard.<locals>.copy_xclip�se����d�#��%�	��)�I�
�
�
�
�l�I�.�j�o�o�QU�
�
�
�M�M����H� 5�M�6�
�
�
���&A+�+A4c����}|r�}tjdd|dgtjtjd��5}|j�d}ddd�j	t
�S#1swY�xYw)Nrirj�-oT�r8�stderrr'rr9)rkrlr2r8rmrns    ��r�paste_xclipz)init_xclip_clipboard.<locals>.paste_xclip�sq���%�	��)�I�
�
�
�
�l�I�t�4��?�?��?�?��	
�
��]�]�_�Q�'�F�

��}�}�X�&�&�
�
�s�A2�2A;�Fr)rorurmrns  @@r�init_xclip_clipboardrw�s&�������7�'��{�"�"rc�2���d�d�d��fd�	}d��fd�	}||fS)Nz-b�-pc����t|�}�}|r�}tjd|dgtjd��5}|j	|jt���ddd�y#1swYyxYw)N�xselz-iTr%r(r*)rrk�selection_flagr2rmrns    ��r�	copy_xselz&init_xsel_clipboard.<locals>.copy_xsel�sd����d�#��*���.�N�
�
�
�
�^�T�*�*�/�/�T�
�
�
�M�M����H� 5�M�6�
�
�
�rpc�����}|r�}tjd|dgtjd��5}|j�d}ddd�j	t
�S#1swY�xYw)Nr{rrTr7rr9)rkr|r2r8rmrns    ��r�
paste_xselz'init_xsel_clipboard.<locals>.paste_xsel�sd���*���.�N�
�
�
�
�^�T�*�:�?�?�d�
�
��]�]�_�Q�'�F�
��}�}�X�&�&�	
�
�s�A"�"A+rvr)r}rrmrns  @@r�init_xsel_clipboardr��s&�������7�'��j� � rc�(��d�d�fd�	}d�fd�	}||fS)Nryc�4��t|�}dg}|r|j��|s)|jd�tj|d��ytj|tj
d��}|j
|jt���y)N�wl-copyz--clearT)r'r%r()	r �appendr+�
check_callr,r-r.r/r0)rrk�argsr2rns    �r�copy_wlz"init_wl_clipboard.<locals>.copy_wl�sr����d�#���{����K�K�)�*���K�K�	�"��!�!�$�$�7�� � ��Z�_�_��M�A�
�M�M����H� 5�M�6rc����ddg}|r|j��tj|tjd��}|j	�\}}|jt�S)Nzwl-pastez-nTr7)r�r+r,r-r.r:r0)rkr�r2r8�_stderrrns     �r�paste_wlz#init_wl_clipboard.<locals>.paste_wl�sS����D�!����K�K�)�*����T�*�/�/�T�J���-�-�/�����}�}�X�&�&rrvr)r�r�rns  @r�init_wl_clipboardr��s �����
7�'��H��rc��d�}d�}||fS)Nc	���t|�}tjdddd|jt�gtj
d��5}|j
d��ddd�y#1swYyxYw)N�qdbus�org.kde.klipper�/klipper�setClipboardContentsTr%r()r r+r,r/r0r-r.r1s  r�copy_klipperz,init_klipper_clipboard.<locals>.copy_klipper�sf���d�#��
�
�
��!��&����H�%�
��/�/��

��
�M�M��M�%�

�

�

�s�
A&�&A/c�B�tjgd�tjd��5}|j�d}ddd�j	t
�}t
|�dkDsJ�|jd�sJ�|jd�r|dd}|S#1swY�YxYw)N)r�r�r��getClipboardContentsTr7r�
���)r+r,r-r.r:r0�len�endswith)r2r8�clipboardContentss   r�
paste_klipperz-init_klipper_clipboard.<locals>.paste_klipper	s���
�
�
�L��?�?��
���]�]�_�Q�'�F�
�#�M�M�(�3���$�%��)�)�)� �)�)�$�/�/�/��%�%�d�+� 1�#�2� 6�� � �!
�
�s�B�Br)r�r�s  r�init_klipper_clipboardr��s��
&�!�&��&�&rc�$�d�}dtfd�}||fS)Nc��t|�}|dk(rtjdt���d|vrtjdt���t	ddd�	�5}|j|�ddd�y#1swYyxYw)
N�z]Pyperclip cannot copy a blank string to the clipboard on Cygwin. This is effectively a no-op.��
stacklevel�
z0Pyperclip cannot handle \r characters on Cygwin.�/dev/clipboardr$r
��encoding)r �warnings�warnr�open�write)r�fds  r�copy_dev_clipboardz8init_dev_clipboard_clipboard.<locals>.copy_dev_clipboard sp���d�#���2�:��M�M�/�+�-�
�
�4�<��M�M�C�+�-�
�
�"�C�'�
:�b��H�H�T�N�;�
:�
:�s�!A<�<Brc�l�tdd��5}|j�}ddd�|S#1swYSxYw)Nr�r
r�)r��read)r�rRs  r�paste_dev_clipboardz9init_dev_clipboard_clipboard.<locals>.paste_dev_clipboard1s/��
�"�W�
5���g�g�i�G�6���6���s�)�3)r)r�r�s  r�init_dev_clipboard_clipboardr�s!���"���
�2�2�2rc�2�Gd�d�}|�|�fS)Nc��eZdZd�Zdefd�Zy)�/init_no_clipboard.<locals>.ClipboardUnavailablec� �tt��rX)r	�
EXCEPT_MSG)�selfr��kwargss   r�__call__z8init_no_clipboard.<locals>.ClipboardUnavailable.__call__;s
��$�Z�0�0rrc��y)NFr)r�s r�__bool__z8init_no_clipboard.<locals>.ClipboardUnavailable.__bool__>s��rN)rrrr�rr�rrr�ClipboardUnavailabler�:s��	1�	�d�	rr�r)r�s r�init_no_clipboardr�9s ���� �!�#7�#9�9�9rc�,��eZdZd�fd�Zd�Zd�Z�xZS)�CheckedCallc�&��t�|�d|�y)N�f)�super�__setattr__)r�r��	__class__s  �r�__init__zCheckedCall.__init__Fs���
���C��#rc��|j|�}|s,t�r"td|jjz��|S)NzError calling )r�rr
r)r�r��rets   rr�zCheckedCall.__call__Is6���d�f�f�d�m���y�{�+�,<�t�v�v���,N�O�O��
rc�2�t|j||�yrX)�setattrr�)r��key�values   rr�zCheckedCall.__setattr__Os�������U�#r)rN)rrrr�r�r��
__classcell__)r�s@rr�r�Es���$��$rr�c�(������	�
���
������ddlmamamamamamamamam	a	m
a
matj}tjd�}t|j j"��	ttttttttttt
tg�	_t�	_t|j j(��
tg�
_t�
_|j j*�tg�_t�_t|j j,��g�_t�_t|j j.��g�_t�_t|j j0��tg�_t�_t|j j2��ttg�_t�_t|j4j6��
tt8g�
_t�
_t|j4j:��tg�_t�_t|j4j<��tg�_t�_t|j>��t@g�_t�_d�d�tBjD�	�
fd���tBjD��fd��������
�����f
d�}���fd	�}||fS)
Nr)�BOOL�DWORD�HANDLE�HGLOBAL�	HINSTANCE�HMENU�HWND�INT�LPCSTR�LPVOID�UINT�msvcrt��
c3�h�K��dddddddddddd�}	|���|�y#�|�wxYw�w)z=
        Context that provides a valid Windows hwnd.
        rsSTATICNr)�hwnd�safeCreateWindowExA�safeDestroyWindows ��r�windowz&init_windows_clipboard.<locals>.window�sG�����#�
�y�$��1�a��A�t�T�4��
��	$��J��d�#���d�#�s�2�%�	2�
/�2c3�(�K�tj�dz}d}tj�|kr8�|�}|rn-tjd�tj�|kr�8|std��	d����y#��wxYw�w)z�
        Context manager that opens the clipboard and prevents
        other applications from modifying the clipboard content.
        g�?F�{�G�z�?zError calling OpenClipboardN)�time�sleepr
)r��t�success�
OpenClipboard�safeCloseClipboards   ��rrYz)init_windows_clipboard.<locals>.clipboard�s|�����
�I�I�K�#������i�i�k�A�o�#�D�)�G����J�J�t��	�i�i�k�A�o�
�+�,I�J�J�	!��� ��� �s$�A(B�,
B�:B�>B�	B�Bc
��
�t|�}��5}�|�5��|rv�
|�dz}�	�|tt�z�}�
|�}tjt|�t|�|tt�z��|���|�ddd�ddd�y#1swY�xYw#1swYyxYw)N�)r rr�ctypes�memmover)rr��count�handle�
locked_handle�CF_UNICODETEXT�
GMEM_MOVEABLErY�safeEmptyClipboard�safeGlobalAlloc�safeGlobalLock�safeGlobalUnlock�safeSetClipboardData�wcslenr�s     ����������r�copy_windowsz,init_windows_clipboard.<locals>.copy_windows�s�����d�#��
�X���4��"�$��
#�4�L�1�,�E�,�]�E�F�7�O�<S�T�F�$2�6�$:�M��N�N�!�-�0�!�$����w��/��%�V�,�(���@�'!�
�X�!���
�X�s#�	B:�BB.�B:�.B7	�3B:�:Cc����d�5���}|s
	ddd�yt|�jcddd�S#1swYyxYw)Nr�)rr�)r�r�rY�safeGetClipboardDatas ���r�
paste_windowsz-init_windows_clipboard.<locals>.paste_windows�s=���
�t�_�)�.�9�F��
��_��V�$�*�*��_�_�s
�=�=�A)#�ctypes.wintypesr�r�r�r�r�r�r�r�r�r�r�r��windll�CDLLr��user32�CreateWindowExA�argtypes�restype�
DestroyWindowr��CloseClipboard�EmptyClipboard�GetClipboardData�SetClipboardData�kernel32�GlobalAllocr�
GlobalLock�GlobalUnlockr�r�
contextlib�contextmanager)r�r�r�r�r�r�r�rYr�r�r�r�r�r�r�r�r�r�r�s    @@@@@@@@@@@@@@@r�init_windows_clipboardrSs]���������]�]�F�
�[�[��
"�F�%�f�m�m�&C�&C�D��
���
������
���
$�� �#'���#�F�M�M�$?�$?�@��"&���� $����M�M�/�/�M�"�V�M�� �M��$�V�]�]�%A�%A�B��"$���!%���$�V�]�]�%A�%A�B��"$���!%���&�v�}�}�'E�'E�F��%)�F��!�#)�� �&�v�}�}�'E�'E�F��%)�6�N��!�#)�� �!�&�/�/�"=�"=�>�O� $�h�/�O��%�O�� ����!;�!;�<�N�&�i�N��#�N��"�6�?�?�#?�#?�@��!(�	���#���
����
'�F� �k�F�O��F�N��M��N����$��$����!��!�.A�A�B	+���&�&rc��d�}d�}||fS)Nc���t|�}tjdgtjd��5}|j	|jt���ddd�y#1swYyxYw)Nzclip.exeTr%r(r*r1s  r�copy_wslz$init_wsl_clipboard.<locals>.copy_wsl�sK���d�#��
�
�
�z�l�*�/�/�T�
R�VW�
�M�M����H� 5�M�6�S�
R�
R�s�&A"�"A+c���tjgd�tjtjd��5}|j�d}ddd�ddj	t
�S#1swY�!xYw)N)zpowershell.exez-commandz
Get-ClipboardTrsr���r9r;s  r�	paste_wslz%init_wsl_clipboard.<locals>.paste_wsl�sb��
�
�
�;��?�?��?�?��	
�
��]�]�_�Q�'�F�

��c�r�{�!�!�(�+�+�
�
�s�A,�,A5r)rrs  r�init_wsl_clipboardr�s��7�
	,��Y��rc�4�dtj�j�vrHtjjd�r]t
jdt���t�Stjdk(stj�dk(r
t�Stj�dk(rtd�r
t�Stjd	k(stj�d
k(r	ddladdlat!�St&r�tj(j+d
�rtd�r
t-�Std�r
t/�Std�r
t1�Std�rtd�r
t3�S	ddlat7�St=�S#t"$r
t%�cYSwxYw#t"$rN	ddlat7�cYS#t"$r%	ddlat7�cYcYS#t"$rYnwxYwYnwxYwYt=�SwxYw)z]
    Determine the OS/platform and set the copy() and paste() functions
    accordingly.
    �cygwinr�zcPyperclip's support for Cygwin is not perfect, see https://github.com/asweigart/pyperclip/issues/55r��nt�Windows�Linuxz
wslconfig.exe�mac�DarwinrN�WAYLAND_DISPLAYr�r{ri�klipperr�)�platform�system�lower�os�path�existsr�r�rr��namer�_executable_existsrrFr@rTrar=�HAS_DISPLAY�environ�getr�r�rwr��qtpyre�PyQt5�PyQt4r�rrr�determine_clipboardr*s���	�H�O�O�%�+�+�-�-�
�7�7�>�>�*�+��M�M�G�+�-�
�
0�1�1�
���D��H�O�O�-��:�%�'�'�����G�#��o�.�%�'�'�
�w�w�%��8�?�?�,��8�	/���-�.�.��
�:�:�>�>�+�,�1C�I�1N�$�&�&��f�%�&�(�(��g�&�'�)�)��i�(�-?��-H�)�+�+�	'�
�%�&�&�����K�	/�,�.�.�	/��*�	+�

+��)�*�*���
/�/� �-�.�.��#������	
/������!	+�sr�8F'�G�'F=�<F=�	H�
G�
H�	H�$G6�(
H�2H�6	H�?H�H�H�H�H�H�Hc
��tttttt
tttd�	}||vr5|D�cgc]
}t|���}}tddj|�����||�\aa
ycc}w)a�
    Explicitly sets the clipboard mechanism. The "clipboard mechanism" is how
    the copy() and paste() functions interact with the operating system to
    implement the copy/paste feature. The clipboard parameter must be one of:
        - pbcopy
        - pyobjc (default on macOS)
        - qt
        - xclip
        - xsel
        - klipper
        - windows (default on Windows)
        - no (this is what is set when no clipboard mechanism can be found)
    )	r#�pyobjc�qtrir{zwl-clipboardr�windows�nozArgument must be one of z, N)r=rTrerwr�r�r�rr��repr�
ValueError�join�copy�paste)rY�clipboard_types�_�allowed_clipboard_typess    r�
set_clipboardr8Zs���",�+��%�#�)�)�)��
�O���'�4C�"D�O�q�4��7�O��"D��&�t�y�y�1H�'I�&J�K�
�	
�
-�/�)�,�.�K�D�%��
#Es�A8c�2�t�\aat|�S)aD
    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 mechanism.
    This could be a problem if it selects, say, the memory-heavy PyQt4 module
    but the user was just going to immediately call set_clipboard() to use a
    different clipboard mechanism.

    The lazy loading this stub function implements gives the user a chance to
    call set_clipboard() to pick another clipboard mechanism. Or, if the user
    simply calls copy() or paste() without calling set_clipboard() first,
    will fall back on whatever clipboard mechanism that determine_clipboard()
    automatically chooses.
    �r*r3r4)rs r�lazy_load_stub_copyr;�s��$&�'�K�D�%���:�rc�0�t�\aat�S)aG
    A stub function for paste(), which will load the real paste() function when
    called so that the real paste() function is used for later calls.

    This allows users to import pyperclip without having determine_clipboard()
    automatically run, which will automatically select a clipboard mechanism.
    This could be a problem if it selects, say, the memory-heavy PyQt4 module
    but the user was just going to immediately call set_clipboard() to use a
    different clipboard mechanism.

    The lazy loading this stub function implements gives the user a chance to
    call set_clipboard() to pick another clipboard mechanism. Or, if the user
    simply calls copy() or paste() without calling set_clipboard() first,
    will fall back on whatever clipboard mechanism that determine_clipboard()
    automatically chooses.
    r:rrr�lazy_load_stub_paster=�s��$&�'�K�D�%��7�Nrc�:�ttk7xr
ttk7SrX)r3r;r4r=rrr�is_availabler?�s���&�&�H�5�4H�+H�Hrc���tj�}	t�}|dk7r|Stjd�|�4tj�||zkDrtdt	|�zdz���])aThis function call blocks until a non-empty text string exists on the
    clipboard. It returns this text.

    This function raises PyperclipTimeoutException if timeout was set to
    a number of seconds that has elapsed without non-empty text being put on
    the clipboard.r�r�zwaitForPaste() timed out after �	 seconds.�r�r4r�rr)�timeout�	startTime�
clipboardTexts   r�waitForPasterF�sn���	�	��I�
���
��B�� � ��
�
�4����4�9�9�;��W�1D�#D�+�1�C��L�@�;�N��
�rc��tj�}t�}	t�}||k7r|Stjd�|�4tj�||zkDrtdt	|�zdz���])adThis function call blocks until a new text string exists on the
    clipboard that is different from the text that was there when the function
    was first called. It returns this text.

    This function raises PyperclipTimeoutException if timeout was set to
    a number of seconds that has elapsed without non-empty text being put on
    the clipboard.r�z"waitForNewPaste() timed out after rArB)rCrD�originalText�currentTexts    r�waitForNewPasterJ�su���	�	��I��7�L�
��g���,�&����
�
�4����4�9�9�;��W�1D�#D�+�4�s�7�|�C�k�Q��
�r)r3r4rFrJr8r*rX)6�__doc__�__version__r	r�rrrrrrr�shutilrr#r+r�r��
pandas.errorsr	r
�pandas.util._exceptionsr�getenvr$r�r0rrr r=rTrerwr�r�r�r�r�r�rrr*r8r;r=rr?r3r4rFrJ�__all__�
clipboard_get�
clipboard_setrrr�<module>rTs��+�Z���
���
��.�����5�
�b�i�i�	�"���
���	� 2�	��C��-�$-�&�:#�>!�6�4#'�L3�4:�$�$�c'�L�,H�V#/�L�,�,I�d�I�"�#7���e��(�,���
��
r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists