K i ^ddlmZddlZddlZGddej ZGddZy)) annotationsNc0eZdZdZdZdZdZdZdZdZ dZ d Z y ) DlpackDeviceTypez3Integer enum for device type codes matching DLPack. N) __name__ __module__ __qualname____doc__CPUCUDA CPU_PINNEDOPENCLVULKANMETALVPIROCM`/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/pyarrow/interchange/buffer.pyrrs-= C DJ F F E C DrrcTeZdZdZd d dZed dZed dZdZd dZ d dZ y)_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. c||_y)z) Handle PyArrow Buffers. N)_x)selfx allow_copys r__init__z_PyArrowBuffer.__init__4s rc.|jjS)z' Buffer size in bytes. )r sizer!s rbufsizez_PyArrowBuffer.bufsize:s ww||rc.|jjS)z? Pointer to start of the buffer as an integer. )r addressr's rptrz_PyArrowBuffer.ptrAs wwrctd)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 rr-z_PyArrowBuffer.__dlpack__Hs",//rch|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_cpurrr.r's rr0z _PyArrowBuffer.__dlpack_device__Us, 77>>$(($/ /%&9: :rcdt|j|j|jdjdzdzS)NzPyArrowBuffer(r)r(r+device))strr(r+r0namer's r__repr__z_PyArrowBuffer.__repr__`sK  #||88"446q9>>     rN)T)r"z pa.Bufferr#boolreturnNone)r9int)r9z#tuple[DlpackDeviceType, int | None])r9r5) rrrrr$propertyr(r+r-r0r7rrrrr%sC    0 ;  rr) __future__renumpyarrowpaIntEnumrrrrrrBs,$#  t|| F F r