ó
    a‡Ejƒ%  ã                   óÀ  • S SK r S SKrS SKJrJrJrJrJrJ	r	J
r
JrJrJrJrJrJrJrJrJrJr  S SKJr   " S S\R,                  5      rSr\S-   S-   r " S S	\R4                  5      r " S
 S\R8                  5      r " S S\R<                  5      rS r S r!SS.S jr"S\ S3\"l#        SSS.S jr$SSS.S jr%S\ S3\%l#        S SSS.S jjr&SSS.S jr'SS.S jr(g)!é    N)ÚIpcReadOptionsÚIpcWriteOptionsÚ	ReadStatsÚ
WriteStatsÚMessageÚMessageReaderÚRecordBatchReaderÚ_ReadPandasMixinÚMetadataVersionÚ	AlignmentÚread_messageÚread_record_batchÚread_schemaÚread_tensorÚwrite_tensorÚget_record_batch_sizeÚget_tensor_sizec                   ó(   • \ rS rSrSrSSS.S jrSrg)ÚRecordBatchStreamReaderé"   aÓ  
Reader for the Arrow streaming binary format.

Parameters
----------
source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object
    Either an in-memory buffer, or a readable file object.
    If you want to use memory map use MemoryMappedFile as source.
options : pyarrow.ipc.IpcReadOptions
    Options for IPC deserialization.
    If None, default values will be used.
memory_pool : MemoryPool, default None
    If None, default memory pool is used.
N©ÚoptionsÚmemory_poolc                ó:   • [        U5      nU R                  XUS9  g )Nr   ©Ú _ensure_default_ipc_read_optionsÚ_open)ÚselfÚsourcer   r   s       ÚH/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pyarrow/ipc.pyÚ__init__Ú RecordBatchStreamReader.__init__2   s   € Ü2°7Ó;ˆØ�
‰
�6¸ˆ
ÒDó    © ©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r!   Ú__static_attributes__r$   r#   r    r   r   "   s   † ñð +/¸D÷ Eð Er#   r   aO  Parameters
----------
sink : str, pyarrow.NativeFile, or file-like Python object
    Either a file path, or a writable file object.
schema : pyarrow.Schema
    The Arrow schema for data to be written to the file.
options : pyarrow.ipc.IpcWriteOptions
    Options for IPC serialization.

    If None, default values will be used: the legacy format will not
    be used unless overridden by setting the environment variable
    ARROW_PRE_0_15_IPC_FORMAT=1, and the V5 metadata version will be
    used unless overridden by setting the environment variable
    ARROW_PRE_1_0_METADATA_VERSION=1.Ú
zÎmetadata : dict | pyarrow.KeyValueMetadata, optional
    Key/value pairs (both must be bytes-like) that will be stored
    in the file footer and are retrievable via
    pyarrow.ipc.open_file(...).metadata.c                   ó,   • \ rS rSrS\ 3rSS.S jrSrg)ÚRecordBatchStreamWriteréS   z.Writer for the Arrow streaming binary format

N©r   c                ó:   • [        U5      nU R                  XUS9  g ©Nr0   ©Ú_get_legacy_format_defaultr   )r   ÚsinkÚschemar   s       r    r!   Ú RecordBatchStreamWriter.__init__X   s   € Ü,¨WÓ5ˆØ�
‰
�4¨ˆ
Ò1r#   r$   )r&   r'   r(   r)   Ú_ipc_writer_class_docr*   r!   r+   r$   r#   r    r.   r.   S   s#   † ðàÐ ð€Gð 15÷ 2ð 2r#   r.   c                   ó,   • \ rS rSrSrSSSS.S jjrSrg)ÚRecordBatchFileReaderé]   a  
Class for reading Arrow record batch data from the Arrow binary file format

Parameters
----------
source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object
    Either an in-memory buffer, or a readable file object.
    If you want to use memory map use MemoryMappedFile as source.
footer_offset : int, default None
    If the file is embedded in some larger file, this is the byte offset to
    the very end of the file data
options : pyarrow.ipc.IpcReadOptions
    Options for IPC serialization.
    If None, default values will be used.
memory_pool : MemoryPool, default None
    If None, default memory pool is used.
Nr   c                ó:   • [        U5      nU R                  XX4S9  g )N©Úfooter_offsetr   r   r   )r   r   r>   r   r   s        r    r!   ÚRecordBatchFileReader.__init__p   s"   € ä2°7Ó;ˆØ�
‰
�6Ø"ð 	ò 	=r#   r$   ©Nr%   r$   r#   r    r:   r:   ]   s   † ñð$=¸dØ!÷=ñ =r#   r:   c                   ó.   • \ rS rSrS\ 3rSSS.S jrSrg)ÚRecordBatchFileWriteréw   z/Writer to create the Arrow binary file format

N©r   Úmetadatac                ó:   • [        U5      nU R                  XX4S9  g ©NrD   r3   )r   r5   r6   r   rE   s        r    r!   ÚRecordBatchFileWriter.__init__}   s   € Ü,¨WÓ5ˆØ�
‰
�4¨ˆ
ÒDr#   r$   )r&   r'   r(   r)   Ú_ipc_file_writer_class_docr*   r!   r+   r$   r#   r    rB   rB   w   s'   † ðàÐ ð €Gð 15¸t÷ Eð Er#   rB   c                 ó’  • U (       a.  [        U [        5      (       d  [        S[        U 5       35      eU $ [        R
                  n[        [        [        R                  R                  SS5      5      5      n[        [        [        R                  R                  SS5      5      5      (       a  [        R                  n[        UUS9$ )Nzexpected IpcWriteOptions, got ÚARROW_PRE_0_15_IPC_FORMATÚ0ÚARROW_PRE_1_0_METADATA_VERSION)Úuse_legacy_formatÚmetadata_version)Ú
isinstancer   Ú	TypeErrorÚtyper   ÚV5ÚboolÚintÚosÚenvironÚgetÚV4)r   rO   rN   s      r    r4   r4   ‚   s›   € ÞÜ˜'¤?×3Ñ3ÜÐ<¼TÀ'»]¸OÐLÓMÐMØˆä&×)Ñ)ÐäŒS”—‘—‘Ð ;¸SÓAÓBÓCð äŒC”—
‘
—‘Ð?ÀÓEÓF×GÑGÜ*×-Ñ-ÐÜÐ->Ø,<ñ>ð >r#   c                 óŽ   • U (       a,  [        U [        5      (       d  [        S[        U 5       35      eU =(       d
    [        5       $ )Nzexpected IpcReadOptions, got )rP   r   rQ   rR   r0   s    r    r   r   ‘   s6   € Þ”z '¬>×:Ñ:ÜÐ7¼¸W»°ÐGÓHÐHØ×&”nÓ&Ð&r#   r0   c                ó   • [        XUS9$ r2   )r.   )r5   r6   r   s      r    Ú
new_streamr\   —   s   € Ü" 4Ø+2ñ4ð 4r#   z5Create an Arrow columnar IPC stream writer instance

zS

Returns
-------
writer : RecordBatchStreamWriter
    A writer for the given sink
r   c                ó   • [        XUS9$ )aß  
Create reader for Arrow streaming format.

Parameters
----------
source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object
    Either an in-memory buffer, or a readable file object.
options : pyarrow.ipc.IpcReadOptions
    Options for IPC serialization.
    If None, default values will be used.
memory_pool : MemoryPool, default None
    If None, default memory pool is used.

Returns
-------
reader : RecordBatchStreamReader
    A reader for the given source
r   )r   )r   r   r   s      r    Úopen_streamr^   ¨   s   € ô& # 6Ø/:ñ<ð <r#   rD   c                ó   • [        XX#S9$ rG   )rB   )r5   r6   r   rE   s       r    Únew_filer`   ¿   s   € Ü  °wÑRÐRr#   z3Create an Arrow columnar IPC file writer instance

zQ

Returns
-------
writer : RecordBatchFileWriter
    A writer for the given sink
c                ó   • [        XX#S9$ )ai  
Create reader for Arrow file format.

Parameters
----------
source : bytes/buffer-like, pyarrow.NativeFile, or file-like Python object
    Either an in-memory buffer, or a readable file object.
footer_offset : int, default None
    If the file is embedded in some larger file, this is the byte offset to
    the very end of the file data.
options : pyarrow.ipc.IpcReadOptions
    Options for IPC serialization.
    If None, default values will be used.
memory_pool : MemoryPool, default None
    If None, default memory pool is used.

Returns
-------
reader : RecordBatchFileReader
    A reader for the given source
r=   )r:   )r   r>   r   r   s       r    Ú	open_filerb   Ï   s   € ô, !ØØñ2ð 2r#   ©ÚnthreadsÚpreserve_indexc                ó<  • [         R                  R                  XUS9n[         R                  " 5       n[         R                  " XCR
                  5       nUR                  U5        SSS5        UR                  5       $ ! , (       d  f       UR                  5       $ = f)a`  
Serialize a pandas DataFrame into a buffer protocol compatible object.

Parameters
----------
df : pandas.DataFrame
nthreads : int, default None
    Number of threads to use for conversion to Arrow, default all CPUs.
preserve_index : bool, default None
    The default of None will store the index as a column, except for
    RangeIndex which is stored as metadata only. If True, always
    preserve the pandas index data as a column. If False, no index
    information is saved and the result will have a default RangeIndex.

Returns
-------
buf : buffer
    An object compatible with the buffer protocol.
rc   N)ÚpaÚRecordBatchÚfrom_pandasÚBufferOutputStreamr.   r6   Úwrite_batchÚgetvalue)Údfrd   re   Úbatchr5   Úwriters         r    Úserialize_pandasrp   ê   sy   € ô( �N‰N×&Ñ& rØ6Dð 'ð F€Eä× Ò Ó"€DÜ	×	#Ò	# D¯,©,Ô	7¸6Ø×Ñ˜5Ô!÷ 
8à�=‰=‹?Ð÷ 
8Ô	7à�=‰=‹?Ðús   ÁA>Á>
BT©Úuse_threadsc                óÌ   • [         R                  " U 5      n[         R                  " U5       nUR                  5       nSSS5        WR	                  US9$ ! , (       d  f       N= f)aZ  Deserialize a buffer protocol compatible object into a pandas DataFrame.

Parameters
----------
buf : buffer
    An object compatible with the buffer protocol.
use_threads : bool, default True
    Whether to parallelize the conversion using multiple threads.

Returns
-------
df : pandas.DataFrame
    The buffer deserialized as pandas DataFrame
Nrq   )rg   ÚBufferReaderr   Úread_allÚ	to_pandas)Úbufrr   Úbuffer_readerÚreaderÚtables        r    Údeserialize_pandasr{     sM   € ô —O’O CÓ(€MÜ	×	#Ò	# MÔ	2°fØ—‘Ó!ˆ÷ 
3à�?‰? {ˆ?Ð3Ð3÷ 
3Õ	2ús   ­AÁ
A#r@   ))rV   Úpyarrowrg   Úpyarrow.libr   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   ÚlibÚ_RecordBatchStreamReaderr   r8   rI   Ú_RecordBatchStreamWriterr.   Ú_RecordBatchFileReaderr:   Ú_RecordBatchFileWriterrB   r4   r   r\   r*   r^   r`   rb   rp   r{   r$   r#   r    Ú<module>rƒ      s)  ðó( 
ã ÷A÷ A÷ A÷ Aõ Aõ ôE˜c×:Ñ:ô Eð*)Ð ð$ Ø
ñð,ñ,ð ô2˜c×:Ñ:ô 2ô=˜C×6Ñ6ô =ô4E˜C×6Ñ6ô Eò>ò'ð )-õ 4ð
ð Ð ð ð	€
Ô ð $(°Tõ <ð. '+°Tõ Sðð Ð ð ð	€Ô ð2°TÀtö 2ð6 &*¸$õ ð8 ,0ö 4r#   