� M�g ���ddlmZddlmZddlZddlZedd���ZGd�dej��Ze��Z Gd�d e ��Z d e fd �Z dS) �)� ContextVar)�OptionalN�current_async_library_cvar)�defaultc��eZdZdZdS)� _ThreadLocalN)�__name__� __module__� __qualname__�name���]/home/asafur/pinokio/api/open-webui.git/app/env/lib/python3.11/site-packages/sniffio/_impl.pyrr s������ �D�D�Drrc��eZdZdS)�AsyncLibraryNotFoundErrorN)r r r r rrrrs�������Drr�returnc�d�tj}|�|St���}|�|SdtjvrGddl} |j}n#t$r|j j}YnwxYw |���dSn#t$rYnwxYwdtjvrddl m }|��rdStd���)aeDetect 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.metarr)�valuerrrs r�current_async_libraryr!s��R � �E� ��� � &� *� *� ,� ,�E� ��� ��C�K������� 5�"�/�L�L��� 5� 5� 5�"�<�4�L�L�L� 5���� ��|�~�~�)� �y�*��� � � � �D� �����#�+���,�,�,�,�,�,� �=�?�?� ��7� #�8� � �s$�A � A"�!A"�& A3�3 B�?B)� contextvarsr�typingrr� threadingr�localrrrr�strr!r rr�<module>r's���"�"�"�"�"�"������� � � � �����'�Z� �$����� �����9�?�����|�~�~� � � � � � � � � � �F�s�F�F�F�F�F�Fr
Memory