Ë
    ÌÓ^j=  ã                   ór   — 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y)é    N)ÚIterableÚIteratorÚSized)ÚTypeVar)ÚIterDataPipeÚ_TÚIterableWrapperIterDataPipec                   óJ   — 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y)
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]
    ÚiterableÚdeepcopyÚreturnNc                 ó    — || _         || _        y )N)r   r   )Úselfr   r   s      úp/var/www/ramen.bs-engineer-server.com/venv/lib/python3.12/site-packages/torch/utils/data/datapipes/iter/utils.pyÚ__init__z$IterableWrapperIterDataPipe.__init__$   s   € Ø ˆŒØ ˆ�ó    c              #   óà   K  — | j                   }| j                  r 	 t        j                  | j                   «      }|E d {  –—†  y # t        $ r t	        j
                  dd¬«       Y Œ-w xY w7 Œ+­w)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__(   sc   è ø€ Ø—m‘mˆØ�=Š=ðÜ"Ÿm™m¨D¯M©MÓ:�ð ×Ñøô ò Ü—‘ðYà ÷ðúð 	ús3   ‚A.œA »A.Á A,ÁA.Á A)Á&A.Á(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   s=   € Ü�d—m‘m¤UÔ+Ü�t—}‘}Ó%Ð%Üœ4 ›:×.Ñ.Ð/Ð/RÐSÓTÐTr   )T)r    Ú
__module__Ú__qualname__Ú__doc__r   r   Úboolr   r   r   Úintr!   © r   r   r	   r	      sC   „ ññ*! ¨"¡ð !¸ð !Èó !ð˜( 2™,ó ð"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Ý å <ñ ˆTƒ]€à(Ð
)€ô.U ,¨rÑ"2õ .Ur   