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>Z> ddl?m@Z@ ddlAmBZBmCZC ddl;mDZDmEZEmFZFmGZGmHZHmIZImJZJ dd ZKdd ZLd d! ZMd"d# ZNd$d% ZOd&d' ZPd(d) ZQdS )*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                 K   s$   ddl m} d|d< || fi |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   )rootkwargsr    r
   D/var/www/vscode/kcb/lib/python3.10/site-packages/pyarrow/__init__.py	parse_git/   s   r   z../r   )	BuildInfoRuntimeInfoset_timezone_db_pathMonthDayNanoVersionInfocpp_build_infocpp_versioncpp_version_inforuntime_info	cpu_countset_cpu_countenable_signal_handlersio_thread_countset_io_thread_countc                  C   s   dd } t d | dttjdkrtjnd | dtj | dtj d	tj  | d
tj | dtj | dtj	 | dtj
 dS )zJ
    Print various version information, to help with error reporting.
    c                 S   s   t | dd|d d S )Nz <26:  <8printlabelvaluer
   r
   r   print_entryP      z"show_versions.<locals>.print_entryz)pyarrow version info
--------------------zPackage kindr   znot indicatedzArrow C++ library versionzArrow C++ compiler zArrow C++ compiler flagszArrow C++ git revisionzArrow C++ git descriptionzArrow C++ build typeN)r   lenr   package_kindr   compiler_idcompiler_versioncompiler_flagsgit_idgit_description
build_type)r"   r
   r
   r   show_versionsL   s   r-   c                 C   s,   zt d|   W dS  ty   Y dS w )Nzpyarrow.FT)
_importlibimport_moduleImportError)moduler
   r
   r   _module_is_available`   s   r2   c              	   C   sN   zdd l }W n
 ty   Y dS w z	t|j|  W dS  ttfy&   Y dS w )Nr   FT)
pyarrow.fsr0   getattrfsAttributeError)r5   pyarrowr
   r
   r   _filesystem_is_availablei   s   r8   c            	      C   sn  t   dd } td | dt  dt   | dt j | dt j t }td | d	|j	 | d
|
  d | d|  d | ddt  td g d}|D ]}t|rcdnd}td|dd|d q[td g d}|D ]}t|rdnd}td|dd|d q|td g d}|D ]}t|rdnd}td|dd|d qdS )zN
    Print detailed version and platform information, for error reporting
    c                 S   s   t d| dd|d d S )N   <20r   r   r   r   r
   r
   r   r"   }   s   zshow_info.<locals>.print_entryz

Platform:z	OS / Archr$   z
SIMD LevelzDetected SIMD Levelz
Memory:zDefault backendzBytes allocatedz bytesz
Max memoryzSupported Backendsz, z
Optional modules:)
csvcudadatasetfeatherflightr5   gandivajsonorcparquetEnabled-r9   r:   r   r   z
Filesystems:)AzureFileSystemGcsFileSystemHadoopFileSystemS3FileSystemz
Compression Codecs:)brotlibz2gzip	lz4_framelz4snappyzstdN)r-   r   	_platformsystemmachiner   
simd_leveldetected_simd_leveldefault_memory_poolbackend_namebytes_allocated
max_memoryjoinsupported_memory_backendsr2   r8   Codecis_available)	r"   poolmodulesr1   statusfilesystemsr5   codecscodecr
   r
   r   	show_infow   s8   rd   )nullbool_int8int16int32int64uint8uint16uint32uint64time32time64	timestampdate32date64durationmonth_day_nano_intervalfloat16float32float64binarystringutf8binary_viewstring_viewlarge_binarylarge_string
large_utf8	decimal32	decimal64
decimal128
decimal256list_
large_list	list_viewlarge_list_viewmap_structunionsparse_uniondense_union
dictionaryrun_end_encodedbool8fixed_shape_tensorjson_opaqueuuidfieldtype_for_aliasDataTypeDictionaryType
StructTypeListTypeLargeListTypeFixedSizeListTypeListViewTypeLargeListViewTypeMapType	UnionTypeSparseUnionTypeDenseUnionTypeTimestampType
Time32Type
Time64TypeDurationTypeFixedSizeBinaryTypeDecimal32TypeDecimal64TypeDecimal128TypeDecimal256TypeBaseExtensionTypeExtensionTypeRunEndEncodedType	Bool8TypeFixedShapeTensorTypeJsonType
OpaqueTypeUuidTypePyExtensionTypeUnknownExtensionTyperegister_extension_typeunregister_extension_typeDictionaryMemoKeyValueMetadataFieldSchemaschemaunify_schemasArrayTensorarraychunked_arrayrecord_batchnullsrepeatSparseCOOTensorSparseCSRMatrixSparseCSCMatrixSparseCSFTensor
infer_typefrom_numpy_dtype	NullArrayNumericArrayIntegerArrayFloatingPointArrayBooleanArray	Int8Array
UInt8Array
Int16ArrayUInt16Array
Int32ArrayUInt32Array
Int64ArrayUInt64ArrayHalfFloatArray
FloatArrayDoubleArray	ListArrayLargeListArrayFixedSizeListArrayListViewArrayLargeListViewArrayMapArray
UnionArrayBinaryArrayStringArrayLargeBinaryArrayLargeStringArrayBinaryViewArrayStringViewArrayFixedSizeBinaryArrayDictionaryArrayDate32ArrayDate64ArrayTimestampArrayTime32ArrayTime64ArrayDurationArrayMonthDayNanoIntervalArrayDecimal32ArrayDecimal64ArrayDecimal128ArrayDecimal256ArrayStructArrayExtensionArrayRunEndEncodedArray
Bool8ArrayFixedShapeTensorArray	JsonArrayOpaqueArray	UuidArrayscalarNA_NULLScalar
NullScalarBooleanScalar
Int8ScalarInt16ScalarInt32ScalarInt64ScalarUInt8ScalarUInt16ScalarUInt32ScalarUInt64ScalarHalfFloatScalarFloatScalarDoubleScalarDecimal32ScalarDecimal64ScalarDecimal128ScalarDecimal256Scalar
ListScalarLargeListScalarFixedSizeListScalarListViewScalarLargeListViewScalarDate32ScalarDate64ScalarTime32ScalarTime64ScalarTimestampScalarDurationScalarMonthDayNanoIntervalScalarBinaryScalarLargeBinaryScalarBinaryViewScalarStringScalarLargeStringScalarStringViewScalarFixedSizeBinaryScalarDictionaryScalar	MapScalarStructScalarUnionScalarRunEndEncodedScalarBool8ScalarExtensionScalarFixedShapeTensorScalar
JsonScalarOpaqueScalar
UuidScalar)DeviceAllocationTypeDeviceMemoryManagerdefault_cpu_memory_manager)BufferResizableBufferforeign_buffer	py_bufferr\   compress
decompressallocate_buffer)
MemoryPoolLoggingMemoryPoolProxyMemoryPooltotal_allocated_bytesset_memory_poolrV   system_memory_pooljemalloc_memory_poolmimalloc_memory_poollogging_memory_poolproxy_memory_poollog_memory_allocationsjemalloc_set_decay_msr[   )
NativeFile
PythonFileBufferedInputStreamBufferedOutputStreamCacheOptionsCompressedInputStreamCompressedOutputStreamTransformInputStreamtranscoding_input_streamFixedSizeBufferWriterBufferReaderBufferOutputStreamOSFileMemoryMappedFile
memory_mapcreate_memory_mapMockOutputStreaminput_streamoutput_streamhave_libhdfs)	ChunkedArrayRecordBatchTabletableconcat_arraysconcat_tablesTableGroupByRecordBatchReaderconcat_batches)ArrowCancelledArrowCapacityErrorArrowExceptionArrowKeyErrorArrowIndexErrorArrowInvalidArrowIOErrorArrowMemoryErrorArrowNotImplementedErrorArrowTypeErrorArrowSerializationError)serialize_pandasdeserialize_pandas)_deprecate_api_deprecate_class)MessageMessageReaderMetadataVersionRecordBatchFileReaderRecordBatchFileWriterRecordBatchStreamReaderRecordBatchStreamWriterc                   C   s   t jt jtdS )zr
    Return absolute path to directory containing Arrow C++ include
    headers. Similar to numpy.get_include
    include)_ospathrZ   dirname__file__r
   r
   r
   r   get_include5  s   r  c                   C   s   t jddS )N
PKG_CONFIG
pkg-config)r{  environgetr
   r
   r
   r   _get_pkg_config_executable=  s   r  c                 C   s6   dd l }z|t d| gdkW S  ty   Y dS w )Nr   z--existsF)
subprocesscallr  FileNotFoundError)pkgnamer  r
   r
   r   _has_pkg_configA  s   r  c                 C   s`   dd l }t | g| }|j||j|jd}| \}}|jdkr)td|d | dS )Nr   )stdoutstderrzpkg-config failed: r{   )	r  r  PopenPIPEcommunicate
returncodeRuntimeErrordecoderstrip)r  cli_argsr  cmdprocouterrr
   r
   r   _read_pkg_config_variableJ  s   

r  c                   C   s   ddgS )zz
    Return list of library names to include in the `libraries` argument for C
    or Cython extensions using pyarrow
    arrow_pythonarrowr
   r
   r
   r
   r   get_librariesU  s   r  c               	   C   s   ddl } tjdkrdS tjt}tjdkr%|  tj|d}dd }n|  tj|d}d	d }|D ]"}||}tj|rBq5zt	|| W q5 t
yW   td
 Y q5w dS )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   Nwin32linuxz*.so.*c                 S   s   |  ddd S )N.r   r   )rsplit	hard_pathr
   r
   r   get_symlink_patht  s   z1create_library_symlinks.<locals>.get_symlink_pathz	*.*.dylibc                 S   s   d | ddd dfS )Nr     r   dylib)rZ   r  r  r
   r
   r   r  y  r#   zyTried creating symlink {}. If you need to link to bundled shared libraries, run pyarrow.create_library_symlinks() as root)glob_sysplatformr{  r|  r}  r~  rZ   existssymlinkPermissionErrorr   )r  package_cwdbundled_libsr  lib_hard_pathsymlink_pathr
   r
   r   create_library_symlinks]  s&   


r  c                     s  t jt} | g  fdd}t jdpd}dD ]"}t|r;t|dg}|r;|ds3t	d
|||d	d
  qtjdkr_t jtj}t j|dd}t jt j|dr_|| t jdrs|t jt jd d  S |t jt jt  S )z
    Return lists of directories likely to contain Arrow C++ libraries for
    linking C or Cython extensions using pyarrow
    c                    s   |  vr  |  d S d S )N)append)library_dirlibrary_dirsr
   r   append_library_dir  s   z,get_library_dirs.<locals>.append_library_dirr  r  )r  r  z--libs-only-Lz-Lz7pkg-config --libs-only-L returned unexpected value {!r}r  Nr  Librarylibz	arrow.lib
ARROW_HOME)r{  r|  r}  r~  r  r  r  r  
startswith
ValueErrorformatr  r  
executablerZ   r  abspath)r  r  pkg_config_executabler  r  python_base_installr
   r  r   get_library_dirs  s6   

r  (R  __doc__gc_gc	importlibr.   osr{  r  rQ   sysr  warnings	_warnings_generated_versionr   __version__r0   setuptools_scmr   get_version	isenabled_gc_enableddisablepyarrow.libr  _libenabler   r   r   r   r   r   r   r   r   r   r   r   r   r   r-   r2   r8   rd   re   rf   rg   rh   ri   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   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(  r)  r*  r+  r,  r-  r.  r/  r0  r1  r2  r3  r4  r5  r6  r7  r\   r8  r9  r:  r;  r<  r=  r>  r?  rV   r@  rA  rB  rC  rD  rE  rF  r[   rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  rZ  r[  r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rh  ri  rj  rk  rl  rm  rn  pyarrow.ipcro  rp  ipcpyarrow.typestypespyarrow.utilrq  rr  rs  rt  ru  rv  rw  rx  ry  r  r  r  r  r  r  r  r
   r
   r
   r   <module>   sj   	
@	*  : S<x	P`B
	


	

+