
    EgN                    Z    d dl mZ d dlmZmZ d dlmZmZ erd dlZ	 G d de          Z
dS )    )annotations)TYPE_CHECKINGAny)BufferDlpackDeviceTypeNc                  d    e Zd ZdZddd	Zedd            Zedd            ZddZddZ	ddZ
dS )PandasBufferzF
    Data in the buffer is guaranteed to be contiguous in memory.
    Tx
np.ndarray
allow_copyboolreturnNonec                    |j         d         r<|j         |j        j        fk    s&|r|                                }nt	          d          || _        dS )zG
        Handle only regular columns (= numpy arrays) for now.
        r   zBExports cannot be zero-copy in the case of a non-contiguous bufferN)stridesdtypeitemsizecopyRuntimeError_x)selfr
   r   s      S/var/www/sysmax/venv/lib/python3.11/site-packages/pandas/core/interchange/buffer.py__init__zPandasBuffer.__init__   sc     9Q< 			ag.>-@ @ @  FFHH"1       intc                >    | j         j        | j         j        j        z  S )z'
        Buffer size in bytes.
        )r   sizer   r   r   s    r   bufsizezPandasBuffer.bufsize)   s    
 w|dgm444r   c                2    | j         j        d         d         S )z?
        Pointer to start of the buffer as an integer.
        datar   )r   __array_interface__r   s    r   ptrzPandasBuffer.ptr0   s    
 w*62155r   r   c                4    | j                                         S )z?
        Represent this structure as DLPack interface.
        )r   
__dlpack__r   s    r   r%   zPandasBuffer.__dlpack__7   s     w!!###r   #tuple[DlpackDeviceType, int | None]c                    t           j        dfS )zU
        Device type and device ID for where the data in the buffer resides.
        N)r   CPUr   s    r   __dlpack_device__zPandasBuffer.__dlpack_device__=   s     !$d++r   strc                    dt          | j        | j        |                                 d         j        d          z   dz   S )NzPandasBuffer(r   )r   r#   device))r*   r   r#   r)   namer   s    r   __repr__zPandasBuffer.__repr__C   sQ    #|8"4466q9>   
	
r   N)T)r
   r   r   r   r   r   )r   r   )r   r   )r   r&   )r   r*   )__name__
__module____qualname____doc__r   propertyr   r#   r%   r)   r/    r   r   r	   r	      s             & 5 5 5 X5 6 6 6 X6$ $ $ $, , , ,
 
 
 
 
 
r   r	   )
__future__r   typingr   r   *pandas.core.interchange.dataframe_protocolr   r   numpynpr	   r5   r   r   <module>r;      s    " " " " " "       
       
  =
 =
 =
 =
 =
6 =
 =
 =
 =
 =
r   