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S )5a  
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< || f|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]*.*'Zdescribe_command)Zsetuptools_scm.gitr   )rootkwargsr    r   Q/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/pyarrow/__init__.py	parse_git/   s    r
   z../r   )	BuildInfoRuntimeInfoMonthDayNanoVersionInfocpp_build_infocpp_versioncpp_version_inforuntime_info	cpu_countset_cpu_countenable_signal_handlersio_thread_countset_io_thread_countc                  C   s   dd } t d | dttjdkr(tjnd | 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   s    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   Zpackage_kindr   Zcompiler_idZcompiler_versionZcompiler_flagsZgit_idZgit_descriptionZ
build_type)r   r   r   r	   show_versionsL   s    r"   c                 C   s4   zt d|   W n tk
r*   Y dS X dS d S )Nzpyarrow.FT)
_importlibimport_moduleImportError)moduler   r   r	   _module_is_available`   s
    r'   c              	   C   sX   zdd l }W n tk
r"   Y dS X zt|j|  W n ttfk
rN   Y dS X dS d S )Nr   FT)Z
pyarrow.fsr%   getattrfsAttributeError)r)   Zpyarrowr   r   r	   _filesystem_is_availablei   s    r+   c            	   
   C   s  t   dd } td | dt  dt   | dt j | dt j t }td | d	|j	 | d
|
  d | d|  d | ddt  td ddddddddddg
}|D ],}t|rdnd}td|dd|d qtd  d!d"d#g}|D ]0}t|rdnd}td|dd|d q
td$ d%d&d'd(d)d*d+g}|D ]2}t|rndnd}td|dd|d qZd,S )-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:csvcudaZdatasetZfeatherZflightr)   ZgandivajsonZorcZparquetZEnabled-r,   r-   r   r   z
Filesystems:ZGcsFileSystemHadoopFileSystemZS3FileSystemz
Compression Codecs:brotlibz2gzipZ	lz4_frameZlz4ZsnappyZzstdN)r"   r   	_platformsystemmachiner   Z
simd_levelZdetected_simd_leveldefault_memory_poolbackend_nameZbytes_allocatedZ
max_memoryjoinsupported_memory_backendsr'   r+   CodecZis_available)	r   poolmodulesr&   statusZfilesystemsr)   codecscodecr   r   r	   	show_infow   s<     
rC   )nullbool_int8int16int32int64uint8uint16uint32uint64time32time64	timestampdate32date64durationmonth_day_nano_intervalfloat16float32float64binarystringutf8large_binarylarge_string
large_utf8
decimal128
decimal256list_
large_listmap_structunionsparse_uniondense_union
dictionaryrun_end_encodedfixed_shape_tensorfieldtype_for_aliasDataTypeDictionaryType
StructTypeListTypeLargeListTypeMapTypeFixedSizeListType	UnionTypeSparseUnionTypeDenseUnionTypeTimestampType
Time32Type
Time64TypeDurationTypeFixedSizeBinaryTypeDecimal128TypeDecimal256TypeBaseExtensionTypeExtensionTypeRunEndEncodedTypeFixedShapeTensorTypePyExtensionTypeUnknownExtensionTyperegister_extension_typeunregister_extension_typeDictionaryMemoKeyValueMetadataFieldSchemaschemaunify_schemasArrayTensorarraychunked_arrayrecord_batchnullsrepeatSparseCOOTensorSparseCSRMatrixSparseCSCMatrixSparseCSFTensor
infer_typefrom_numpy_dtype	NullArrayNumericArrayIntegerArrayFloatingPointArrayBooleanArray	Int8Array
UInt8Array
Int16ArrayUInt16Array
Int32ArrayUInt32Array
Int64ArrayUInt64ArrayHalfFloatArray
FloatArrayDoubleArray	ListArrayLargeListArrayMapArrayFixedSizeListArray
UnionArrayBinaryArrayStringArrayLargeBinaryArrayLargeStringArrayFixedSizeBinaryArrayDictionaryArrayDate32ArrayDate64ArrayTimestampArrayTime32ArrayTime64ArrayDurationArrayMonthDayNanoIntervalArrayDecimal128ArrayDecimal256ArrayStructArrayExtensionArrayRunEndEncodedArrayFixedShapeTensorArrayscalarNA_NULLScalar
NullScalarBooleanScalar
Int8ScalarInt16ScalarInt32ScalarInt64ScalarUInt8ScalarUInt16ScalarUInt32ScalarUInt64ScalarHalfFloatScalarFloatScalarDoubleScalarDecimal128ScalarDecimal256Scalar
ListScalarLargeListScalarFixedSizeListScalarDate32ScalarDate64ScalarTime32ScalarTime64ScalarTimestampScalarDurationScalarMonthDayNanoIntervalScalarBinaryScalarLargeBinaryScalarStringScalarLargeStringScalarFixedSizeBinaryScalarDictionaryScalar	MapScalarStructScalarUnionScalarRunEndEncodedScalarExtensionScalar)BufferResizableBufferforeign_buffer	py_bufferr=   compress
decompressallocate_buffer)
MemoryPoolLoggingMemoryPoolProxyMemoryPooltotal_allocated_bytesset_memory_poolr9   system_memory_pooljemalloc_memory_poolmimalloc_memory_poollogging_memory_poolproxy_memory_poollog_memory_allocationsjemalloc_set_decay_msr<   )
NativeFile
PythonFileBufferedInputStreamBufferedOutputStreamCompressedInputStreamCompressedOutputStreamTransformInputStreamtranscoding_input_streamFixedSizeBufferWriterBufferReaderBufferOutputStreamOSFileMemoryMappedFile
memory_mapcreate_memory_mapMockOutputStreaminput_streamoutput_stream)HdfsFilehave_libhdfs)ChunkedArrayRecordBatchTabletableconcat_arraysconcat_tablesTableGroupByRecordBatchReader)ArrowCancelledArrowCapacityErrorArrowExceptionArrowKeyErrorArrowIndexErrorArrowInvalidArrowIOErrorArrowMemoryErrorArrowNotImplementedErrorArrowTypeErrorArrowSerializationError)serialize_pandasdeserialize_pandas)
FileSystem)LocalFileSystem)r2   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.r%  r$  r2   )Zlocalfsr$  r%  r2   c                 C   sB   | t kr0t |  \}}tjt| |tdd |S td| d S )N   )
stacklevelz'module 'pyarrow' has no attribute '{0}')_deprecated	_warningswarn_msgformatFutureWarningr*   )nameobjnew_namer   r   r	   __getattr__6  s     r1  )_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)_ospathr;   dirname__file__r   r   r   r	   get_includeR  s    r@  c                   C   s   t jddS )N
PKG_CONFIG
pkg-config)r<  environgetr   r   r   r	   _get_pkg_config_executableZ  s    rE  c                 C   s<   dd l }z|t d| gdkW S  tk
r6   Y dS X d S )Nr   z--existsF)
subprocesscallrE  FileNotFoundError)pkgnamerF  r   r   r	   _has_pkg_config^  s     rJ  c                 C   s`   dd l }t | g| }|j||j|jd}| \}}|jdkrRtd|d | dS )Nr   )stdoutstderrzpkg-config failed: rZ   )	rF  rE  PopenPIPEcommunicate
returncodeRuntimeErrordecoderstrip)rI  Zcli_argsrF  cmdprocouterrr   r   r	   _read_pkg_config_variableg  s    

rX  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_librariesr  s    r[  c               	   C   s   ddl } tjdkrdS tjt}tjdkrJ|  tj|d}dd }n|  tj|d}d	d }|D ]H}||}tj|rqjzt	|| W qj t
k
r   td
 Y qjX qjdS )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   )rsplitZ	hard_pathr   r   r	   get_symlink_path  s    z1create_library_symlinks.<locals>.get_symlink_pathz	*.*.dylibc                 S   s   d | ddd dfS )Nr^  r&  r   Zdylib)r;   r_  r`  r   r   r	   ra    s    zyTried creating symlink {}. If you need to link to bundled shared libraries, run pyarrow.create_library_symlinks() as root)glob_sysplatformr<  r=  r>  r?  r;   existssymlinkPermissionErrorr   )rb  package_cwdZbundled_libsra  Zlib_hard_pathZsymlink_pathr   r   r	   create_library_symlinksz  s"    


ri  c                     s   t jt} | g  fdd}t jdp,d}dD ]D}t|r2t|dg}|r2|dsft	d
|||d	d
  q2tjdkrt jtj}t j|dd}t jt j|dr|| t jdr|t jt jd d n|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   |  kr  |  d S )N)append)library_dirlibrary_dirsr   r	   append_library_dir  s    z,get_library_dirs.<locals>.append_library_dirrA  rB  )rZ  rY  z--libs-only-Lz-Lz7pkg-config --libs-only-L returned unexpected value {!r}r&  Nr\  Librarylibz	arrow.libZ
ARROW_HOME)r<  r=  r>  r?  rC  rD  rJ  rX  
startswith
ValueErrorr,  rc  rd  
executabler;   re  abspath)rh  rn  Zpkg_config_executablerI  rk  Zpython_base_installr   rl  r	   get_library_dirs  s4    

ru  (5  __doc__gcZ_gc	importlibr#   osr<  rd  r6   sysrc  warningsr)  Z_generated_versionr   __version__r%   Zsetuptools_scmr
   get_version	isenabledZ_gc_enableddisableZpyarrow.librp  Z_libenabler   r   r   r   r   r   r   r   r   r   r   r   r   r"   r'   r+   rC   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`   ra   rb   rc   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   ZNULLr   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   r9   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  Zpyarrow._hdfsior  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r!  Zpyarrow.hdfsZhdfsZpyarrow.ipcr"  r#  ZipcZpyarrow.typestypesZpyarrow.filesystemr$  Z_FileSystemr%  Z_LocalFileSystemr2   Z_HadoopFileSystemZ_get_instanceZ_localfsr+  Z_serialization_msgr(  r1  Zpyarrow.utilr2  r3  r4  r5  r6  r7  r8  r9  r:  r@  rE  rJ  rX  r[  ri  ru  r   r   r   r	   <module>   s~   	
<	)  I(@	P
8`
B	


	


+