ó
    a‡Ej|:  ã                   ó  • S r SSKJrJ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  \r/ r SSKJr   SSKJr   SSKJr   SS
KJrJrJrJrJrJ r J!r!J"r"J#r#J$r$  SSK%r%\%RL                  " \"5        S r'SS.S jr(SSS.S jjr) SSSS.S jjr* " S S\5      r+g! \ a    \R+                  S5         N€f = f! \ a    \R+                  S5         N–f = f! \ a    \R+                  S	5         N¬f = f! \ a    \R+                  S5         Nšf = f)zO
FileSystem abstraction to interact with various local and remote filesystems.
é    )Ú_is_path_likeÚ_stringify_path)ÚFileSelectorÚFileTypeÚFileInfoÚ
FileSystemÚLocalFileSystemÚSubTreeFileSystemÚ_MockFileSystemÚFileSystemHandlerÚPyFileSystemÚ_copy_filesÚ_copy_files_selector)ÚAzureFileSystemr   )ÚHadoopFileSystemr   )ÚGcsFileSystemr   )
ÚAwsDefaultS3RetryStrategyÚAwsStandardS3RetryStrategyÚS3FileSystemÚ
S3LogLevelÚS3RetryStrategyÚensure_s3_initializedÚfinalize_s3Úensure_s3_finalizedÚinitialize_s3Úresolve_s3_regionNr   c                 óR   • U [         ;   a  [        SU  S35      e[        SU  S35      e)Nz8The pyarrow installation is not built with support for 'Ú'z&module 'pyarrow.fs' has no attribute ')Ú_not_importedÚImportErrorÚAttributeError)Únames    ÚG/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pyarrow/fs.pyÚ__getattr__r$   I   sC   € ØŒ}ÓÜðØˆv�Qðó
ð 	
ô
 Ø
0°°°aÐ8óð ó    F©Úuse_mmapc          	      óÀ  • [        U [        5      (       a  U $ [        U [        5      (       aµ  U(       a  [        S5      e[        R                  " U 5      u  p#UR                  U5      nU(       aq  UR                  U/5      S   nUR                  [        R                  :w  a3  [        SUR                  R                   SUR                   SU  S35      e[        XB5      nU$  SS Kn[        XR                  5      (       a6  [        U 5      R                  S:X  a	  [!        US9$ [#        [%        U 5      5      $  [)        S	[        U 5       S
35      e! [&         a     N$f = f)NzXSpecifying to use memory mapping not supported for filesystem specified as an URI stringr   zWThe path component of the filesystem URI must point to a directory but it has a type: `z`. The path component is `z#` and the given filesystem URI is `Ú`r	   r&   zUnrecognized filesystem: zP. `filesystem` argument must be a FileSystem instance or a valid file system URI)Ú
isinstancer   ÚstrÚ
ValueErrorÚfrom_uriÚnormalize_pathÚget_file_infoÚtyper   Ú	Directoryr"   Úpathr
   ÚfsspecÚAbstractFileSystemÚ__name__r	   r   ÚFSSpecHandlerr    Ú	TypeError)Ú
filesystemr'   Úfsr2   ÚprefixÚprefix_infor3   s          r#   Ú_ensure_filesystemr<   U   so  € Ü�*œj×)Ñ)ØÐÜ	�J¤×	$Ñ	$ö Üð8óð ô ×&Ò& zÓ2‰ˆØ×"Ñ" 4Ó(ˆÞà×*Ñ*¨F¨8Ó4°QÑ7ˆKØ×Ñ¤8×#5Ñ#5Ó5Ü ð5Ø5@×5EÑ5E×5JÑ5JÐ4Kð L%Ø%0×%5Ñ%5Ð$6ð 7Ø%˜, að)óð ô # 6Ó.ˆBØˆ	ð		?Ûô ˜*×&?Ñ&?×@Ñ@Ü˜
Ó#×,Ñ,Ð0AÓAä*°HÑ=Ð=Ü#¤M°*Ó$=Ó>Ð>ð	 Aô Ø'¬¨ZÓ(8Ð'9ð :Bð Bó
ð 	
øô ó 	Ùð	ús   Ã#E Å
EÅE)Ú
memory_mapc                óŠ  • [        U 5      (       d  Ub  [        S5      eX4$ Ub^  [        XS9n[        U[        5      (       a  [        U 5      n O [        U [        5      (       d  [        S5      eUR                  U 5      n X4$ [        U 5      n [	        US9n UR                  U 5      nUR                  [        R                  :g  nU(       d   [        R                  " U 5      u  pX4$ UR                  U 5      n X4$ ! [         a    SnSn NGf = f! [         a#  n[        U5      nSU;   d  SU;   a   SnAO
UeSnAff = f X4$ )z€
Return filesystem/path from path which could be an URI or a plain
filesystem path or a combination of fsspec protocol and URI.
Nzg'filesystem' passed but the specified path is file-like, so there is nothing to open with 'filesystem'.r&   zPExpected string path; path-like objects are only allowed with a local filesystemFzempty schemezCannot parse URI)r   r,   r<   r*   r	   r   r+   r7   r.   r/   r0   r   ÚNotFoundr   r-   )r2   r8   r=   Ú	file_infoÚexists_locallyÚeÚmsgs          r#   Ú_resolve_filesystem_and_pathrD   ‚   sv  € ô
 ˜×ÑØÑ!Üð?óð ð ÐÐàÑÜ'¨
ÑHˆ
Ü�j¤/×2Ñ2Ü" 4Ó(‰DÜ˜D¤#×&Ñ&Üð*óð ð ×(Ñ(¨Ó.ˆØÐÐä˜4Ó €Dô
 !¨*Ñ5€Jð?Ø×,Ñ,¨TÓ2ˆ	ð
 $Ÿ.™.¬H×,=Ñ,=Ñ=ˆö ð
	Ü)×2Ò2°4Ó8ÑˆJð ÐÐð ×(Ñ(¨Ó.ˆàÐÐøô/ ó Øˆ	ØŠðûô ó 	Ü�a“&ˆCØ Ó$Ð(:¸cÓ(Aô à�ûð	úð ð ÐÐs0   ÂC= ÃD Ã=DÄDÄ
D>ÄD9Ä7D9Ä9D>i   T)Ú
chunk_sizeÚuse_threadsc                óà   • [        X5      u  pg[        X5      u  p‰UR                  U5      n
U
R                  [        R                  :X  a  [        USS9n[        XkX‰XE5        g[        XgX‰XE5        g)aê  
Copy files between FileSystems.

This functions allows you to recursively copy directories of files from
one file system to another, such as from S3 to your local machine.

Parameters
----------
source : string
    Source file path or URI to a single file or directory.
    If a directory, files will be copied recursively from this path.
destination : string
    Destination file path or URI. If `source` is a file, `destination`
    is also interpreted as the destination file (not directory).
    Directories will be created as necessary.
source_filesystem : FileSystem, optional
    Source filesystem, needs to be specified if `source` is not a URI,
    otherwise inferred.
destination_filesystem : FileSystem, optional
    Destination filesystem, needs to be specified if `destination` is not
    a URI, otherwise inferred.
chunk_size : int, default 1MB
    The maximum size of block to read before flushing to the
    destination file. A larger chunk_size will use more memory while
    copying but may help accommodate high latency FileSystems.
use_threads : bool, default True
    Whether to use multiple threads to accelerate copying.

Examples
--------
Inspect an S3 bucket's files:

>>> s3, path = fs.FileSystem.from_uri(
...            "s3://registry.opendata.aws/roda/ndjson/")
>>> selector = fs.FileSelector(path)
>>> s3.get_file_info(selector)
[<FileInfo for 'registry.opendata.aws/roda/ndjson/index.ndjson':...]

Copy one file from S3 bucket to a local directory:

>>> fs.copy_files("s3://registry.opendata.aws/roda/ndjson/index.ndjson",
...               f"file:///{local_path}/index_copy.ndjson")

>>> fs.LocalFileSystem().get_file_info(str(local_path)+
...                                    '/index_copy.ndjson')
<FileInfo for '.../index_copy.ndjson': type=FileType.File, size=...>

Copy file using a FileSystem object:

>>> fs.copy_files("registry.opendata.aws/roda/ndjson/index.ndjson",
...               f"file:///{local_path}/index_copy.ndjson",
...               source_filesystem=fs.S3FileSystem())
T©Ú	recursiveN)rD   r/   r0   r   r1   r   r   r   )ÚsourceÚdestinationÚsource_filesystemÚdestination_filesystemrE   rF   Ú	source_fsÚsource_pathÚdestination_fsÚdestination_pathr@   Ú
source_sels               r#   Ú
copy_filesrS   ¾   sz   € ôp :ØóÑ€Iô (DØó(Ñ$€Nð ×'Ñ'¨Ó4€IØ‡~�~œ×+Ñ+Ó+Ü! +¸Ñ>ˆ
Ü˜YØ+Ø'õ	6ô 	�IØ"Øõ	-r%   c                   óš   • \ rS rSrSrS rS rS rS rS r	\
S 5       rS	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rSrg)r6   i	  zû
Handler for fsspec-based Python filesystems.

https://filesystem-spec.readthedocs.io/en/latest/index.html

Parameters
----------
fs : FSSpec-compliant filesystem instance

Examples
--------
>>> PyFileSystem(FSSpecHandler(fsspec_fs)) # doctest: +SKIP
c                 ó   • Xl         g ©N©r9   )Úselfr9   s     r#   Ú__init__ÚFSSpecHandler.__init__  s   € Ø�r%   c                 ój   • [        U[        5      (       a  U R                  UR                  :H  $ [        $ rV   ©r*   r6   r9   ÚNotImplemented©rX   Úothers     r#   Ú__eq__ÚFSSpecHandler.__eq__  ó(   € Ü�eœ]×+Ñ+Ø—7‘7˜eŸh™hÑ&Ð&ÜÐr%   c                 ój   • [        U[        5      (       a  U R                  UR                  :g  $ [        $ rV   r\   r^   s     r#   Ú__ne__ÚFSSpecHandler.__ne__   rb   r%   c                 ól   • U R                   R                  n[        U[        5      (       a  US   nSU 3$ )Nr   zfsspec+)r9   Úprotocolr*   Úlist)rX   rg   s     r#   Úget_type_nameÚFSSpecHandler.get_type_name%  s4   € Ø—7‘7×#Ñ#ˆÜ�h¤×%Ñ%Ø ‘{ˆHØ˜˜
Ð#Ð#r%   c                 ó   • U$ rV   © ©rX   r2   s     r#   r.   ÚFSSpecHandler.normalize_path+  s   € Øˆr%   c           	      óÌ   • US   nUS   S:X  a  [         R                  nO,US   S:X  a  [         R                  nS nO[         R                  n[	        XX!R                  SS 5      S9$ )NÚsizer0   ÚfileÚ	directoryÚmtime)rp   rs   )r   ÚFiler1   ÚUnknownr   Úget)r2   Úinforp   Úftypes       r#   Ú_create_file_infoÚFSSpecHandler._create_file_info.  s_   € à�F‰|ˆØ�‰<˜6Ó!Ü—M‘M‰EØ�&‰\˜[Ó(Ü×&Ñ&ˆEà‰Dä×$Ñ$ˆEÜ˜¨$·h±h¸wÈÓ6MÑNÐNr%   c                 ó  • / nU H?  n U R                   R                  U5      nUR                  U R                  X45      5        MA     U$ ! [         a-    UR                  [        U[        R                  5      5         M{  f = frV   )r9   rw   Úappendry   ÚFileNotFoundErrorr   r   r?   )rX   ÚpathsÚinfosr2   rw   s        r#   r/   ÚFSSpecHandler.get_file_info;  su   € ØˆÛˆDðAØ—w‘w—|‘| DÓ)�ð —‘˜T×3Ñ3°DÓ?Ö@ñ ð ˆøô	 %ó @Ø—‘œX d¬H×,=Ñ,=Ó>×?ð@ús   ‰A
Á
3BÂ Bc                 ó|  • U R                   R                  UR                  5      (       dg  U R                   R                  UR                  5      (       a  [	        UR                  5      eUR
                  (       a  / $ [        UR                  5      eUR                  (       a  S nOSn/ nU R                   R                  UR                  USSS9nUR                  5        HX  u  pVUR                  S5      nUR                  R                  S5      nXx:w  d  M8  UR                  U R                  XV5      5        MZ     U$ )Né   T)ÚmaxdepthÚwithdirsÚdetailÚ/)r9   ÚisdirÚbase_dirÚexistsÚNotADirectoryErrorÚallow_not_foundr}   rI   ÚfindÚitemsÚstripr|   ry   )	rX   Úselectorrƒ   r   Úselected_filesr2   rw   Ú_pathrˆ   s	            r#   Úget_file_info_selectorÚ$FSSpecHandler.get_file_info_selectorF  s  € Ø�w‰w�}‰}˜X×.Ñ.×/Ñ/Ø�w‰w�~‰~˜h×/Ñ/×0Ñ0Ü(¨×):Ñ):Ó;Ð;à×+×+Ø�Iä+¨H×,=Ñ,=Ó>Ð>à××Ø‰HàˆHàˆØŸ™Ÿ™Ø×Ñ¨¸4Èð &ð 
ˆð )×.Ñ.Ö0‰JˆDØ—J‘J˜s“OˆEØ×(Ñ(×.Ñ.¨sÓ3ˆHð Õ Ø—‘˜T×3Ñ3°DÓ?Ö@ñ 1ð ˆr%   c                 óX   •  U R                   R                  XS9  g ! [         a     g f = f)N)Úcreate_parents)r9   ÚmkdirÚFileExistsError)rX   r2   rI   s      r#   Ú
create_dirÚFSSpecHandler.create_dirc  s+   € ð	Ø�G‰G�M‰M˜$ˆMÒ9øÜó 	Ùð	ús   ‚ œ
)¨)c                 ó8   • U R                   R                  USS9  g ©NTrH   )r9   Úrmrm   s     r#   Ú
delete_dirÚFSSpecHandler.delete_dirj  s   € Ø�‰�
‰
�4 4ˆ
Ò(r%   c                 ón  •  U R                   R                  USS9nU H|  nU R                   R                  U5      (       a  U R                   R	                  USS9  M?  U R                   R                  U5      (       d  Ma  U R                   R	                  U5        M~     g ! [         a    U(       a   g e f = f)NF)r…   TrH   )r9   Úlistdirr}   r‡   rœ   Úisfile)rX   r2   Úmissing_dir_okÚsubpathsÚsubpaths        r#   Ú_delete_dir_contentsÚ"FSSpecHandler._delete_dir_contentsm  s�   € ð	Ø—w‘w—‘ t°E�Ð:ˆHó
  ˆGØ�w‰w�}‰}˜W×%Ñ%Ø—‘—
‘
˜7¨d�
Ó3Ø—‘—‘ ×(Ó(Ø—‘—
‘
˜7Ö#ò	  øô	 !ó 	ÞÙØð	ús   ‚B ÂB4Â2B4c                 ój   • UR                  S5      S:X  a  [        SUS5      eU R                  X5        g )Nr†   Ú z$delete_dir_contents called on path 'r   )rŽ   r,   r¥   )rX   r2   r¢   s      r#   Údelete_dir_contentsÚ!FSSpecHandler.delete_dir_contentsz  s6   € Ø�:‰:�c‹?˜bÓ ÜØ6¸¸cóCð Cà×!Ñ! $Õ7r%   c                 ó(   • U R                  SS5        g )Nr†   F)r¥   )rX   s    r#   Údelete_root_dir_contentsÚ&FSSpecHandler.delete_root_dir_contents€  s   € Ø×!Ñ! # uÕ-r%   c                 ó�   • U R                   R                  U5      (       d  [        U5      eU R                   R                  U5        g rV   )r9   r‰   r}   rœ   rm   s     r#   Údelete_fileÚFSSpecHandler.delete_fileƒ  s2   € ð �w‰w�~‰~˜d×#Ñ#Ü# DÓ)Ð)Ø�‰�
‰
�4Õr%   c                 ó8   • U R                   R                  XSS9  g r›   )r9   Úmv©rX   ÚsrcÚdests      r#   ÚmoveÚFSSpecHandler.moveŠ  s   € Ø�‰�
‰
�3¨ˆ
Ò-r%   c                 ó:   • U R                   R                  X5        g rV   )r9   Úcopyr³   s      r#   Ú	copy_fileÚFSSpecHandler.copy_file�  s   € ð 	�‰�‰�SÕr%   c                 ó¢   • SSK Jn  U R                  R                  U5      (       d  [	        U5      eU" U R                  R                  USS9SS9$ ©Nr   ©Ú
PythonFileÚrb©ÚmodeÚr©Úpyarrowr¿   r9   r¡   r}   Úopen©rX   r2   r¿   s      r#   Úopen_input_streamÚFSSpecHandler.open_input_stream”  óA   € Ý&à�w‰w�~‰~˜d×#Ñ#Ü# DÓ)Ð)á˜$Ÿ'™'Ÿ,™, t°$˜,Ð7¸cÑBÐBr%   c                 ó¢   • SSK Jn  U R                  R                  U5      (       d  [	        U5      eU" U R                  R                  USS9SS9$ r½   rÄ   rÇ   s      r#   Úopen_input_fileÚFSSpecHandler.open_input_fileœ  rÊ   r%   c                 óL   • SSK Jn  U" U R                  R                  USS9SS9$ )Nr   r¾   ÚwbrÁ   Úw©rÅ   r¿   r9   rÆ   ©rX   r2   Úmetadatar¿   s       r#   Úopen_output_streamÚ FSSpecHandler.open_output_stream¤  ó#   € Ý&á˜$Ÿ'™'Ÿ,™, t°$˜,Ð7¸cÑBÐBr%   c                 óL   • SSK Jn  U" U R                  R                  USS9SS9$ )Nr   r¾   ÚabrÁ   rÐ   rÑ   rÒ   s       r#   Úopen_append_streamÚ FSSpecHandler.open_append_stream©  rÖ   r%   rW   N)r5   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rY   r`   rd   ri   r.   Ústaticmethodry   r/   r’   r˜   r�   r¥   r©   r¬   r¯   r¶   rº   rÈ   rÌ   rÔ   rÙ   Ú__static_attributes__rl   r%   r#   r6   r6   	  s€   † ñòòò
ò
$òð ñ
Oó ð
Oò	òò:ò)ò$ò8ò.òò.ò òCòCòCõ
Cr%   r6   rV   )NN),rÞ   Úpyarrow.utilr   r   Úpyarrow._fsr   r   r   r   r	   r
   r   r   r   r   r   Ú	FileStatsr   Úpyarrow._azurefsr   r    r|   Úpyarrow._hdfsr   Úpyarrow._gcsfsr   Úpyarrow._s3fsr   r   r   r   r   r   r   r   r   r   ÚatexitÚregisterr$   r<   rD   rS   r6   rl   r%   r#   Ú<module>rê      s2  ðñ$÷ 8÷÷ ÷ ñ ð €	à€ð,Ý0ð-Ý.ð*Ý,ð)÷L÷ L÷ Ló Ø
‡O‚OÐ'Ô(ò	ð 05õ *
ðZ9Àeö 9ðz ?CðH-à&°DöH-ôVcCÐ%õ cCøð{ ó ,Ø×ÑÐ*Ö+ð,ûð
 ó -Ø×ÑÐ+Ö,ð-ûð
 ó *Ø×Ñ˜Ö)ð*ûð ó )Ø×Ñ˜Ö(ð)úsD   ªB ±B4 ¸C ¿C. ÂB1Â0B1Â4CÃCÃC+Ã*C+Ã.DÄD