
    Owg                        d Z ddlmZ ddlmZ ddlmZ ddlZddlm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZmZ erddlmZ de	j*                  f	 	 	 ddZ	 d	 	 	 	 	 ddZy)z io on the clipboard     )annotations)StringIO)TYPE_CHECKINGN)lib)find_stack_level)check_dtype_backend)ABCDataFrame)
get_optionoption_context)DtypeBackend\s+c                   |j                  dd      }|.|j                         j                  dd      dk7  rt        d      t	        |       dd	lm} dd
lm}  |       }	 |j                  |j                  d      xs t        d            }|dd j                  d      dd dd }|D ch c]"  }|j                  d      j                  d      $ }	}t!        |      dkD  rxt!        |	      dk(  rj|	j                         dk7  rWd} t!        |d         t!        |d   j                  d            z
  }
|
dk7  r$|j#                  dt%        t'        |
                   | |j                  d      d} t!        |       dkD  r|j                  d      d|d<   nAt!        |       dkD  r3|j                  d      dk(  rt)        j*                  dt-                       |t/        |      f| |d|S # t        $ r Y iw xY wc c}w )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_csvzdisplay.encodingi'  

    	   z 		index_coldelim_whitespacer   enginepythonczIread_clipboard with regex separator does not work properly with c engine.
stacklevel)sepdtype_backend)poplowerreplaceNotImplementedErrorr   pandas.io.clipboardr   pandas.io.parsersr   decodegetr
   AttributeErrorsplitlstripcountlen
setdefaultlistrangewarningswarnr   r   )r#   r$   kwargsr   r   r   textlinesxcountsindex_lengths              K/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/io/clipboards.pyread_clipboardr>      s   f zz*g.H  0 8 8b AV K!"WXX&1*?D{{6::j1SZ@R5ST %Lt$Sb)#2.E 277Aahhsm!!$'7F7
5zA~#f+*vzz|q/@ 58}s58??5+A'BB1k4l0C+DE {vzz"45= 3x!|

8,4#x	SA&**X.#5W')	

 HTNS=SFSSM   8s   "-G, -'G<,	G98G9c                h   |j                  dd      }|.|j                         j                  dd      dk7  rt        d      dd	lm} |d
}|r>	 |d}t               } | j                  |f|dd| |j                         } ||       y|t        j                  dt                      t        | t              r(t        dd      5   | j                   di |}ddd       nt#        |       } |       y# t        $ r" t        j                  dt                      Y vw xY w# 1 sw Y   @xY w)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:
    r   r   Nr   r   r   z&clipboard only supports utf-8 encodingr   )clipboard_setTr   )r#   r   zAto_clipboard in excel mode requires a single character separator.r!   z7to_clipboard with excel=False ignores the sep argument.zdisplay.max_colwidth )r%   r&   r'   
ValueErrorr)   r@   r   to_csvgetvalue	TypeErrorr5   r6   r   
isinstancer	   r   	to_stringstr)	objexcelr#   r7   r   r@   bufr8   objstrs	            r=   to_clipboardrM      s4   2 zz*g.H  0 8 8b AV KABB1}	{*C CJJs@g@@<<>D$ 
E')	

 #|$2D9 	-"S]],V,F	- 	- S&#  	MMS+-		- 	-s   <C: 
D(:(D%$D%(D1)r#   rH   r$   zDtypeBackend | lib.NoDefault)TN)rJ   zbool | Noner#   z
str | NonereturnNone)__doc__
__future__r   ior   typingr   r5   pandas._libsr   pandas.util._exceptionsr   pandas.util._validatorsr   pandas.core.dtypes.genericr	   pandasr
   r   pandas._typingr   
no_defaultr>   rM   rA       r=   <module>r\      s{     "      4 7 3
 + 25..jT	jT/jT\ 7;AA)3A	Ar[   