Ë
    Q/æj•  ã            	       ój   — 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)é    )ÚTuple)Úfunctional_datapipe)ÚIterDataPipeÚStreamReaderIterDataPipeÚread_from_streamc                   ó   — e Zd ZdZdd„Z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')]
    Nc                 ó    — || _         || _        y ©N)ÚdatapipeÚchunk)Úselfr   r   s      úo/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/torch/utils/data/datapipes/iter/streamreader.pyÚ__init__z!StreamReaderIterDataPipe.__init__    s   € Ø ˆŒØˆ�
ó    c              #   óž   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   r   © r   r   r   r      s   „ ñó&ó r   N)
Útypingr   Ú%torch.utils.data.datapipes._decoratorr   Ú#torch.utils.data.datapipes.datapiper   Ú__all__ÚstrÚbytesr   r   r   r   ú<module>r#      sG   ðå å EÝ <ð &Ð
&€ñ Ð'Ó(ô ˜|¨E°#°u°*Ñ,=Ñ>ó  ó )ñ r   