ó
    "Eñi•  ã            	       ó²   • S SK Jr  S SKJr  S SKJr  S SKJr  SS/r\" SSS	9r	\" S
5       " S S\5      5       r
\" S5       " S S\\\	S4      5      5       rg)é    )ÚSized)ÚTypeVar)Úfunctional_datapipe)ÚMapDataPipeÚConcaterMapDataPipeÚZipperMapDataPipeÚ_T_coT)Ú	covariantÚconcatc                   óX   • \ rS rSr% Sr\\   \S'   S\SS4S jrS\	4S jr
S\4S jrS	rg)
r   é   a—  
Concatenate multiple Map DataPipes (functional name: ``concat``).

The new index of is the cumulative sum of source DataPipes.
For example, if there are 2 source DataPipes both with length 5,
index 0 to 4 of the resulting `ConcatMapDataPipe` would refer to
elements of the first DataPipe, and 5 to 9 would refer to elements
of the second DataPipe.

Args:
    datapipes: Map DataPipes being concatenated

Example:
    >>> # xdoctest: +SKIP
    >>> from torchdata.datapipes.map import SequenceWrapper
    >>> dp1 = SequenceWrapper(range(3))
    >>> dp2 = SequenceWrapper(range(3))
    >>> concat_dp = dp1.concat(dp2)
    >>> list(concat_dp)
    [0, 1, 2, 0, 1, 2]
Ú	datapipesÚreturnNc                 óÌ   • [        U5      S:X  a  [        S5      e[        S U 5       5      (       d  [        S5      e[        S U 5       5      (       d  [        S5      eXl        g )Nr   ú/Expected at least one DataPipe, but got nothingc              3   óB   #   • U  H  n[        U[        5      v •  M     g 7f©N©Ú
isinstancer   ©Ú.0Údps     Úe/home/mande/repo/quber/.venv/lib/python3.13/site-packages/torch/utils/data/datapipes/map/combining.pyÚ	<genexpr>Ú/ConcaterMapDataPipe.__init__.<locals>.<genexpr>+   ó   é € ÐCº°2”:˜b¤+×.Ð.ºùó   ‚ú'Expected all inputs to be `MapDataPipe`c              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fr   ©r   r   r   s     r   r   r   .   ó   é € Ð=²9¨R”:˜b¤%×(Ð(²9ùr   ú!Expected all inputs to be `Sized`©ÚlenÚ
ValueErrorÚallÚ	TypeErrorr   ©Úselfr   s     r   Ú__init__ÚConcaterMapDataPipe.__init__(   óY   € Üˆy‹>˜QÓÜÐNÓOÐOÜÑC¹ÓC×CÑCÜÐEÓFÐFäÑ=±9Ó=×=Ñ=ÜÐ?Ó@Ð@Ø"�ó    c                 óš   • SnU R                    H+  nX-
  [        U5      :  a	  X1U-
     s  $ U[        U5      -  nM-     [        SU S35      e)Nr   úIndex z is out of range.)r   r$   Ú
IndexError)r)   ÚindexÚoffsetr   s       r   Ú__getitem__ÚConcaterMapDataPipe.__getitem__2   sW   € ØˆØ—.”.ˆBà‰~¤ B£Ó'Ø &™.Ñ)Ò)ð œ#˜b›'Ñ!’ñ !ô ˜6 % Ð(9Ð:Ó;Ð;r-   c                 ó:   • [        S U R                   5       5      $ )Nc              3   ó8   #   • U  H  n[        U5      v •  M     g 7fr   ©r$   r   s     r   r   Ú.ConcaterMapDataPipe.__len__.<locals>.<genexpr>?   ó   é € Ð4¢^˜r”3�r—7�7¢^ùó   ‚)Úsumr   ©r)   s    r   Ú__len__ÚConcaterMapDataPipe.__len__=   ó   € äÑ4 T§^¢^Ó4Ó4Ð4r-   ©r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Útupler   Ú__annotations__r*   r	   r3   Úintr=   Ú__static_attributes__© r-   r   r   r      s?   ‡ ñð, �[Ñ!Ó!ð# ;ð #°4ô #ð	< Eô 	<ð5˜÷ 5r-   Úzipc                   ór   • \ rS rSr% Sr\\\   S4   \S'   S\\   SS4S jr	S\\S4   4S jr
S\4S	 jrS
rg)r   éB   añ  
Aggregates elements into a tuple from each of the input DataPipes (functional name: ``zip``).

This MataPipe is out of bound as soon as the shortest input DataPipe is exhausted.

Args:
    *datapipes: Map DataPipes being aggregated

Example:
    >>> # xdoctest: +SKIP
    >>> from torchdata.datapipes.map import SequenceWrapper
    >>> dp1 = SequenceWrapper(range(3))
    >>> dp2 = SequenceWrapper(range(10, 13))
    >>> zip_dp = dp1.zip(dp2)
    >>> list(zip_dp)
    [(0, 10), (1, 11), (2, 12)]
.r   r   Nc                 óÌ   • [        U5      S:X  a  [        S5      e[        S U 5       5      (       d  [        S5      e[        S U 5       5      (       d  [        S5      eXl        g )Nr   r   c              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fr   r   r   s     r   r   Ú-ZipperMapDataPipe.__init__.<locals>.<genexpr>[   r   r   r   c              3   óB   #   • U  H  n[        U[        5      v •  M     g 7fr   r    r   s     r   r   rP   ^   r!   r   r"   r#   r(   s     r   r*   ÚZipperMapDataPipe.__init__X   r,   r-   c           	      ó´   • / nU R                    H  n UR                  X1   5        M     [        U5      $ ! [         a  n[        SU SU S35      UeS nAff = f)Nr/   z3 is out of range for one of the input MapDataPipes Ú.)r   Úappendr0   rF   )r)   r1   Úresr   Úes        r   r3   ÚZipperMapDataPipe.__getitem__b   sl   € ØˆØ—.”.ˆBðØ—
‘
˜2™9Ö%ñ !ô �S‹zÐøô	 ó Ü Ø˜U˜GÐ#VÐWYÐVZÐZ[Ð\óàðûðús   “5µ
A¿AÁAc                 ó:   • [        S U R                   5       5      $ )Nc              3   ó8   #   • U  H  n[        U5      v •  M     g 7fr   r7   r   s     r   r   Ú,ZipperMapDataPipe.__len__.<locals>.<genexpr>o   r9   r:   )Úminr   r<   s    r   r=   ÚZipperMapDataPipe.__len__m   r?   r-   r@   )rA   rB   rC   rD   rE   rF   r   r	   rG   r*   r3   rH   r=   rI   rJ   r-   r   r   r   B   sW   ‡ ñð$ �[ Ñ'¨Ð,Ñ-Ó-ð# ;¨uÑ#5ð #¸$ô #ð	 E¨%°¨*Ñ$5ô 	ð5˜÷ 5r-   .N)Úcollections.abcr   Útypingr   Ú%torch.utils.data.datapipes._decoratorr   Ú#torch.utils.data.datapipes.datapiper   Ú__all__r	   r   rF   r   rJ   r-   r   Ú<module>rc      sy   ðå !Ý å EÝ ;ð !Ð"5Ð
6€á� 4Ñ(€ñ �XÓô05˜+ó 05ó ð05ñf �UÓô,5˜ E¨%°¨*Ñ$5Ñ6ó ,5ó ñ,5r-   