+
    QV-j�  ã                   óþ   € ^ RI t ^ RIt^ RIHt ^ RIHtHt ^RIHtH	t	H
t
HtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtHtH t H!t!H"t"H#t#H$t$H%t%H&t& ^RI'H(t( ^RI)H*t* ^RI+H,t, ](! ]-4      t. ! R R	4      t/R# )
é    N)ÚIterable)ÚOptionalÚUnion)Ú!SINGLE_FILE_COMPRESSION_PROTOCOLSÚArchiveIterableÚFilesIterableÚ_get_extraction_protocolÚ_get_path_extensionÚ!_prepare_path_and_storage_optionsÚis_relative_pathÚurl_or_path_joinÚ	xbasenameÚxdirnameÚ	xet_parseÚxexistsÚxgetsizeÚxglobÚ
xgzip_openÚxisdirÚxisfileÚxjoinÚxlistdirÚxnumpy_loadÚxopenÚxpandas_read_csvÚxpandas_read_excelÚxPathÚxpyarrow_parquet_read_tableÚxrelpathÚxsio_loadmatÚxsplitÚ	xsplitextÚxwalkÚxxml_dom_minidom_parse)Ú
get_logger)Ú
map_nested)ÚDownloadConfigc                   ó´   a € ] tR t^/t o RtRtRV 3R lR llt]R 4       tR t	V 3R lR	 lt
R
 tV 3R lR ltR tV 3R lR ltV 3R lR ltR tR tRtV tR# )ÚStreamingDownloadManageraˆ  
Download manager that uses the "::" separator to navigate through (possibly remote) compressed archives.
Contrary to the regular `DownloadManager`, the `download` and `extract` methods don't actually download nor extract
data, but they rather return the path or url that could be opened using the `xopen` function which extends the
built-in `open` function to stream data from remote files.
TNc          	      ór   <€ V ^8„  d   QhRS[ S[,          RS[ S[,          RS[ S[,          RS[ S[,          /# )é   Údataset_nameÚdata_dirÚdownload_configÚ	base_path)r   Ústrr'   )ÚformatÚ__classdict__s   "€Ú}/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/datasets/download/streaming_download_manager.pyÚ__annotate__Ú%StreamingDownloadManager.__annotate__9   sD   ø€ ÷ &ñ &á™s•mð&ñ ™3•-ð&ñ "¡.Õ1ð	&ñ
 ™C•=ñ&ó    c                óÈ   € Wn         W n        T;'       g     \        P                  P	                  R 4      V n        T;'       g    \        4       V n        RV n        RV n	        R# )Ú.NF)
Ú_dataset_nameÚ	_data_dirÚosÚpathÚabspathÚ
_base_pathr'   r.   Údownloaded_sizeÚrecord_checksums)Úselfr,   r-   r.   r/   s   &&&&&r3   Ú__init__Ú!StreamingDownloadManager.__init__9   sN   € ð *ÔØ!ŒØ#×;Ð;¤r§w¡w§¡°sÓ';ˆŒØ.×BÐB´.Ó2BˆÔØ#ˆÔØ %ˆÖr6   c                ó   € V P                   # ©N)r:   ©rA   s   &r3   Ú
manual_dirÚ#StreamingDownloadManager.manual_dirG   s   € à�~‰~Ðr6   c                ó6   € \        V P                  VRR7      pV# )aý  Normalize URL(s) of files to stream data from.
This is the lazy version of `DownloadManager.download` for streaming.

Args:
    url_or_urls (`str` or `list` or `dict`):
        URL(s) of files to stream data from. Each url is a `str`.

Returns:
    url(s): (`str` or `list` or `dict`), URL(s) to stream data from matching the given input url_or_urls.

Example:

```py
>>> downloaded_files = dl_manager.download('https://storage.googleapis.com/seldon-datasets/sentence_polarity_v1/rt-polaritydata.tar.gz')
```
T©Ú	map_tuple)r&   Ú_download_single©rA   Úurl_or_urlss   &&r3   ÚdownloadÚ!StreamingDownloadManager.downloadK   s   € ô" ! ×!6Ñ!6¸ÈtÔTˆØÐr6   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# ©r+   ÚurlpathÚreturn©r0   )r1   r2   s   "€r3   r4   r5   _   s   ø€ ÷ ñ ©ð ±ñ r6   c                ój   € \        V4      p\        V4      '       d   \        V P                  V4      pV# rE   )r0   r   r   r>   )rA   rS   s   &&r3   rL   Ú)StreamingDownloadManager._download_single_   s+   € Ü�g“,ˆÜ˜G×$Ò$ä& t§¡¸Ó@ˆGØˆr6   c                ó6   € \        V P                  VRR7      pV# )aC  Add extraction protocol for given url(s) for streaming.

This is the lazy version of `DownloadManager.extract` for streaming.

Args:
    url_or_urls (`str` or `list` or `dict`):
        URL(s) of files to stream data from. Each url is a `str`.

Returns:
    url(s): (`str` or `list` or `dict`), URL(s) to stream data from matching the given input `url_or_urls`.

Example:

```py
>>> downloaded_files = dl_manager.download('https://storage.googleapis.com/seldon-datasets/sentence_polarity_v1/rt-polaritydata.tar.gz')
>>> extracted_files = dl_manager.extract(downloaded_files)
```
TrJ   )r&   Ú_extract)rA   rN   Úurlpathss   && r3   ÚextractÚ StreamingDownloadManager.extractf   s   € ô& ˜dŸm™m¨[ÀDÔIˆØˆr6   c                ó&   <€ V ^8„  d   QhRS[ RS[ /# rR   rU   )r1   r2   s   "€r3   r4   r5   |   s   ø€ ÷ /ñ /¡ð /©ñ /r6   c                óÌ  € \        V4      p\        WP                  R 7      pVP                  R4      ^ ,          p\	        V4      pVR9   g   VP                  R	4      '       d   \        RV R24      hVf   V# V\        9   d]   \        P                  P                  VP                  R4      ^ ,          4      pRV9   d   VRVP                  R4       MTpV RV RV 2# V RV 2# )
©r.   z::z+Extraction protocol for TAR archives like 'zï' is not implemented in streaming mode. Please use `dl_manager.iter_archive` instead.

Example usage:

	url = dl_manager.download(url)
	tar_archive_iterator = dl_manager.iter_archive(url)

	for filename, file in tar_archive_iterator:
		...Nr8   z://z://::)ÚtgzÚtar)z.tar.gzz.tar.bz2z.tar.xz)r0   r	   r.   Úsplitr
   ÚendswithÚNotImplementedErrorr   r;   r<   ÚbasenameÚrindex)rA   rS   Úprotocolr<   Ú	extensionÚ
inner_files   &&    r3   rY   Ú!StreamingDownloadManager._extract|   sð   € Ü�g“,ˆä+¨G×EYÑEYÔZˆØ�}‰}˜TÓ" 1Õ%ˆÜ'¨Ó-ˆ	Ø˜Ô&¨$¯-©-Ð8Z×*[Ò*[Ü%Ø=¸g¸Yð Gð óð ð ÒàˆNØÔ:Ô:äŸ™×)Ñ)¨'¯-©-¸Ó*=¸aÕ*@ÓAˆJØADÈ
ÔAR˜Ð$< j×&7Ñ&7¸Ó&<Ñ=ÐXbˆJØ�Z˜s : ,¨b°°	Ð:Ð:à�Z˜u W IÐ.Ð.r6   c                óB   € V P                  V P                  V4      4      # )aØ  Prepare given `url_or_urls` for streaming (add extraction protocol).

This is the lazy version of `DownloadManager.download_and_extract` for streaming.

Is equivalent to:

```
urls = dl_manager.extract(dl_manager.download(url_or_urls))
```

Args:
    url_or_urls (`str` or `list` or `dict`):
        URL(s) to stream from data from. Each url is a `str`.

Returns:
    url(s): (`str` or `list` or `dict`), URL(s) to stream data from matching the given input `url_or_urls`.
)r[   rO   rM   s   &&r3   Údownload_and_extractÚ-StreamingDownloadManager.download_and_extract—   s   € ð$ �|‰|˜DŸM™M¨+Ó6Ó7Ð7r6   c                ó`   <€ V ^8„  d   QhRS[ S[S[P                  3,          RS[S[,          /# )r+   Úurlpath_or_bufrT   )r   r0   ÚioÚBufferedReaderr   Útuple)r1   r2   s   "€r3   r4   r5   «   s4   ø€ ÷ fñ f©5±±b×6GÑ6GÐ1GÕ+Hð fÉXÑV[Í_ñ fr6   c                ó”   € \        VR4      '       d   \        P                  ! V4      # \        P                  ! WP                  R7      # )aæ  Iterate over files within an archive.

Args:
    urlpath_or_buf (`str` or `io.BufferedReader`):
        Archive path or archive binary file object.

Yields:
    `tuple[str, io.BufferedReader]`:
        2-tuple (path_within_archive, file_object).
        File object is opened in binary mode.

Example:

```py
>>> archive = dl_manager.download('https://storage.googleapis.com/seldon-datasets/sentence_polarity_v1/rt-polaritydata.tar.gz')
>>> files = dl_manager.iter_archive(archive)
```
Úreadr_   )Úhasattrr   Úfrom_bufÚfrom_urlpathr.   )rA   ro   s   &&r3   Úiter_archiveÚ%StreamingDownloadManager.iter_archive«   s9   € ô( �> 6×*Ò*Ü"×+Ò+¨NÓ;Ð;ä"×/Ò/°×PdÑPdÔeÐer6   c                ó\   <€ V ^8„  d   QhRS[ S[S[S[,          3,          RS[S[,          /# )r+   rZ   rT   )r   r0   Úlistr   )r1   r2   s   "€r3   r4   r5   Ä   s0   ø€ ÷ [ñ [¡5©©d±3­i¨Õ#8ð [¹XÁc½]ñ [r6   c                óD   € \         P                  ! WP                  R7      # )a8  Iterate over files.

Args:
    urlpaths (`str` or `list` of `str`):
        Root paths.

Yields:
    str: File URL path.

Example:

```py
>>> files = dl_manager.download_and_extract('https://huggingface.co/datasets/AI-Lab-Makerere/beans/resolve/main/data/train.zip')
>>> files = dl_manager.iter_files(files)
```
r_   )r   Úfrom_urlpathsr.   )rA   rZ   s   &&r3   Ú
iter_filesÚ#StreamingDownloadManager.iter_filesÄ   s   € ô" ×*Ò*¨8×EYÑEYÔZÐZr6   c                ó   € R # rE   © rF   s   &r3   Úmanage_extracted_filesÚ/StreamingDownloadManager.manage_extracted_files×   ó   € Ùr6   c                ó   € R # rE   r�   rF   s   &r3   Úget_recorded_sizes_checksumsÚ5StreamingDownloadManager.get_recorded_sizes_checksumsÚ   r„   r6   )r>   r:   r9   r.   r?   r@   )NNNN)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úis_streamingrB   ÚpropertyrG   rO   rL   r[   rY   rl   rx   r~   r‚   r†   Ú__static_attributes__Ú__classdictcell__)r2   s   @r3   r)   r)   /   sy   ø‡ € ñð €L÷&ò &ð ñó ðò÷(ð ò÷,/ð /ò68÷(fð f÷2[ð [ò&÷ð r6   r)   )0rp   r;   Úcollections.abcr   Útypingr   r   Úutils.file_utilsr   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   Úutils.loggingr%   Úutils.py_utilsr&   r.   r'   rˆ   Úloggerr)   r�   r6   r3   Ú<module>r—      sb   ðÛ 	Û 	Ý $ß "÷ ÷  ÷  ÷  ÷  ÷  ÷  ÷  ñ  õB 'Ý 'Ý +ñ 
�HÓ	€÷ló lr6   