§
    X�’jÐ  ã                   ó´   — d dl mZ d dl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dS )é    )ÚCallable)ÚTypeVar)Úfunctional_datapipe)ÚMapDataPipe)Ú_check_unpickable_fnÚMapperMapDataPipeÚ
default_fnÚ_T_coT)Ú	covariantc                 ó   — | S ©N© )Údatas    úUC:\Projects\DSCons\.venv\Lib\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          |¦  «         || _        d S r   )ÚsuperÚ__init__r   r   r   )Úselfr   r   Ú	__class__s      €r   r   zMapperMapDataPipe.__init__4   s;   ø€ õ
 	‰Œ×ÒÑÔÐØ ˆŒÝ˜RÑ Ô Ð ØˆŒˆˆr   c                 ó*   — t          | j        ¦  «        S r   )Úlenr   )r   s    r   Ú__len__zMapperMapDataPipe.__len__>   s   € å�4”=Ñ!Ô!Ð!r   c                 óB   — |                       | j        |         ¦  «        S r   )r   r   )r   Úindexs     r   Ú__getitem__zMapperMapDataPipe.__getitem__B   s   € Ø�wŠw�t”} UÔ+Ñ,Ô,Ð,r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   r	   r   Úintr   r
   r!   Ú__classcell__)r   s   @r   r   r      s¼   ø€ € € € € € ðð ð0 ÐÐÑØ€L€L�Lð
 "ðð àðð ðð 
ð	ð ð ð ð ð ð"˜ð "ð "ð "ð "ð- Eð -ð -ð -ð -ð -ð -ð -ð -r   N)Úcollections.abcr   Útypingr   Ú%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/      sá   ðà $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð à EÐ EÐ EÐ EÐ EÐ EØ ;Ð ;Ð ;Ð ;Ð ;Ð ;Ø HÐ HÐ HÐ HÐ HÐ Hð  Ð
-€ð 	ˆ� 4Ð(Ñ(Ô(€ðð ð ð Ð�UÑÔð+-ð +-ð +-ð +-ð +-˜ EÔ*ñ +-ô +-ñ Ôð+-ð +-ð +-r   