Ë
    F^(h
  ã                   óJ   — d dl Z d dlZd dlZd dlmZmZ dd„Z G d„ de«      Zy)é    N)ÚAsyncFileSystemÚrunning_asyncc                 óB   ‡ — t        j                  ‰ «      ˆ fd„«       }|S )aF  
    Wraps a synchronous function to make it awaitable.

    Parameters
    ----------
    func : callable
        The synchronous function to wrap.
    obj : object, optional
        The instance to bind the function to, if applicable.

    Returns
    -------
    coroutine
        An awaitable version of the function.
    c               Ÿ   óR   •K  — t        j                  ‰g| ¢­i |¤Žƒ d {  –—† S 7 Œ­w©N)ÚasyncioÚ	to_thread)ÚargsÚkwargsÚfuncs     €úa/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/fsspec/implementations/asyn_wrapper.pyÚwrapperzasync_wrapper.<locals>.wrapper   s(   øè ø€ ä×&Ñ& tÐ=¨dÒ=°fÑ=×=Ð=Ð=ús   ƒ' %¡')Ú	functoolsÚwraps)r   Úobjr   s   `  r   Úasync_wrapperr      s'   ø€ ô" ‡_�_�TÓó>ó ð>ð €Nó    c                   óV   ‡ — e Zd ZdZdZdZddœˆ fd„
Zed„ «       Zd„ Z	e
d	„ «       Zˆ xZS )
ÚAsyncFileSystemWrapperaX  
    A wrapper class to convert a synchronous filesystem into an asynchronous one.

    This class takes an existing synchronous filesystem implementation and wraps all
    its methods to provide an asynchronous interface.

    Parameters
    ----------
    sync_fs : AbstractFileSystem
        The synchronous filesystem instance to wrap.
    r   FN)Úasynchronousc                ó¤   •— |€
t        «       }t        ‰| �  |d|i|¤Ž || _        | j                  j                  | _        | j                  «        y )Nr   )r   ÚsuperÚ__init__Úsync_fsÚprotocolÚ_wrap_all_sync_methods)ÚselfÚfsr   r
   r   Ú	__class__s        €r   r   zAsyncFileSystemWrapper.__init__0   sK   ø€ ØÐÜ(›?ˆLÜ‰Ñ˜$ÐD¨\ÐD¸VÒDØˆŒØŸ™×-Ñ-ˆŒØ×#Ñ#Õ%r   c                 ó4   — d| j                   j                  › �S )NÚasync_)r   Úfsid)r   s    r   r"   zAsyncFileSystemWrapper.fsid8   s   € à˜Ÿ™×)Ñ)Ð*Ð+Ð+r   c                 óv  — dh}t        | j                  «      D ]ž  }|j                  d«      s||v rŒt        j                  | j                  |«      }t        |t        «      rŒJt        | j                  |«      }t        |«      sŒlt        j                  |«      rŒ‚t        || ¬«      }t        | d|› �|«       Œ  y)zg
        Wrap all synchronous methods of the underlying filesystem with asynchronous versions.
        ÚopenÚ_)r   N)Údirr   Ú
startswithÚinspectÚgetattr_staticÚ
isinstanceÚpropertyÚgetattrÚcallabler   Úiscoroutinefunctionr   Úsetattr)r   Úexcluded_methodsÚmethod_nameÚattrÚmethodÚasync_methods         r   r   z-AsyncFileSystemWrapper._wrap_all_sync_methods<   s¤   € ð #˜8ÐÜ˜tŸ|™|Ó,ò 	?ˆKØ×%Ñ% cÔ*¨kÐ=MÑ.MØä×)Ñ)¨$¯,©,¸ÓDˆDÜ˜$¤Ô)Øä˜TŸ\™\¨;Ó7ˆFÜ˜Õ¬×(CÑ(CÀFÕ(KÜ,¨V¸Ô>�Ü˜  + Ð/°Õ>ñ	?r   c                 óL   ‡—  G ˆfd„d| «      }d‰j                   › d�|_         |S )a¥  
        Create a new class that can be used to instantiate an AsyncFileSystemWrapper
        with lazy instantiation of the underlying synchronous filesystem.

        Parameters
        ----------
        sync_fs_class : type
            The class of the synchronous filesystem to wrap.

        Returns
        -------
        type
            A new class that wraps the provided synchronous filesystem class.
        c                   ó"   •‡ — e Zd Zˆ ˆfd„Zˆ xZS )úJAsyncFileSystemWrapper.wrap_class.<locals>.GeneratedAsyncFileSystemWrapperc                 ó4   •—  ‰|i |¤Ž}t         ‰| �  |«       y r   )r   r   )r   r
   r   r   r   Úsync_fs_classs       €€r   r   zSAsyncFileSystemWrapper.wrap_class.<locals>.GeneratedAsyncFileSystemWrapper.__init__`   s   ø€ Ù'¨Ð8°Ñ8�Ü‘Ñ  Õ)r   )Ú__name__Ú
__module__Ú__qualname__r   Ú__classcell__)r   r9   s   @€r   ÚGeneratedAsyncFileSystemWrapperr7   _   s   ù„ ÷*ñ *r   r>   ÚAsyncÚWrapper)r:   )Úclsr9   r>   s    ` r   Ú
wrap_classz!AsyncFileSystemWrapper.wrap_classN   s4   ø€ ö"	*¨cô 	*ð �M×*Ñ*Ð+¨7Ð3ð 	(Ô0ð /Ð.r   )r:   r;   r<   Ú__doc__r   Úcachabler   r+   r"   r   ÚclassmethodrB   r=   )r   s   @r   r   r       sI   ø„ ñ
ð €HØ€Hà/3ö &ð ñ,ó ð,ò?ð$ ñ/ó ô/r   r   r   )r   r   r(   Úfsspec.asynr   r   r   r   © r   r   ú<module>rH      s$   ðÛ Û Û ç 6óô0G/˜_õ G/r   