Ë
    Z^(hD  ã                   óŒ   — d dl mZmZ d dlmZ d dlmZ d dlmZ ddgZ	 edd¬	«      Z
d
„ Z ed«       G d„ dee
   «      «       Zy)é    )ÚCallableÚTypeVar)Úfunctional_datapipe)ÚMapDataPipe)Ú_check_unpickable_fnÚMapperMapDataPipeÚ
default_fnÚ_T_coT)Ú	covariantc                 ó   — | S ©N© )Údatas    úe/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/utils/data/datapipes/map/callable.pyr	   r	      s   € Ø€Kó    Úmapc                   ób   ‡ — e Zd ZU dZeed<   eed<   efdededdfˆ fd„Zde	fd„Z
defd„Zˆ xZS )	r   a  
    Apply the input function over each item from the source DataPipe (functional name: ``map``).

    The function can be any regular Python function or partial object. Lambda
    function is not recommended as it is not supported by pickle.

    Args:
        datapipe: Source MapDataPipe
        fn: Function being applied to each item

    Example:
        >>> # xdoctest: +SKIP
        >>> from torchdata.datapipes.map import SequenceWrapper, Mapper
        >>> def add_one(x):
        ...     return x + 1
        >>> dp = SequenceWrapper(range(10))
        >>> map_dp_1 = dp.map(add_one)
        >>> list(map_dp_1)
        [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
        >>> map_dp_2 = Mapper(dp, lambda x: x + 1)
        >>> list(map_dp_2)
        [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    ÚdatapipeÚfnÚreturnNc                 óT   •— t         ‰| �  «        || _        t        |«       || _        y r   )ÚsuperÚ__init__r   r   r   )Úselfr   r   Ú	__class__s      €r   r   zMapperMapDataPipe.__init__3   s&   ø€ ô
 	‰ÑÔØ ˆŒÜ˜RÔ Øˆ�r   c                 ó,   — t        | j                  «      S r   )Úlenr   )r   s    r   Ú__len__zMapperMapDataPipe.__len__=   s   € Ü�4—=‘=Ó!Ð!r   c                 ó>   — | j                  | j                  |   «      S r   )r   r   )r   Úindexs     r   Ú__getitem__zMapperMapDataPipe.__getitem__@   s   € Ø�w‰w�t—}‘} UÑ+Ó,Ð,r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   r	   r   Úintr   r
   r!   Ú__classcell__)r   s   @r   r   r      sS   ø… ñð0 ÓØƒLð
 "ñàðð ðð 
õ	ð"˜ó "ð- E÷ -r   N)Útypingr   r   Ú%torch.utils.data.datapipes._decoratorr   Ú#torch.utils.data.datapipes.datapiper   Ú'torch.utils.data.datapipes.utils.commonr   Ú__all__r
   r	   r   r   r   r   ú<module>r.      sU   ðç $å EÝ ;Ý Hð  Ð
-€ñ 	� 4Ô(€òñ �UÓô*-˜ EÑ*ó *-ó ñ*-r   