;j bddlmZddlZddlZGddejZGddZdS)) annotationsNc2eZdZdZdZdZdZdZdZdZ dZ d Z d S) DlpackDeviceTypez3Integer enum for device type codes matching DLPack. N) __name__ __module__ __qualname____doc__CPUCUDA CPU_PINNEDOPENCLVULKANMETALVPIROCMLC:\PYTHON\MyICR_Suite\python\Lib\site-packages\pyarrow/interchange/buffer.pyrrs<== C DJ F F E C DDDrrcbeZdZdZddd Zedd Zedd Zd ZddZ ddZ dS)_PyArrowBufferaY Data in the buffer is guaranteed to be contiguous in memory. Note that there is no dtype attribute present, a buffer can be thought of as simply a block of memory. However, if the column that the buffer is attached to has a dtype that's supported by DLPack and ``__dlpack__`` is implemented, then that dtype information will be contained in the return value from ``__dlpack__``. This distinction is useful to support both data exchange via DLPack on a buffer and (b) dtypes like variable-length strings which do not have a fixed number of bytes per element. Tx pa.Buffer allow_copyboolreturnNonec||_dS)z) Handle PyArrow Buffers. N)_x)selfrr!s r__init__z_PyArrowBuffer.__init__4srintc|jjS)z' Buffer size in bytes. )r&sizer's rbufsizez_PyArrowBuffer.bufsize:s w|rc|jjS)z? Pointer to start of the buffer as an integer. )r&addressr,s rptrz_PyArrowBuffer.ptrAs wrc td)a} Produce DLPack capsule (see array API standard). Raises: - TypeError : if the buffer contains unsupported dtypes. - NotImplementedError : if DLPack support is not implemented Useful to have to connect to array libraries. Support optional because it's not completely trivial to implement for a Python-only library. __dlpack__)NotImplementedErrorr,s rr2z_PyArrowBuffer.__dlpack__Hs",///r#tuple[DlpackDeviceType, int | None]cT|jjrtjdfSt d)z Device type and device ID for where the data in the buffer resides. Uses device type codes matching DLPack. Note: must be implemented even if ``__dlpack__`` is not. N__dlpack_device__)r&is_cpurrr3r,s rr6z _PyArrowBuffer.__dlpack_device__Us- 7> ;$($/ /%&9:: :rstrcdt|j|j|djdzdzS)NzPyArrowBuffer(r)r-r0device))r8r-r0r6namer,s r__repr__z_PyArrowBuffer.__repr__`sQ  #|8"4466q9>      rN)T)rr r!r"r#r$)r#r))r#r4)r#r8) rrrrr(propertyr-r0r2r6r=rrrrr%s   X X 0 0 0 ; ; ; ;       rr) __future__renumpyarrowpaIntEnumrrrrrrDs$#"""""      t|   F F F F F F F F F F r