{
    "mode": "pydoc",
    "parameter": "sniffio",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/pydoc/sniffio/json",
    "generated": "2026-07-17T03:28:18Z",
    "sections": {
        "NAME": {
            "content": "sniffio - Top-level package for sniffio.\n",
            "subsections": []
        },
        "PACKAGE CONTENTS": {
            "content": "impl\ntests (package)\nversion\n",
            "subsections": []
        },
        "CLASSES": {
            "content": "builtins.RuntimeError(builtins.Exception)\nsniffio.impl.AsyncLibraryNotFoundError\n",
            "subsections": [
                {
                    "name": "class AsyncLibraryNotFoundError",
                    "content": "|  Method resolution order:\n|      AsyncLibraryNotFoundError\n|      builtins.RuntimeError\n|      builtins.Exception\n|      builtins.BaseException\n|      builtins.object\n|\n|  Data descriptors defined here:\n|\n|  weakref\n|      list of weak references to the object (if defined)\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.RuntimeError:\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Static methods inherited from builtins.RuntimeError:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n|\n|  ----------------------------------------------------------------------\n|  Methods inherited from builtins.BaseException:\n|\n|  delattr(self, name, /)\n|      Implement delattr(self, name).\n|\n|  getattribute(self, name, /)\n|      Return getattr(self, name).\n|\n|  reduce(...)\n|      Helper for pickle.\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  setattr(self, name, value, /)\n|      Implement setattr(self, name, value).\n|\n|  setstate(...)\n|\n|  str(self, /)\n|      Return str(self).\n|\n|  withtraceback(...)\n|      Exception.withtraceback(tb) --\n|      set self.traceback to tb and return self.\n|\n|  ----------------------------------------------------------------------\n|  Data descriptors inherited from builtins.BaseException:\n|\n|  cause\n|      exception cause\n|\n|  context\n|      exception context\n|\n|  dict\n|\n|  suppresscontext\n|\n|  traceback\n|\n|  args\n"
                }
            ]
        },
        "FUNCTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "current_async_library",
                    "content": "Detect which async library is currently running.\n\nThe following libraries are currently supported:\n\n================   ===========  ============================\nLibrary             Requires     Magic string\n================   ===========  ============================\nTrio            Trio v0.6+   ``\"trio\"``\nCurio           -            ``\"curio\"``\nasyncio                      ``\"asyncio\"``\nTrio-asyncio    v0.8.2+     ``\"trio\"`` or ``\"asyncio\"``,\ndepending on current mode\n================   ===========  ============================\n\nReturns:\nA string like ``\"trio\"``.\n\nRaises:\nAsyncLibraryNotFoundError: if called from synchronous context,\nor if the current async library was not recognized.\n\nExamples:\n\n.. code-block:: python3\n\nfrom sniffio import currentasynclibrary\n\nasync def genericsleep(seconds):\nlibrary = currentasynclibrary()\nif library == \"trio\":\nimport trio\nawait trio.sleep(seconds)\nelif library == \"asyncio\":\nimport asyncio\nawait asyncio.sleep(seconds)\n# ... and so on ...\nelse:\nraise RuntimeError(f\"Unsupported library {library!r}\")\n"
                }
            ]
        },
        "DATA": {
            "content": "all = ['currentasynclibrary', 'AsyncLibraryNotFoundError', 'curr...\ncurrentasynclibrarycvar = <ContextVar name='currentasynclibraryc...\nthreadlocal = <sniffio.impl.ThreadLocal object>\n",
            "subsections": []
        },
        "VERSION": {
            "content": "1.3.1\n",
            "subsections": []
        },
        "FILE": {
            "content": "/home/chedong/.local/lib/python3.10/site-packages/sniffio/init.py\n\n",
            "subsections": []
        }
    },
    "summary": "sniffio - Top-level package for sniffio.",
    "flags": [],
    "examples": [],
    "see_also": []
}