§
    X�’jy  ã                   ó†   — d dl Z d dlZd dlmZmZmZ d dlmZ d dlm	Z	  ed¦  «        Z
dgZ G d„ de	e
         ¦  «        ZdS )é    N)ÚIterableÚIteratorÚSized)ÚTypeVar)ÚIterDataPipeÚ_TÚIterableWrapperIterDataPipec                   óX   — e Zd ZdZd
dee         deddfd„Zdee         fd„Z	de
fd	„ZdS )r	   añ  
    Wraps an iterable object to create an IterDataPipe.

    Args:
        iterable: Iterable object to be wrapped into an IterDataPipe
        deepcopy: Option to deepcopy input iterable object for each
            iterator. The copy is made when the first element is read in ``iter()``.

    .. note::
        If ``deepcopy`` is explicitly set to ``False``, users should ensure
        that the data pipeline doesn't contain any in-place operations over
        the iterable instance to prevent data inconsistency across iterations.

    Example:
        >>> # xdoctest: +SKIP
        >>> from torchdata.datapipes.iter import IterableWrapper
        >>> dp = IterableWrapper(range(10))
        >>> list(dp)
        [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    TÚiterableÚdeepcopyÚreturnNc                 ó"   — || _         || _        d S )N)r   r   )Úselfr   r   s      úSC:\Projects\DSCons\.venv\Lib\site-packages\torch\utils\data\datapipes\iter\utils.pyÚ__init__z$IterableWrapperIterDataPipe.__init__$   s   € Ø ˆŒØ ˆŒˆˆó    c              #   ó¸   K  — | j         }| j        rA	 t          j        | j         ¦  «        }n&# t          $ r t	          j        dd¬¦  «         Y nw xY w|E d {V —† d S )NzlThe input iterable can not be deepcopied, please be aware of in-place modification would affect source data.é   )Ú
stacklevel)r   r   ÚcopyÚ	TypeErrorÚwarningsÚwarn)r   Úsource_datas     r   Ú__iter__z$IterableWrapperIterDataPipe.__iter__(   s˜   è è € Ø”mˆØŒ=ð 	ðÝ"œm¨D¬MÑ:Ô:��øõ
 ð ð ð Ý”ðYà ðñ ô ð ð ð ðøøøð ÐÐÐÐÐÐÐÐÐs   ’, ¬ AÁAc                 ó¦   — t          | j        t          ¦  «        rt          | j        ¦  «        S t	          t          | ¦  «        j        › d�¦  «        ‚)Nz# instance doesn't have valid length)Ú
isinstancer   r   Úlenr   ÚtypeÚ__name__)r   s    r   Ú__len__z#IterableWrapperIterDataPipe.__len__9   sF   € Ý�d”m¥UÑ+Ô+ð 	&Ý�t”}Ñ%Ô%Ð%Ý�4 ™:œ:Ô.ÐSÐSÐSÑTÔTÐTr   )T)r    Ú
__module__Ú__qualname__Ú__doc__r   r   Úboolr   r   r   Úintr!   © r   r   r	   r	      s‘   € € € € € ðð ð*!ð ! ¨"¤ð !¸ð !Èð !ð !ð !ð !ð˜( 2œ,ð ð ð ð ð"U˜ð Uð Uð Uð Uð Uð Ur   )r   r   Úcollections.abcr   r   r   Útypingr   Ú#torch.utils.data.datapipes.datapiper   r   Ú__all__r	   r'   r   r   ú<module>r,      s³   ðØ €€€Ø €€€Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø Ð Ð Ð Ð Ð à <Ð <Ð <Ð <Ð <Ð <ð €WˆT�]„]€à(Ð
)€ð.Uð .Uð .Uð .Uð .U ,¨rÔ"2ñ .Uô .Uð .Uð .Uð .Ur   