
    sh                     <    S SK r S SKrS SKJr  S/r " S S\5      rg)    N)IterDataPipeIterableWrapperIterDataPipec                   .    \ rS rSrSrSS jrS rS rSrg)	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]
c                     Xl         X l        g N)iterabledeepcopy)selfr	   r
   s      y/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/torch/utils/data/datapipes/iter/utils.py__init__$IterableWrapperIterDataPipe.__init__!   s          c              #      #    U R                   nU R                  (       a!   [        R                  " U R                   5      nU S h  vN   g ! [         a    [        R
                  " S5         N-f = f N+7f)NzlThe input iterable can not be deepcopied, please be aware of in-place modification would affect source data.)r	   r
   copy	TypeErrorwarningswarn)r   source_datas     r   __iter__$IterableWrapperIterDataPipe.__iter__%   s_     mm==
"mmDMM:   Y
 	s4   A4 A A4A2A4 A/,A4.A//A4c                 ,    [        U R                  5      $ r   )lenr	   )r   s    r   __len__#IterableWrapperIterDataPipe.__len__5   s    4==!!r   )r
   r	   N)T)	__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes__ r   r   r   r      s    *! "r   )r   r   #torch.utils.data.datapipes.datapiper   __all__r   r"   r   r   <module>r%      s$      < )
)+", +"r   