� B�g����dZddlmZddlmZddlmZddlZddlm Z ddl m Z ddl m Z dd lmZdd lmZmZerdd lmZd e jfdd�Z ddd�ZdS)z io on the clipboard �)� annotations)�StringIO)� TYPE_CHECKINGN)�lib)�find_stack_level)�check_dtype_backend)� ABCDataFrame)� get_option�option_context)� DtypeBackend�\s+�sep�str� dtype_backend�DtypeBackend | lib.NoDefaultc ��|�dd��}|�;|����dd��dkrtd���t |��dd lm}dd lm}|��} |� |� d��ptd ����}n#t$rYnwxYw|dd �� d ��dd�dd�}d�|D��}t|��dkr�t|��dkr�|���dkrvd}t|d��t|d�d����z } | dkr0|�dt#t%| ������|�|� d���d}t|��dkr|� d���d|d<nNt|��dkr;|� d��dkr"t'jdt+�����|t-|��f||d�|��S)a� Read text from clipboard and pass to :func:`~pandas.read_csv`. Parses clipboard contents similar to how CSV files are parsed using :func:`~pandas.read_csv`. Parameters ---------- sep : str, default '\\s+' A string or regex delimiter. The default of ``'\\s+'`` denotes one or more whitespace characters. dtype_backend : {'numpy_nullable', 'pyarrow'}, default 'numpy_nullable' Back-end data type applied to the resultant :class:`DataFrame` (still experimental). Behaviour is as follows: * ``"numpy_nullable"``: returns nullable-dtype-backed :class:`DataFrame` (default). * ``"pyarrow"``: returns pyarrow-backed nullable :class:`ArrowDtype` DataFrame. .. versionadded:: 2.0 **kwargs See :func:`~pandas.read_csv` for the full argument list. Returns ------- DataFrame A parsed :class:`~pandas.DataFrame` object. See Also -------- DataFrame.to_clipboard : Copy object to the system clipboard. read_csv : Read a comma-separated values (csv) file into DataFrame. read_fwf : Read a table of fixed-width formatted lines into DataFrame. Examples -------- >>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['A', 'B', 'C']) >>> df.to_clipboard() # doctest: +SKIP >>> pd.read_clipboard() # doctest: +SKIP A B C 0 1 2 3 1 4 5 6 �encoding�utf-8N�-��utf8z3reading from clipboard only supports utf-8 encodingr)� clipboard_get)�read_csvzdisplay.encodingi'� ������ c�^�h|]*}|�d���d����+S)� � )�lstrip�count)�.0�xs �d/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/pandas/io/clipboards.py� <setcomp>z!read_clipboard.<locals>.<setcomp>js0�� 7� 7� 7�A�a�h�h�s�m�m�!�!�$�'�'� 7� 7� 7��rz � index_col�delim_whitespacer �engine�python�czIread_clipboard with regex separator does not work properly with c engine.�� stacklevel)rr)�pop�lower�replace�NotImplementedErrorr�pandas.io.clipboardr�pandas.io.parsersr�decode�getr �AttributeError�split�lenr � setdefault�list�range�warnings�warnrr) rr�kwargsrrr�text�lines�counts� index_lengths r$�read_clipboardrDsy��f�z�z�*�g�.�.�H������ 0� 0� 8� 8��b� A� A�V� K� K�!�"W�X�X�X�� �&�&�&�1�1�1�1�1�1�*�*�*�*�*�*� �=�?�?�D� ��{�{�6�:�:�j�1�1�S�Z�@R�5S�5S�T�T���� � � � � �� ���� ��%��L� � �t� $� $�S�b�S� )�#�2�#� .�E�8� 7�� 7� 7� 7�F� �5�z�z�A�~�~�#�f�+�+��*�*�v�z�z�|�|�q�/@�/@����5��8�}�}�s�5��8�?�?�5�+A�+A�'B�'B�B� � �1� � � � � �k�4��l�0C�0C�+D�+D� E� E� E� �{�v�z�z�"4�5�5�=��� �3�x�x�!�|�|�� � �8�,�,�4�#��x��� �S���A���&�*�*�X�.�.�#�5�5�� � W�'�)�)� � � � � �8�H�T�N�N� S��=� S� S�F� S� S�Ss�:7B2�2 B?�>B?T�excel� bool | None� str | None�return�Nonec ���|�dd��}|�;|����dd��dkrtd���dd lm}|�d }|rw |�d }t ��}|j|f|dd �|��|���}||��dS#t$r%tj d t�����Yn(wxYw|�"tj dt�����t|t��r6tdd��5|jdi|��}ddd��n #1swxYwYnt#|��}||��dS)a� Attempt to write text representation of object to the system clipboard The clipboard can be then pasted into Excel for example. Parameters ---------- obj : the object to write to the clipboard excel : bool, defaults to True if True, use the provided separator, writing in a csv format for allowing easy pasting into excel. if False, write a string representation of the object to the clipboard sep : optional, defaults to tab other keywords are passed to to_csv Notes ----- Requirements for your platform - Linux: xclip, or xsel (with PyQt4 modules) - Windows: - OS X: rrNrrrz&clipboard only supports utf-8 encodingr)� clipboard_setTr)rrzAto_clipboard in excel mode requires a single character separator.r-z7to_clipboard with excel=False ignores the sep argument.zdisplay.max_colwidth�)r/r0r1� ValueErrorr3rKr�to_csv�getvalue� TypeErrorr=r>r� isinstancer r � to_stringr) �objrErr?rrK�bufr@�objstrs r$� to_clipboardrV�s���2�z�z�*�g�.�.�H������ 0� 0� 8� 8��b� A� A�V� K� K��A�B�B�B�1�1�1�1�1�1� �}��� � � ��{����*�*�C� �C�J�s� @��g� @� @�� @� @� @��<�<�>�>�D� �M�$� � � � �F��� � � � �M�S�+�-�-� � � � � � � ���� ��� � E�'�)�)� � � � � �#�|�$�$�� �2�D� 9� 9� -� -�"�S�]�,�,�V�,�,�F� -� -� -� -� -� -� -� -� -� -� -���� -� -� -� -���S�����M�&�����s%�!AB%�%,C�C� D:�:D>�D>)rrrr)TN)rErFrrGrHrI)�__doc__� __future__r�ior�typingrr=� pandas._libsr�pandas.util._exceptionsr�pandas.util._validatorsr�pandas.core.dtypes.genericr �pandasr r �pandas._typingr � no_defaultrDrVrLr&r$�<module>rbs3����"�"�"�"�"�"������� � � � � � �����������4�4�4�4�4�4�7�7�7�7�7�7�3�3�3�3�3�3��������� �,�+�+�+�+�+�+��25�.�jT�jT�jT�jT�jT�\7;�A�A�A�A�A�A�Ar&
Memory