
    ΅i                     r    S SK r S SKrS SKJrJr  S SKJrJr  S SKJ	r	  \" S5      r
S/r " S S\	\
   5      rg)    N)MappingSequence)AnyTypeVar)MapDataPipe_TSequenceWrapperMapDataPipec                       \ rS rSr% Sr\\   \\\4   -  \	S'    SS\\   \\\4   -  S\
SS4S jjrS\S\4S	 jrS\4S
 jrSrg)r	      a  
Wraps a sequence object into a MapDataPipe.

Args:
    sequence: Sequence object to be wrapped into an MapDataPipe
    deepcopy: Option to deepcopy input sequence object

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

Example:
    >>> # xdoctest: +SKIP
    >>> from torchdata.datapipes.map import SequenceWrapper
    >>> dp = SequenceWrapper(range(10))
    >>> list(dp)
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
    >>> dp = SequenceWrapper({"a": 100, "b": 200, "c": 300, "d": 400})
    >>> dp["a"]
    100
sequencedeepcopyreturnNc                     U(       a   [         R                  " U5      U l        g Xl        g ! [         a    [        R
                  " SSS9  Xl         g f = f)NzkThe input sequence can not be deepcopied, please be aware of in-place modification would affect source data   )
stacklevel)copyr   r   	TypeErrorwarningswarn)selfr   r   s      ^/home/james-whalen/.local/lib/python3.13/site-packages/torch/utils/data/datapipes/map/utils.py__init__#SequenceWrapperMapDataPipe.__init__)   sP     ) $h 7 %M  )X 
 !))s   , %AAindexc                      U R                   U   $ Nr   )r   r   s     r   __getitem__&SequenceWrapperMapDataPipe.__getitem__9   s    }}U##    c                 ,    [        U R                  5      $ r   )lenr   )r   s    r   __len__"SequenceWrapperMapDataPipe.__len__<   s    4==!!r    r   )T)__name__
__module____qualname____firstlineno____doc__r   r   r   r   __annotations__boolr   intr   r#   __static_attributes__ r    r   r	   r	      sv    0 rlWS"W--- KO% wsBw'77%CG%	% $ $ $" "r    )r   r   collections.abcr   r   typingr   r   #torch.utils.data.datapipes.datapiper   r   __all__r	   r.   r    r   <module>r3      s7      -  ; T]'
(/"R /"r    