Ë
    Z^(h«
  ã            	       ó²   — d dl mZmZmZ d dlmZ d dlmZmZ d dl	m
Z
 d dlmZ d dlmZ d dlmZmZmZmZ dgZ e
d	«       G d
„ deeeef      «      «       Zy)é    )ÚIterableÚIteratorÚSized)ÚBufferedIOBase)ÚAnyÚCallable)Úfunctional_datapipe)ÚIterDataPipe)Ú_deprecation_warning)ÚbasichandlersÚDecoderÚextension_extract_fnÚimagehandlerÚRoutedDecoderIterDataPipeÚrouted_decodec            	       ó‚   ‡ — e Zd ZdZedœdeeeef      de	de	ddfˆ fd„Z
d	e	ddfd
„Zdeeeef      fd„Zdefd„Zˆ xZS )r   až  
    Decodes binary streams from input DataPipe, yields pathname and decoded data in a tuple.

    (functional name: ``routed_decode``)

    Args:
        datapipe: Iterable datapipe that provides pathname and binary stream in tuples
        handlers: Optional user defined decoder handlers. If ``None``, basic and image decoder
            handlers will be set as default. If multiple handles are provided, the priority
            order follows the order of handlers (the first handler has the top priority)
        key_fn: Function for decoder to extract key from pathname to dispatch handlers.
            Default is set to extract file extension from pathname

    Note:
        When ``key_fn`` is specified returning anything other than extension, the default
        handler will not work and users need to specify custom handler. Custom handler
        could use regex to determine the eligibility to handle data.
    )Úkey_fnÚdatapipeÚhandlersr   ÚreturnNc                óº   •— t         ‰| �  «        || _        |st        t	        d«      f}t        |d|iŽ| _        t        t        | «      j                  ddd¬«       y )NÚtorchr   z1.12z1.13r   )Údeprecation_versionÚremoval_versionÚold_functional_name)
ÚsuperÚ__init__r   Údecoder_basichandlersÚdecoder_imagehandlerr   Údecoderr   ÚtypeÚ__name__)Úselfr   r   r   Ú	__class__s       €úk/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/utils/data/datapipes/iter/routeddecoder.pyr   z"RoutedDecoderIterDataPipe.__init__(   sY   ø€ ô 	‰ÑÔØ>FˆŒÙÜ-Ô/CÀGÓ/LÐMˆHÜ Ð8°Ñ8ˆŒÜÜ�‹J×ÑØ &Ø"Ø /ö		
ó    Úhandlerc                 ó6   —  | j                   j                  |Ž  y )N)r    Úadd_handler)r#   r'   s     r%   r)   z%RoutedDecoderIterDataPipe.add_handler:   s   € Ø ˆ�‰× Ñ  'Ò*r&   c              #   ól   K  — | j                   D ]!  }|d   }| j                  |«      }|||   f–— Œ# y ­w)Nr   )r   r    )r#   ÚdataÚpathnameÚresults       r%   Ú__iter__z"RoutedDecoderIterDataPipe.__iter__=   s@   è ø€ Ø—M‘Mò 	/ˆDØ˜A‘wˆHØ—\‘\ $Ó'ˆFØ˜V HÑ-Ð.Ó.ñ	/ùs   ‚24c                 ó¢   — t        | j                  t        «      rt        | j                  «      S t	        t        | «      j                  › d�«      ‚)Nz# instance doesn't have valid length)Ú
isinstancer   r   ÚlenÚ	TypeErrorr!   r"   )r#   s    r%   Ú__len__z!RoutedDecoderIterDataPipe.__len__C   s=   € Ü�d—m‘m¤UÔ+Ü�t—}‘}Ó%Ð%Üœ4 ›:×.Ñ.Ð/Ð/RÐSÓTÐTr&   )r"   Ú
__module__Ú__qualname__Ú__doc__r   r   ÚtupleÚstrr   r   r   r)   r   r   r.   Úintr3   Ú__classcell__)r$   s   @r%   r   r      s�   ø„ ñð. 0ò	
à˜5  nÐ!4Ñ5Ñ6ð
ð ð
ð ð	
ð
 
õ
ð$+ Hð +°ó +ð/˜( 5¨¨c¨¡?Ñ3ó /ðU˜÷ Ur&   N)Úcollections.abcr   r   r   Úior   Útypingr   r   Ú%torch.utils.data.datapipes._decoratorr	   Ú#torch.utils.data.datapipes.datapiper
   Ú'torch.utils.data.datapipes.utils.commonr   Ú(torch.utils.data.datapipes.utils.decoderr   r   r   r   r   r   Ú__all__r7   r8   r   © r&   r%   ú<module>rD      s^   ðß 5Ñ 5Ý ß  å EÝ <Ý H÷ó ð 'Ð
'€ñ �_Ó%ô2U ¨U°3¸°8©_Ñ =ó 2Uó &ñ2Ur&   