{
    "content": [
        {
            "type": "text",
            "text": "# _asyncio (pydoc)\n\n**Summary:** asyncio - Accelerator module for asyncio\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **MODULE REFERENCE** (8 lines)\n- **CLASSES** (4 lines) — 2 subsections\n  - class Future (101 lines)\n  - class Task (147 lines)\n- **FUNCTIONS** (1 lines) — 2 subsections\n  - get_event_loop (9 lines)\n  - get_running_loop (4 lines)\n- **FILE** (3 lines)\n\n## Full Content\n\n### NAME\n\nasyncio - Accelerator module for asyncio\n\n### MODULE REFERENCE\n\nhttps://docs.python.org/3.10/library/asyncio.html\n\nThe following documentation is automatically generated from the Python\nsource files.  It may be incomplete, incorrect or include features that\nare considered implementation detail and may vary between Python\nimplementations.  When in doubt, consult the module reference at the\nlocation listed above.\n\n### CLASSES\n\nbuiltins.object\nFuture\nTask\n\n#### class Future\n\n|  Future(*, loop=None)\n|\n|  This class is *almost* compatible with concurrent.futures.Future.\n|\n|  Differences:\n|\n|  - result() and exception() do not take a timeout argument and\n|    raise an exception when the future isn't done yet.\n|\n|  - Callbacks registered with adddonecallback() are always called\n|    via the event loop's callsoonthreadsafe().\n|\n|  - This class is not compatible with the wait() and ascompleted()\n|    methods in the concurrent.futures package.\n|\n|  Methods defined here:\n|\n|  await(self, /)\n|      Return an iterator to be used in await expression.\n|\n|  del(...)\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  adddonecallback(...)\n|      Add a callback to be run when the future becomes done.\n|\n|      The callback is called with a single argument - the future object. If\n|      the future is already done when this is called, the callback is\n|      scheduled with callsoon.\n|\n|  cancel(self, /, msg=None)\n|      Cancel the future and schedule callbacks.\n|\n|      If the future is already done or cancelled, return False.  Otherwise,\n|      change the future's state to cancelled, schedule the callbacks and\n|      return True.\n|\n|  cancelled(self, /)\n|      Return True if the future was cancelled.\n|\n|  done(self, /)\n|      Return True if the future is done.\n|\n|      Done means either that a result / exception are available, or that the\n|      future was cancelled.\n|\n|  exception(self, /)\n|      Return the exception that was set on this future.\n|\n|      The exception (or None if no exception was set) is returned only if\n|      the future is done.  If the future has been cancelled, raises\n|      CancelledError.  If the future isn't done yet, raises\n|      InvalidStateError.\n|\n|  getloop(self, /)\n|      Return the event loop the Future is bound to.\n|\n|  removedonecallback(self, fn, /)\n|      Remove all instances of a callback from the \"call when done\" list.\n|\n|      Returns the number of callbacks removed.\n|\n|  result(self, /)\n|      Return the result this future represents.\n|\n|      If the future has been cancelled, raises CancelledError.  If the\n|      future's result isn't yet available, raises InvalidStateError.  If\n|      the future is done and has an exception set, this exception is raised.\n|\n|  setexception(self, exception, /)\n|      Mark the future done and set an exception.\n|\n|      If the future is already done when this method is called, raises\n|      InvalidStateError.\n|\n|  setresult(self, result, /)\n|      Mark the future done and set its result.\n|\n|      If the future is already done when this method is called, raises\n|      InvalidStateError.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\n|\n|  new(*args, kwargs) from builtins.type\n|      Create and return a new object.  See help(type) for accurate signature.\n\n#### class Task\n\n|  Task(coro, *, loop=None, name=None)\n|\n|  A coroutine wrapped in a Future.\n|\n|  Method resolution order:\n|      Task\n|      Future\n|      builtins.object\n|\n|  Methods defined here:\n|\n|  await(self, /)\n|      Return an iterator to be used in await expression.\n|\n|  del(...)\n|\n|  init(self, /, *args, kwargs)\n|      Initialize self.  See help(type(self)) for accurate signature.\n|\n|  iter(self, /)\n|      Implement iter(self).\n|\n|  repr(self, /)\n|      Return repr(self).\n|\n|  adddonecallback(...)\n|      Add a callback to be run when the future becomes done.\n|\n|      The callback is called with a single argument - the future object. If\n|      the future is already done when this is called, the callback is\n|      scheduled with callsoon.\n|\n|  cancel(self, /, msg=None)\n|      Request that this task cancel itself.\n|\n|      This arranges for a CancelledError to be thrown into the\n|      wrapped coroutine on the next cycle through the event loop.\n|      The coroutine then has a chance to clean up or even deny\n|      the request using try/except/finally.\n|\n|      Unlike Future.cancel, this does not guarantee that the\n|      task will be cancelled: the exception might be caught and\n|      acted upon, delaying cancellation of the task or preventing\n|      cancellation completely.  The task may also return a value or\n|      raise a different exception.\n|\n|      Immediately after this method is called, Task.cancelled() will\n|      not return True (unless the task was already cancelled).  A\n|      task will be marked as cancelled when the wrapped coroutine\n|      terminates with a CancelledError exception (even if cancel()\n|      was not called).\n|\n|  cancelled(self, /)\n|      Return True if the future was cancelled.\n|\n|  done(self, /)\n|      Return True if the future is done.\n|\n|      Done means either that a result / exception are available, or that the\n|      future was cancelled.\n|\n|  exception(self, /)\n|      Return the exception that was set on this future.\n|\n|      The exception (or None if no exception was set) is returned only if\n|      the future is done.  If the future has been cancelled, raises\n|      CancelledError.  If the future isn't done yet, raises\n|      InvalidStateError.\n|\n|  getcoro(self, /)\n|\n|  getname(self, /)\n|\n|  getstack(self, /, *, limit=None)\n|      Return the list of stack frames for this task's coroutine.\n|\n|      If the coroutine is not done, this returns the stack where it is\n|      suspended.  If the coroutine has completed successfully or was\n|      cancelled, this returns an empty list.  If the coroutine was\n|      terminated by an exception, this returns the list of traceback\n|      frames.\n|\n|      The frames are always ordered from oldest to newest.\n|\n|      The optional limit gives the maximum number of frames to\n|      return; by default all available frames are returned.  Its\n|      meaning differs depending on whether a stack or a traceback is\n|      returned: the newest frames of a stack are returned, but the\n|      oldest frames of a traceback are returned.  (This matches the\n|      behavior of the traceback module.)\n|\n|      For reasons beyond our control, only one stack frame is\n|      returned for a suspended coroutine.\n|\n|  printstack(self, /, *, limit=None, file=None)\n|      Print the stack or traceback for this task's coroutine.\n|\n|      This produces output similar to that of the traceback module,\n|      for the frames retrieved by getstack().  The limit argument\n|      is passed to getstack().  The file argument is an I/O stream\n|      to which the output is written; by default output is written\n|      to sys.stderr.\n|\n|  removedonecallback(self, fn, /)\n|      Remove all instances of a callback from the \"call when done\" list.\n|\n|      Returns the number of callbacks removed.\n|\n|  result(self, /)\n|      Return the result this future represents.\n|\n|      If the future has been cancelled, raises CancelledError.  If the\n|      future's result isn't yet available, raises InvalidStateError.  If\n|      the future is done and has an exception set, this exception is raised.\n|\n|  setexception(self, exception, /)\n|      Mark the future done and set an exception.\n|\n|      If the future is already done when this method is called, raises\n|      InvalidStateError.\n|\n|  setname(self, value, /)\n|\n|  setresult(self, result, /)\n|      Mark the future done and set its result.\n|\n|      If the future is already done when this method is called, raises\n|      InvalidStateError.\n|\n|  ----------------------------------------------------------------------\n|  Class methods defined here:\n|\n|  classgetitem(...) from builtins.type\n|      See PEP 585\n|\n|  ----------------------------------------------------------------------\n|  Static methods defined here:\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 Future:\n|\n|  getloop(self, /)\n|      Return the event loop the Future is bound to.\n\n### FUNCTIONS\n\n#### get_event_loop\n\nReturn an asyncio event loop.\n\nWhen called from a coroutine or a callback (e.g. scheduled with\ncallsoon or similar API), this function will always return the\nrunning event loop.\n\nIf there is no running event loop set, the function will return\nthe result of `geteventlooppolicy().geteventloop()` call.\n\n#### get_running_loop\n\nReturn the running event loop.  Raise a RuntimeError if there is none.\n\nThis function is thread-specific.\n\n### FILE\n\n/usr/lib/python3.10/lib-dynload/asyncio.cpython-310-x8664-linux-gnu.so\n\n"
        }
    ],
    "structuredContent": {
        "command": "_asyncio",
        "section": "",
        "mode": "pydoc",
        "summary": "asyncio - Accelerator module for asyncio",
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "MODULE REFERENCE",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "CLASSES",
                "lines": 4,
                "subsections": [
                    {
                        "name": "class Future",
                        "lines": 101
                    },
                    {
                        "name": "class Task",
                        "lines": 147
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "get_event_loop",
                        "lines": 9
                    },
                    {
                        "name": "get_running_loop",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "FILE",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}