Ë
    ÌÓ^j  ã            	       óv   — 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)Úfunctional_datapipe)ÚIterDataPipeÚStreamReaderIterDataPipeÚread_from_streamc                   óZ   — e Zd ZdZ	 ddeeeef      dedz  dd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ÚchunkÚreturnc                 ó    — || _         || _        y ©N)r
   r   )Úselfr
   r   s      úw/var/www/ramen.bs-engineer-server.com/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   ÚtupleÚstrr   Úintr   r   Úbytesr   © r   r   r   r      sW   „ ñð( OSñØ$ U¨3°¨;Ñ%7Ñ8ðØADÀtÁðà	óð ˜( 5¨¨e¨Ñ#4Ñ5ô  r   N)Úcollections.abcr   Úior   Ú%torch.utils.data.datapipes._decoratorr   Ú#torch.utils.data.datapipes.datapiper   Ú__all__r   r   r!   r   r"   r   r   ú<module>r(      sJ   ðÝ $Ý å EÝ <ð &Ð
&€ñ Ð'Ó(ô! ˜|¨E°#°u°*Ñ,=Ñ>ó ! ó )ñ! r   