
    'e-H                        d Z ddlZddlZddlZddlZddl	Z
ddlZ	 ddlmZ  ej(                         Z ej,                          ddlmZ er ej4                          ddlmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( d	 Z)d
 Z*d Z+d Z,ddlm-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`maZambZbmcZcmdZdmeZemfZfmgZgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZtmuZumvZvmwZwmxZxmyZymzZzm{Z{m|Z|m}Z}m~Z~mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZ ddlmZmZmZm Z mZmZmZmZ ddlmZmZmZmZm	Z	m
Z
mZmZmZmZmZ ddlmZ ddlmZm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  ej>                         Z dZ!dZ"e dfedfedfedfdZ#d Z$ddl%m&Z&m'Z' dd lm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z. d! Z/d" Z0d# Z1d$ Z2d% Z3d& Z4d' Z5y# e$ r. 	 ddlZd Z ej&                  de      Zn# e$ r dZY nw xY wY Ww xY w)(a  
PyArrow is the python implementation of Apache Arrow.

Apache Arrow is a cross-language development platform for in-memory data.
It specifies a standardized language-independent columnar memory format for
flat and hierarchical data, organized for efficient analytic operations on
modern hardware. It also provides computational libraries and zero-copy
streaming messaging and interprocess communication.

For more information see the official page at https://arrow.apache.org
    N   )versionc                 *    ddl m} d|d<    || fi |S )z
            Parse function for setuptools_scm that ignores tags for non-C++
            subprojects, e.g. apache-arrow-js-XXX tags.
            r   parsezBgit describe --dirty --tags --long --match 'apache-arrow-[0-9]*.*'describe_command)setuptools_scm.gitr   )rootkwargsr   s      0lib/python3.11/site-packages/pyarrow/__init__.py	parse_gitr   /   s%    
 1T %&(((    z../r   )	BuildInfoRuntimeInfoset_timezone_db_pathMonthDayNanoVersionInfocpp_build_infocpp_versioncpp_version_inforuntime_info	cpu_countset_cpu_countenable_signal_handlersio_thread_countset_io_thread_countc                     d } t        d        | dt        t        j                        dkD  rt        j                  nd        | dt        j                          | dt        j
                   dt        j                           | d	t        j                          | d
t        j                          | dt        j                          | dt        j                         y)zJ
    Print various version information, to help with error reporting.
    c                 (    t        | dd|d       y )Nz <26:  <8printlabelvalues     r   print_entryz"show_versions.<locals>.print_entryP   s    tBuSk*+r   z)pyarrow version info
--------------------zPackage kindr   znot indicatedzArrow C++ library versionzArrow C++ compiler zArrow C++ compiler flagszArrow C++ git revisionzArrow C++ git descriptionzArrow C++ build typeN)r"   lenr   package_kindr   compiler_idcompiler_versioncompiler_flagsgit_idgit_description
build_type)r&   s    r   show_versionsr0   L   s    , 

67~223a7 !/ ; ;$& +^-C-CD$!--.a0O0O/PQS*N,I,IJ(.*?*?@+^-K-KL&(A(ABr   c                 T    	 t        j                  d|         y# t        $ r Y yw xY w)Nzpyarrow.TF)
_importlibimport_moduleImportError)modules    r   _module_is_availabler6   `   s5      8F8!45   s    	''c                     	 dd l }	 t        |j                  |        y# t        $ r Y yw xY w# t        t        f$ r Y yw xY w)Nr   FT)
pyarrow.fsr4   getattrfsAttributeError)r:   pyarrows     r   _filesystem_is_availabler=   i   sN    

B   
 ( s    - 	**??c                  `   t                d } t        d        | dt        j                          dt        j                                  | dt               j                          | dt               j                         t               }t        d        | d|j                          | d	|j                          d
        | d|j                          d
        | ddj                  t                            t        d       g d}|D ]$  }t        |      rdnd}t        d|dd|d       & t        d       g d}|D ]$  }t        |      rdnd}t        d|dd|d       & t        d       g d}|D ].  }t!        j"                  |      rdnd}t        d|dd|d       0 y)zN
    Print detailed version and platform information, for error reporting
    c                 *    t        d| dd|d       y )N   <20r   r    r!   r#   s     r   r&   zshow_info.<locals>.print_entry}   s    5,bs,-r   z

Platform:z	OS / Archr'   z
SIMD LevelzDetected SIMD Levelz
Memory:zDefault backendzBytes allocatedz bytesz
Max memoryzSupported Backendsz, z
Optional modules:)
csvcudadatasetfeatherflightr:   gandivajsonorcparquetEnabled-r@   rA   r   r    z
Filesystems:)GcsFileSystemHadoopFileSystemS3FileSystemz
Compression Codecs:)brotlibz2gzip	lz4_framelz4snappyzstdN)r0   r"   	_platformsystemmachiner   
simd_leveldetected_simd_leveldefault_memory_poolbackend_namebytes_allocated
max_memoryjoinsupported_memory_backendsr6   r=   Codecis_available)	r&   poolmodulesr5   statusfilesystemsr:   codecscodecs	            r   	show_inforj   w   s    O. 
-	 0 0 231Y5F5F5H4IJKln778%|~'I'IJ D	+!4#4#45!d&:&:&<%=V#DE!2 36:;$dii0I0K&LM	
 !G 026:6$-r&./0 

GK ,6r:2d)2fS\*+, 

!"LF /#007S5,b-./r   )nullbool_int8int16int32int64uint8uint16uint32uint64time32time64	timestampdate32date64durationmonth_day_nano_intervalfloat16float32float64binarystringutf8large_binarylarge_string
large_utf8
decimal128
decimal256list_
large_listmap_structunionsparse_uniondense_union
dictionaryrun_end_encodedfixed_shape_tensorfieldtype_for_aliasDataTypeDictionaryType
StructTypeListTypeLargeListTypeMapTypeFixedSizeListType	UnionTypeSparseUnionTypeDenseUnionTypeTimestampType
Time32Type
Time64TypeDurationTypeFixedSizeBinaryTypeDecimal128TypeDecimal256TypeBaseExtensionTypeExtensionTypeRunEndEncodedTypeFixedShapeTensorTypePyExtensionTypeUnknownExtensionTyperegister_extension_typeunregister_extension_typeDictionaryMemoKeyValueMetadataFieldSchemaschemaunify_schemasArrayTensorarraychunked_arrayrecord_batchnullsrepeatSparseCOOTensorSparseCSRMatrixSparseCSCMatrixSparseCSFTensor
infer_typefrom_numpy_dtype	NullArrayNumericArrayIntegerArrayFloatingPointArrayBooleanArray	Int8Array
UInt8Array
Int16ArrayUInt16Array
Int32ArrayUInt32Array
Int64ArrayUInt64ArrayHalfFloatArray
FloatArrayDoubleArray	ListArrayLargeListArrayMapArrayFixedSizeListArray
UnionArrayBinaryArrayStringArrayLargeBinaryArrayLargeStringArrayFixedSizeBinaryArrayDictionaryArrayDate32ArrayDate64ArrayTimestampArrayTime32ArrayTime64ArrayDurationArrayMonthDayNanoIntervalArrayDecimal128ArrayDecimal256ArrayStructArrayExtensionArrayRunEndEncodedArrayFixedShapeTensorArrayscalarNA_NULLScalar
NullScalarBooleanScalar
Int8ScalarInt16ScalarInt32ScalarInt64ScalarUInt8ScalarUInt16ScalarUInt32ScalarUInt64ScalarHalfFloatScalarFloatScalarDoubleScalarDecimal128ScalarDecimal256Scalar
ListScalarLargeListScalarFixedSizeListScalarDate32ScalarDate64ScalarTime32ScalarTime64ScalarTimestampScalarDurationScalarMonthDayNanoIntervalScalarBinaryScalarLargeBinaryScalarStringScalarLargeStringScalarFixedSizeBinaryScalarDictionaryScalar	MapScalarStructScalarUnionScalarRunEndEncodedScalarExtensionScalar)BufferResizableBufferforeign_buffer	py_bufferrb   compress
decompressallocate_buffer)
MemoryPoolLoggingMemoryPoolProxyMemoryPooltotal_allocated_bytesset_memory_poolr\   system_memory_pooljemalloc_memory_poolmimalloc_memory_poollogging_memory_poolproxy_memory_poollog_memory_allocationsjemalloc_set_decay_msra   )
NativeFile
PythonFileBufferedInputStreamBufferedOutputStreamCompressedInputStreamCompressedOutputStreamTransformInputStreamtranscoding_input_streamFixedSizeBufferWriterBufferReaderBufferOutputStreamOSFileMemoryMappedFile
memory_mapcreate_memory_mapMockOutputStreaminput_streamoutput_stream)HdfsFilehave_libhdfs)ChunkedArrayRecordBatchTabletableconcat_arraysconcat_tablesTableGroupByRecordBatchReader)ArrowCancelledArrowCapacityErrorArrowExceptionArrowKeyErrorArrowIndexErrorArrowInvalidArrowIOErrorArrowMemoryErrorArrowNotImplementedErrorArrowTypeErrorArrowSerializationError)serialize_pandasdeserialize_pandas)
FileSystem)LocalFileSystem)rN   zIpyarrow.{0} is deprecated as of 2.0.0, please use pyarrow.fs.{1} instead.zy'pyarrow.{0}' is deprecated and will be removed in a future version. Use pickle or the pyarrow IPC functionality instead.rL  rK  rN   )localfsrK  rL  rN   c                     | t         v r>t         |    \  }}t        j                  t        j	                  | |      t
        d       |S t        dj	                  |             )N   )
stacklevelz'module 'pyarrow' has no attribute '{0}')_deprecated	_warningswarn_msgformatFutureWarningr;   )nameobjnew_names      r   __getattr__rZ  6  sV    {#D)Xt{{42$	4

188> r   )_deprecate_api_deprecate_class)MessageMessageReaderMetadataVersionRecordBatchFileReaderRecordBatchFileWriterRecordBatchStreamReaderRecordBatchStreamWriterc                      t         j                  j                  t         j                  j                  t              d      S )zr
    Return absolute path to directory containing Arrow C++ include
    headers. Similar to numpy.get_include
    include)_ospathr`   dirname__file__ r   r   get_includerk  R  s(    
 88==))(3Y??r   c                  B    t         j                  j                  dd      S )N
PKG_CONFIG
pkg-config)rf  environgetrj  r   r   _get_pkg_config_executablerq  Z  s    ;;??<66r   c                 h    dd l }	 |j                  t               d| g      dk(  S # t        $ r Y yw xY w)Nr   z--existsF)
subprocesscallrq  FileNotFoundError)pkgnamers  s     r   _has_pkg_configrw  ^  sE     : < *G 5 69:; 	; s   % 	11c                 4   dd l }t               | g|z   }|j                  ||j                  |j                        }|j	                         \  }}|j
                  dk7  rt        d|j                  d      z         |j                         j                  d      S )Nr   )stdoutstderrzpkg-config failed: r   )	rs  rq  PopenPIPEcommunicate
returncodeRuntimeErrordecoderstrip)rv  cli_argsrs  cmdprocouterrs          r   _read_pkg_config_variabler  g  s    %'
1H
<CC
#-??  4D!HC!03::f3EEFF::<v&&r   c                  
    ddgS )zz
    Return list of library names to include in the `libraries` argument for C
    or Cython extensions using pyarrow
    arrow_pythonarrowrj  rj  r   r   get_librariesr  r  s    
 G$$r   c                  *   ddl } t        j                  dk(  ryt        j                  j                  t              }t        j                  dk(  r3| j                  t        j                  j                  |d            }d }n2| j                  t        j                  j                  |d            }d }|D ]A  } ||      }t        j                  j                  |      r+	 t        j                  ||       C y# t        $ r t        d	       Y [w xY w)
a#  
    With Linux and macOS wheels, the bundled shared libraries have an embedded
    ABI version like libarrow.so.17 or libarrow.17.dylib and so linking to them
    with -larrow won't work unless we create symlinks at locations like
    site-packages/pyarrow/libarrow.so. This unfortunate workaround addresses
    prior problems we had with shipping two copies of the shared libraries to
    permit third party projects like turbodbc to build their C++ extensions
    against the pyarrow wheels.

    This function must only be invoked once and only when the shared libraries
    are bundled with the Python package, which should only apply to wheel-based
    installs. It requires write access to the site-packages/pyarrow directory
    and so depending on your system may need to be run with root.
    r   Nwin32linuxz*.so.*c                 ,    | j                  dd      d   S )N.r   r   )rsplit	hard_paths    r   get_symlink_pathz1create_library_symlinks.<locals>.get_symlink_path  s    ##C+A..r   z	*.*.dylibc                 N    dj                  | j                  dd      d   df      S )Nr  rO  r   dylib)r`   r  r  s    r   r  z1create_library_symlinks.<locals>.get_symlink_path  s(    88Y--c15a8'BCCr   zyTried creating symlink {}. If you need to link to bundled shared libraries, run pyarrow.create_library_symlinks() as root)glob_sysplatformrf  rg  rh  ri  r`   existssymlinkPermissionErrorr"   )r  package_cwdbundled_libsr  lib_hard_pathsymlink_paths         r   create_library_symlinksr  z  s     }}((""8,K}}yy{H!EF	/ yy{K!HI	D & 	?'688??<(	?KK|4	?  	? > ?	?s   "C;;DDc                     t         j                  j                  t              } | gfd}t         j                  j                  d      xs d}dD ]T  }t        |      st        |dg      }|s|j                  d      st        dj                  |             ||dd	        V t        j                  d
k(  rt         j                  j                  t        j                        }t         j                  j                  |dd      }t         j                  j                  t         j                  j                  |d            r ||       t         j                  j                  d      r9 |t         j                  j                  t         j                  d   d             S  |t         j                  j                  t         j                  j!                  t                           S )z
    Return lists of directories likely to contain Arrow C++ libraries for
    linking C or Cython extensions using pyarrow
    c                 2    | vrj                  |        y y )N)append)library_dirlibrary_dirss    r   append_library_dirz,get_library_dirs.<locals>.append_library_dir  s    l*, +r   rm  rn  )r  r  z--libs-only-Lz-Lz7pkg-config --libs-only-L returned unexpected value {!r}rO  Nr  Librarylibz	arrow.lib
ARROW_HOME)rf  rg  rh  ri  ro  rp  rw  r  
startswith
ValueErrorrU  r  r  
executabler`   r  abspath)r  r  pkg_config_executablerv  r  python_base_installr  s         @r   get_library_dirsr    sw   
 ((""8,K=L-  KKOOL9I\, 47#3G5D4EGK "--d3$%%+VK%8: : #;qr?34 }} "hh..t?hhmm$7EJ88??388==kBC{+ {{|$388==\)BEJK
  	388++CHH,<,<X,FGHr   (6  __doc__gc_gc	importlibr2   osrf  r  rW   sysr  warningsrR  _generated_versionr   __version__r4   setuptools_scmr   get_version	isenabled_gc_enableddisablepyarrow.libr  _libenabler   r   r   r   r   r   r   r   r   r   r   r   r   r   r0   r6   r=   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   NULLr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r  r  r  r	  r
  r  r  r  r  r  r  r  r  rb   r  r  r  r  r  r  r  r  r\   r  r  r  r  r  r   r!  ra   r"  r#  r$  r%  r&  r'  r(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  pyarrow._hdfsior4  r5  r6  r7  r8  r9  r:  r;  r<  r=  r>  r?  r@  rA  rB  rC  rD  rE  rF  rG  rH  pyarrow.hdfshdfspyarrow.ipcrI  rJ  ipcpyarrow.typestypespyarrow.filesystemrK  _FileSystemrL  _LocalFileSystemrN   _HadoopFileSystem_get_instance_localfsrT  _serialization_msgrQ  rZ  pyarrow.utilr[  r\  r]  r^  r_  r`  ra  rb  rc  rk  rq  rw  r  r  r  r  rj  r   r   <module>r     s  (
      :. cmmo  CJJL? ? ? ?C(&/RF? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F? F?RG G G4 4 4 46 6 6 6 6 3, , , ,

2 
2 
2 
2 
2 
2   < <     9 8 B B > > *))+ P 
;  +,-(*;<*,>?		 : 9K K K K K@7'%(?V-y  	) 1n007@B #s5   M M:M)(M:)M30M:2M33M:9M: