
    7Th                     T    S SK r S SKrS SKrS SKrS SKJrJr  SS jr " S S\5      rg)    N)AsyncFileSystemrunning_asyncc                 F   ^  [         R                  " T 5      U 4S j5       nU$ )a  
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                  T   >#    [         R                  " T/U Q70 UD6I S h  vN $  N7fN)asyncio	to_thread)argskwargsfuncs     [/var/www/auris/envauris/lib/python3.13/site-packages/fsspec/implementations/asyn_wrapper.pywrapperasync_wrapper.<locals>.wrapper   s'     &&t=d=f====s   (&()	functoolswraps)r   objr   s   `  r   async_wrapperr   	   s'    " __T> > N    c                   f   ^  \ rS rSrSrSrSr    S
U 4S jjr\S 5       r	S r
\S 5       rS	rU =r$ )AsyncFileSystemWrapper!   a8  
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.
)asyncwrapperr   Fc                    > Uc
  [        5       n[        TU ]  " SSU0UD6  Ub  Xl        O[        R
                  " U40 UD6U l        U R                  R                  U l        U R                  5         g )Nasynchronous )r   super__init__sync_fsfsspec
filesystemprotocol_wrap_all_sync_methods)selffsr   target_protocoltarget_optionsr   	__class__s         r   r   AsyncFileSystemWrapper.__init__1   se     (?L=l=f=>L!,,_OODL--##%r   c                 4    SU R                   R                   3$ )Nasync_)r   fsid)r#   s    r   r+   AsyncFileSystemWrapper.fsidC   s    ))*++r   c                    S1n[        U R                  5       H  nUR                  S5      (       d  X!;   a  M   [        R                  " U R                  U5      n[        U[        5      (       a  MX  [        U R                  U5      n[        U5      (       d  M  [        R                  " U5      (       a  M  [        X@S9n[        U SU 3U5        M     g)zW
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"   -AsyncFileSystemWrapper._wrap_all_sync_methodsG   s     #8t||,K%%c**k.M))$,,DD$))T\\;7F(C(CF(K(K,V>+/> -r   c                 N   ^  " U4S jSU 5      nSTR                    S3Ul         U$ )aM  
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                   ,   >^  \ rS rSrU U4S jrSrU =r$ )JAsyncFileSystemWrapper.wrap_class.<locals>.GeneratedAsyncFileSystemWrapperj   c                 4   > T" U0 UD6n[         TU ]  U5        g r   )r   r   )r#   r
   r   r   r'   sync_fs_classs       r   r   SAsyncFileSystemWrapper.wrap_class.<locals>.GeneratedAsyncFileSystemWrapper.__init__k   s    '88 )r   r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__)r'   rE   s   @r   GeneratedAsyncFileSystemWrapperrB   j   s    * *r   rM   AsyncWrapper)rG   )clsrE   rM   s    ` r   
wrap_class!AsyncFileSystemWrapper.wrap_classY   s4    "	*c 	* M**+73 	(0 /.r   )r!   r   )NNNN)rG   rH   rI   rJ   __doc__r!   cachabler   r5   r+   r"   classmethodrQ   rK   rL   )r'   s   @r   r   r   !   sT    
 /HH &$ , ,?$ / /r   r   r   )	r   r   r2   r   fsspec.asynr   r   r   r   r   r   r   <module>rW      s'        60Q/_ Q/r   