
    ,h                         d dl mZ d dlmZ d dlZd dlZ edd      Z G d dej                        Z e       Z	 G d d	e
      Zd
efdZy)    )
ContextVar)OptionalNcurrent_async_library_cvar)defaultc                       e Zd ZdZy)_ThreadLocalN)__name__
__module____qualname__name     O/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/sniffio/_impl.pyr   r      s	     Dr   r   c                       e Zd Zy)AsyncLibraryNotFoundErrorN)r	   r
   r   r   r   r   r   r      s    r   r   returnc                  r   t         j                  } | | S t        j                         } | | S dt        j
                  v rddl}	 |j                  }	  |       y	 dt        j
                  v rddlm}  |       ryt        d      # t        $ r |j                  j                  }Y Vw xY w# t        $ r Y [w xY w)ae  Detect which async library is currently running.

    The following libraries are currently supported:

    ================   ===========  ============================
    Library             Requires     Magic string
    ================   ===========  ============================
    **Trio**            Trio v0.6+   ``"trio"``
    **Curio**           -            ``"curio"``
    **asyncio**                      ``"asyncio"``
    **Trio-asyncio**    v0.8.2+     ``"trio"`` or ``"asyncio"``,
                                    depending on current mode
    ================   ===========  ============================

    Returns:
      A string like ``"trio"``.

    Raises:
      AsyncLibraryNotFoundError: if called from synchronous context,
        or if the current async library was not recognized.

    Examples:

        .. code-block:: python3

           from sniffio import current_async_library

           async def generic_sleep(seconds):
               library = current_async_library()
               if library == "trio":
                   import trio
                   await trio.sleep(seconds)
               elif library == "asyncio":
                   import asyncio
                   await asyncio.sleep(seconds)
               # ... and so on ...
               else:
                   raise RuntimeError(f"Unsupported library {library!r}")

    Nasyncior   curio)curio_runningz.unknown async library, or not in async context)thread_localr   r   getsysmodulesr   current_taskAttributeErrorTaskRuntimeError
curio.metar   r   )valuer   r   r   s       r   current_async_libraryr!      s    R E&**,E CKK	5"//L	~)  * #++,?
#8   	5"<<44L	5
  		s$   B B* B'&B'*	B65B6)contextvarsr   typingr   r   	threadingr   localr   r   r   r   strr!   r   r   r   <module>r'      sT    "  
 ' $ 
9??  ~	 	Fs Fr   