Ë
    Z^(h  ã            	       ó‚   — 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	 dgZ
 ed«       G d„ de	eeef      «      «       Zy	)
é    )ÚIterator)ÚIOBase)ÚOptional)Úfunctional_datapipe)ÚIterDataPipeÚStreamReaderIterDataPipeÚread_from_streamc                   óV   — e Zd ZdZ	 ddeeeef      dee	   fd„Z
deeeef      fd„Zy)	r   aÒ  
    Given IO streams and their label names, yield bytes with label name as tuple.

    (functional name: ``read_from_stream``).

    Args:
        datapipe: Iterable DataPipe provides label/URL and byte stream
        chunk: Number of bytes to be read from stream per iteration.
            If ``None``, all bytes will be read until the EOF.

    Example:
        >>> # xdoctest: +SKIP
        >>> from torchdata.datapipes.iter import IterableWrapper, StreamReader
        >>> from io import StringIO
        >>> dp = IterableWrapper([("alphabet", StringIO("abcde"))])
        >>> list(StreamReader(dp, chunk=1))
        [('alphabet', 'a'), ('alphabet', 'b'), ('alphabet', 'c'), ('alphabet', 'd'), ('alphabet', 'e')]
    NÚdatapipeÚchunkc                 ó    — || _         || _        y ©N)r   r   )Úselfr   r   s      új/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/utils/data/datapipes/iter/streamreader.pyÚ__init__z!StreamReaderIterDataPipe.__init__!   s   € ð !ˆŒØˆ�
ó    Úreturnc              #   óž   K  — | j                   D ]:  \  }}	 |j                  | j                  «      }|s|j                  «        Œ5||f–— Œ5 y ­wr   )r   Úreadr   Úclose)r   ÚfurlÚstreamÚds       r   Ú__iter__z!StreamReaderIterDataPipe.__iter__'   sO   è ø€ Ø ŸM™Mò 	 ‰LˆD�&ØØ—K‘K §
¡
Ó+�ÙØ—L‘L”NØØ˜Q�i’ð ñ	 ùs   ‚AAr   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚtupleÚstrr   r   Úintr   r   Úbytesr   © r   r   r   r      sO   „ ñð( RVñØ$ U¨3°¨;Ñ%7Ñ8ðØAIÈ#Áóð ˜( 5¨¨e¨Ñ#4Ñ5ô  r   N)Úcollections.abcr   Úior   Útypingr   Ú%torch.utils.data.datapipes._decoratorr   Ú#torch.utils.data.datapipes.datapiper   Ú__all__r   r    r"   r   r#   r   r   ú<module>r*      sM   ðÝ $Ý Ý å EÝ <ð &Ð
&€ñ Ð'Ó(ô! ˜|¨E°#°u°*Ñ,=Ñ>ó ! ó )ñ! r   