§
    X�’j.  ã            	       ó–   — 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dS )	é    )ÚIterator)ÚIOBase)Úfunctional_datapipe)ÚIterDataPipeÚStreamReaderIterDataPipeÚread_from_streamc                   ót   — 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dS )	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                 ó"   — || _         || _        d S ©N)r
   r   )Úselfr
   r   s      úZC:\Projects\DSCons\.venv\Lib\site-packages\torch\utils\data\datapipes\iter\streamreader.pyÚ__init__z!StreamReaderIterDataPipe.__init__    s   € ð !ˆŒØˆŒ
ˆ
ˆ
ó    c              #   ó–   K  — | j         D ]>\  }}	 |                     | j        ¦  «        }|s|                     ¦   «          n||fV — Œ8Œ?d S r   )r
   Úreadr   Úclose)r   ÚfurlÚstreamÚds       r   Ú__iter__z!StreamReaderIterDataPipe.__iter__&   sl   è è € Ø œMð 	 ð 	 ‰LˆD�&ð Ø—K’K ¤
Ñ+Ô+�Øð Ø—L’L‘N”N�NØØ˜Q�i���ð ð ð	 ð 	 r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚtupleÚstrr   Úintr   r   Úbytesr   © r   r   r   r      s‘   € € € € € ðð ð( 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(      s²   ðØ $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð à EÐ EÐ EÐ EÐ EÐ EØ <Ð <Ð <Ð <Ð <Ð <ð &Ð
&€ð ÐÐ'Ñ(Ô(ð! ð ! ð ! ð ! ð ! ˜|¨E°#°u°*Ô,=Ô>ñ ! ô ! ñ )Ô(ð! ð ! ð ! r   