On this page
asyncio.BaseEventLoop
Prev: asyncio.Barrier | Up: asyncio | Next: asyncio.BaseProtocol
Rel: asyncio.AbstractEventLoop, asyncio.AbstractServer, asyncio.all_tasks, asyncio.as_completed
Ref: docs.python.org — asyncio.BaseEventLoop
Tags: #public #python3 #stdlib #asyncio
Import
import asyncio
from asyncio import BaseEventLoop
Signature & Overview
asyncio.BaseEventLoop()
asyncio.BaseEventLoop class.
Methods & Attributes
BaseEventLoop.add_reader(self, fd, callback, *args)—BaseEventLoop.add_readermethod/property.BaseEventLoop.add_signal_handler(self, sig, callback, *args)—BaseEventLoop.add_signal_handlermethod/property.BaseEventLoop.add_writer(self, fd, callback, *args)—BaseEventLoop.add_writermethod/property.BaseEventLoop.call_at(self, when, callback, *args, context=None)— Like call_later(), but uses an absolute time.BaseEventLoop.call_exception_handler(self, context)— Call the current event loop's exception handler.BaseEventLoop.call_later(self, delay, callback, *args, context=None)— Arrange for a callback to be called at a given time.BaseEventLoop.call_soon(self, callback, *args, context=None)— Arrange for a callback to be called as soon as possible.BaseEventLoop.call_soon_threadsafe(self, callback, *args, context=None)— Like call_soon(), but thread-safe.BaseEventLoop.close(self)— Close the event loop.BaseEventLoop.connect_accepted_socket(self, protocol_factory, sock, *, ssl=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None)—BaseEventLoop.connect_accepted_socketmethod/property.BaseEventLoop.connect_read_pipe(self, protocol_factory, pipe)—BaseEventLoop.connect_read_pipemethod/property.BaseEventLoop.connect_write_pipe(self, protocol_factory, pipe)—BaseEventLoop.connect_write_pipemethod/property.BaseEventLoop.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, all_errors=False)— Connect to a TCP server.BaseEventLoop.create_datagram_endpoint(self, protocol_factory, local_addr=None, remote_addr=None, *, family=0, proto=0, flags=0, reuse_port=None, allow_broadcast=None, sock=None)— Create datagram connection.BaseEventLoop.create_future(self)— Create a Future object attached to the loop.BaseEventLoop.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)— Create a TCP server.BaseEventLoop.create_task(self, coro, **kwargs)— Schedule or begin executing a coroutine object.BaseEventLoop.create_unix_connection(self, protocol_factory, path=None, *, ssl=None, sock=None, server_hostname=None, ssl_handshake_timeout=None, ssl_shutdown_timeout=None)—BaseEventLoop.create_unix_connectionmethod/property.BaseEventLoop.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.BaseEventLoop.default_exception_handler(self, context)— Default exception handler.BaseEventLoop.get_debug(self)—BaseEventLoop.get_debugmethod/property.BaseEventLoop.get_exception_handler(self)— Return an exception handler, or None if the default one is in use.BaseEventLoop.get_task_factory(self)— Return a task factory, or None if the default one is in use.BaseEventLoop.getaddrinfo(self, host, port, *, family=0, type=0, proto=0, flags=0)—BaseEventLoop.getaddrinfomethod/property.BaseEventLoop.getnameinfo(self, sockaddr, flags=0)—BaseEventLoop.getnameinfomethod/property.BaseEventLoop.is_closed(self)— Returns True if the event loop was closed.BaseEventLoop.is_running(self)— Returns True if the event loop is running.BaseEventLoop.remove_reader(self, fd)—BaseEventLoop.remove_readermethod/property.BaseEventLoop.remove_signal_handler(self, sig)—BaseEventLoop.remove_signal_handlermethod/property.BaseEventLoop.remove_writer(self, fd)—BaseEventLoop.remove_writermethod/property.BaseEventLoop.run_forever(self)— Run until stop() is called.BaseEventLoop.run_in_executor(self, executor, func, *args)—BaseEventLoop.run_in_executormethod/property.BaseEventLoop.run_until_complete(self, future)— Run until the Future is done.BaseEventLoop.sendfile(self, transport, file, offset=0, count=None, *, fallback=True)— Send a file to transport.BaseEventLoop.set_debug(self, enabled)—BaseEventLoop.set_debugmethod/property.BaseEventLoop.set_default_executor(self, executor)—BaseEventLoop.set_default_executormethod/property.BaseEventLoop.set_exception_handler(self, handler)— Set handler as the new event loop exception handler.BaseEventLoop.set_task_factory(self, factory)— Set a task factory that will be used by loop.create_task().BaseEventLoop.shutdown_asyncgens(self)— Shutdown all active asynchronous generators.BaseEventLoop.shutdown_default_executor(self, timeout=None)— Schedule the shutdown of the default executor.
Usage
import asyncio
assert issubclass(asyncio.BaseEventLoop, asyncio.AbstractEventLoop)
Gotchas
- Internal base implementation: Obtain the active loop via
asyncio.get_running_loop()rather than instantiatingBaseEventLoopdirectly.
REPL Inspect
from asyncio import BaseEventLoop
help(BaseEventLoop)
Linked from
Related notes
- tuts/python3/stdlib_module/asyncio/Barrier Linked here; links to this page; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseProtocol 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/AbstractEventLoop Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/AbstractServer Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/all_tasks Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/as_completed Linked here; shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BaseTransport shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BoundedSemaphore shared tags: #asyncio, #stdlib
- tuts/python3/stdlib_module/asyncio/BrokenBarrierError shared tags: #asyncio, #stdlib