On this page
asyncio.AbstractEventLoop
Up: asyncio | Next: asyncio.AbstractServer
Rel: asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed, asyncio.Barrier
Ref: docs.python.org — asyncio.AbstractEventLoop
Tags: #public #python3 #stdlib #asyncio
Import
import asyncio
from asyncio import AbstractEventLoop
Signature & Overview
asyncio.AbstractEventLoop()
Abstract event loop.
Methods & Attributes
AbstractEventLoop.add_reader(self, fd, callback, *args)—AbstractEventLoop.add_readermethod/property.AbstractEventLoop.add_signal_handler(self, sig, callback, *args)—AbstractEventLoop.add_signal_handlermethod/property.AbstractEventLoop.add_writer(self, fd, callback, *args)—AbstractEventLoop.add_writermethod/property.AbstractEventLoop.call_at(self, when, callback, *args, context=None)—AbstractEventLoop.call_atmethod/property.AbstractEventLoop.call_exception_handler(self, context)—AbstractEventLoop.call_exception_handlermethod/property.AbstractEventLoop.call_later(self, delay, callback, *args, context=None)—AbstractEventLoop.call_latermethod/property.AbstractEventLoop.call_soon(self, callback, *args, context=None)—AbstractEventLoop.call_soonmethod/property.AbstractEventLoop.call_soon_threadsafe(self, callback, *args, context=None)—AbstractEventLoop.call_soon_threadsafemethod/property.AbstractEventLoop.close(self)— Close the loop.AbstractEventLoop.connect_accepted_socket(self, protocol_factory, sock, *, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None)— Handle an accepted connection.AbstractEventLoop.connect_read_pipe(self, protocol_factory, pipe)— Register read pipe in event loop. Set the pipe to non-blocking mode.AbstractEventLoop.connect_write_pipe(self, protocol_factory, pipe)— Register write pipe in event loop.AbstractEventLoop.create_connection(self, protocol_factory, host=None, port=None, *, ssl=None, family=0, proto=0, flags=0, sock=None, local_addr=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, happy_eyeballs_delay=None, interleave=None)—AbstractEventLoop.create_connectionmethod/property.AbstractEventLoop.create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, reuse_address=None, reuse_port=None, allow_broadcast=None, sock=None)— A coroutine which creates a datagram endpoint.AbstractEventLoop.create_future(self)—AbstractEventLoop.create_futuremethod/property.AbstractEventLoop.create_server(self, protocol_factory, host=None, port=None, *, family=<AddressFamily.AF_UNSPEC: 0>, flags=<AddressInfo.AI_PASSIVE: 1>, sock=None, backlog=100, ssl=None, reuse_address=None, reuse_port=None, keep_alive=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)— A coroutine which creates a TCP server bound to host and port.AbstractEventLoop.create_task(self, coro, **kwargs)—AbstractEventLoop.create_taskmethod/property.AbstractEventLoop.create_unix_connection(self, protocol_factory, path=None, *, ssl=None, sock=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None)—AbstractEventLoop.create_unix_connectionmethod/property.AbstractEventLoop.create_unix_server(self, protocol_factory, path=None, *, sock=None, backlog=100, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None, start_serving=True)— A coroutine which creates a UNIX Domain Socket server.AbstractEventLoop.default_exception_handler(self, context)—AbstractEventLoop.default_exception_handlermethod/property.AbstractEventLoop.get_debug(self)—AbstractEventLoop.get_debugmethod/property.AbstractEventLoop.get_exception_handler(self)—AbstractEventLoop.get_exception_handlermethod/property.AbstractEventLoop.get_task_factory(self)—AbstractEventLoop.get_task_factorymethod/property.AbstractEventLoop.getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0)—AbstractEventLoop.getaddrinfomethod/property.AbstractEventLoop.getnameinfo(self, sockaddr, flags=0)—AbstractEventLoop.getnameinfomethod/property.AbstractEventLoop.is_closed(self)— Returns True if the event loop was closed.AbstractEventLoop.is_running(self)— Return whether the event loop is currently running.AbstractEventLoop.remove_reader(self, fd)—AbstractEventLoop.remove_readermethod/property.AbstractEventLoop.remove_signal_handler(self, sig)—AbstractEventLoop.remove_signal_handlermethod/property.AbstractEventLoop.remove_writer(self, fd)—AbstractEventLoop.remove_writermethod/property.AbstractEventLoop.run_forever(self)— Run the event loop until stop() is called.AbstractEventLoop.run_in_executor(self, executor, func, *args)—AbstractEventLoop.run_in_executormethod/property.AbstractEventLoop.run_until_complete(self, future)— Run the event loop until a Future is done.AbstractEventLoop.sendfile(self, transport, file, offset=0, count=None, *, fallback=True)— Send a file through a transport.AbstractEventLoop.set_debug(self, enabled)—AbstractEventLoop.set_debugmethod/property.AbstractEventLoop.set_default_executor(self, executor)—AbstractEventLoop.set_default_executormethod/property.AbstractEventLoop.set_exception_handler(self, handler)—AbstractEventLoop.set_exception_handlermethod/property.AbstractEventLoop.set_task_factory(self, factory)—AbstractEventLoop.set_task_factorymethod/property.AbstractEventLoop.shutdown_asyncgens(self)— Shutdown all active asynchronous generators.AbstractEventLoop.shutdown_default_executor(self)— Schedule the shutdown of the default executor.
Usage
import asyncio
async def main():
loop = asyncio.get_running_loop()
assert isinstance(loop, asyncio.AbstractEventLoop)
asyncio.run(main())
Gotchas
- Interface class for all event loops: Type-annotate loop parameters with
asyncio.AbstractEventLooprather than concrete subclasses.
REPL Inspect
from asyncio import AbstractEventLoop
help(AbstractEventLoop)
Linked from
- tuts/python3/stdlib_module/asyncio
- tuts/python3/stdlib_module/asyncio/AbstractServer
- tuts/python3/stdlib_module/asyncio/all_tasks
- tuts/python3/stdlib_module/asyncio/as_completed
- tuts/python3/stdlib_module/asyncio/Barrier
- tuts/python3/stdlib_module/asyncio/BaseEventLoop
- tuts/python3/stdlib_module/asyncio/BaseProtocol
- tuts/python3/stdlib_module/asyncio/BaseTransport
- tuts/python3/stdlib_module/asyncio/BoundedSemaphore
- tuts/python3/stdlib_module/asyncio/BrokenBarrierError
- tuts/python3/stdlib_module/asyncio/BufferedProtocol
- tuts/python3/stdlib_module/asyncio/CancelledError
- tuts/python3/stdlib_module/asyncio/capture_call_graph
- tuts/python3/stdlib_module/asyncio/Condition
- tuts/python3/stdlib_module/asyncio/create_eager_task_factory
- tuts/python3/stdlib_module/asyncio/create_subprocess_exec
- tuts/python3/stdlib_module/asyncio/create_subprocess_shell
- tuts/python3/stdlib_module/asyncio/create_task
- tuts/python3/stdlib_module/asyncio/current_task
- tuts/python3/stdlib_module/asyncio/DatagramProtocol
- tuts/python3/stdlib_module/asyncio/DatagramTransport
- tuts/python3/stdlib_module/asyncio/eager_task_factory
- tuts/python3/stdlib_module/asyncio/ensure_future
- tuts/python3/stdlib_module/asyncio/Event
- tuts/python3/stdlib_module/asyncio/EventLoop
- tuts/python3/stdlib_module/asyncio/format_call_graph
- tuts/python3/stdlib_module/asyncio/FrameCallGraphEntry
- tuts/python3/stdlib_module/asyncio/Future
- tuts/python3/stdlib_module/asyncio/future_add_to_awaited_by
- tuts/python3/stdlib_module/asyncio/future_discard_from_awaited_by
- tuts/python3/stdlib_module/asyncio/FutureCallGraph
- tuts/python3/stdlib_module/asyncio/gather
- tuts/python3/stdlib_module/asyncio/get_event_loop
- tuts/python3/stdlib_module/asyncio/get_event_loop_policy
- tuts/python3/stdlib_module/asyncio/get_running_loop
- tuts/python3/stdlib_module/asyncio/Handle
- tuts/python3/stdlib_module/asyncio/IncompleteReadError
- tuts/python3/stdlib_module/asyncio/iscoroutine
- tuts/python3/stdlib_module/asyncio/iscoroutinefunction
- tuts/python3/stdlib_module/asyncio/isfuture
- tuts/python3/stdlib_module/asyncio/new_event_loop
- tuts/python3/stdlib_module/asyncio/open_connection
- tuts/python3/stdlib_module/asyncio/open_unix_connection
- tuts/python3/stdlib_module/asyncio/print_call_graph
- tuts/python3/stdlib_module/asyncio/run
- tuts/python3/stdlib_module/asyncio/run_coroutine_threadsafe
- tuts/python3/stdlib_module/asyncio/set_event_loop
- tuts/python3/stdlib_module/asyncio/set_event_loop_policy
- tuts/python3/stdlib_module/asyncio/shield
- tuts/python3/stdlib_module/asyncio/sleep
- tuts/python3/stdlib_module/asyncio/start_server
- tuts/python3/stdlib_module/asyncio/start_unix_server
- tuts/python3/stdlib_module/asyncio/timeout
- tuts/python3/stdlib_module/asyncio/timeout_at
- tuts/python3/stdlib_module/asyncio/to_thread
Related notes
- tuts/python3/stdlib_module/asyncio/AbstractServer Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/all_tasks Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/as_completed Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/Barrier Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/asyncio/BaseEventLoop links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseProtocol links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseTransport links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BoundedSemaphore links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BrokenBarrierError links to this page; shared tags: #asyncio, #stdlib