PyDocs

Networking and Interprocess Communication

Networking and Interprocess Communication

asyncio

not WASI

The asyncio package, tracking PEP 3156.
Symbols in asyncio

_

_enter_task
Enter into task execution or resume suspended task.
_leave_task
Leave task execution or suspend a task.
_register_task
Register a new task in asyncio as executed by loop.
_unregister_task
Unregister a task.

a

AbstractEventLoop
Abstract event loop.
AbstractEventLoopPolicy
Abstract policy for accessing the event loop.
ALL_COMPLETED
The function will return when all futures finish or are cancelled.
all_tasks
Return a set of all tasks for the loop.
as_completed
Create an iterator of awaitables or their results in completion order.

b

Barrier
Asyncio equivalent to threading.Barrier
BaseProtocol
Common base class for protocol interfaces.
BaseTransport
Base class for transports.
BoundedSemaphore
A bounded semaphore implementation.
BrokenBarrierError
Barrier is broken by barrier.abort() call.
BufferedProtocol
Interface for stream protocol with manual buffer control.

c

CancelledError
The Future or Task was cancelled.
capture_call_graph
Capture the async call graph for the current task or the provided Future.
Condition
Asynchronous equivalent to threading.Condition.
create_eager_task_factory
Create a function suitable for use as a task factory on an event-loop.
create_subprocess_exec
Create a subprocess.
create_subprocess_shell
Run the cmd shell command.
create_task
Schedule the execution of a coroutine object in a spawn task.
current_task
Return a currently executed task.

d

DatagramProtocol
Interface for datagram protocol.
DatagramTransport
Interface for datagram (UDP) transports.
DefaultEventLoopPolicy
UNIX event loop policy

e

eager_task_factory
A task factory for eager task execution.
ensure_future
Wrap a coroutine or an awaitable in a future.
Event
Asynchronous equivalent to threading.Event.
EventLoop
Unix event loop.

f

FIRST_COMPLETED
The function will return when any future finishes or is cancelled.
FIRST_EXCEPTION
The function will return when any future finishes by raising an exception.
format_call_graph
Return the async call graph as a string for `future`.
Future
This class is *almost* compatible with concurrent.futures.Future.
future_add_to_awaited_by
Record that `fut` is awaited on by `waiter`.
future_discard_from_awaited_by
Record that future is no longer awaited on by waiter.

g

gather
Return a future aggregating results from the given coroutines/futures.
get_event_loop
Return an asyncio event loop.
get_event_loop_policy
Return the current process-wide policy.
get_running_loop
Return the running event loop.

h

Handle
Object returned by callback registration methods.

i

IncompleteReadError
Incomplete read error.
InvalidStateError
The operation is not allowed in this state.
iscoroutine
Return True if obj is a coroutine object.
isfuture
Check for a Future.

l

LifoQueue
A subclass of Queue that retrieves most recently added entries first.
LimitOverrunError
Reached the buffer limit while looking for a separator.
Lock
Primitive lock objects.
loop.add_reader
Start monitoring the fd file descriptor for read availability and invoke callback with the specified arguments once fd is available for reading.
loop.add_signal_handler
Set callback as the handler for the signum signal, passing args as positional arguments.
loop.add_writer
Start monitoring the fd file descriptor for write availability and invoke callback with the specified arguments args once fd is available for writing.
loop.call_at
Schedule callback to be called at the given absolute timestamp when (an int or a float), using the same time reference as loop.time().
loop.call_exception_handler
Call the current event loop exception handler.
loop.call_later
Schedule callback to be called after the given delay number of seconds (can be either an int or a float).
loop.call_soon
Schedule the callback callback to be called with args arguments at the next iteration of the event loop.
loop.call_soon_threadsafe
A thread-safe variant of call_soon().
loop.close
Close the event loop.
loop.connect_accepted_socket
Wrap an already accepted connection into a transport/protocol pair.
loop.connect_read_pipe
Register the read end of pipe in the event loop.
loop.connect_write_pipe
Register the write end of pipe in the event loop.
loop.create_connection
Open a streaming transport connection to a given address specified by host and port.
loop.create_datagram_endpoint
Create a datagram connection.
loop.create_future
Create an asyncio.Future object attached to the event loop.
loop.create_server
Create a TCP server (socket type SOCK_STREAM) listening on port of the host address.
loop.create_task
Schedule the execution of coroutine coro.
loop.create_unix_connection
Create a Unix connection.
loop.create_unix_server
Similar to loop.create_server() but works with the AF_UNIX socket family.
loop.default_exception_handler
Default exception handler.
loop.get_debug
Get the debug mode (bool) of the event loop.
loop.get_exception_handler
Return the current exception handler, or None if no custom exception handler was set.
loop.get_task_factory
Return a task factory or None if the default one is in use.
loop.getaddrinfo
Asynchronous version of socket.getaddrinfo().
loop.getnameinfo
Asynchronous version of socket.getnameinfo().
loop.is_closed
Return True if the event loop was closed.
loop.is_running
Return True if the event loop is currently running.
loop.remove_reader
Stop monitoring the fd file descriptor for read availability.
loop.remove_signal_handler
Remove the handler for the sig signal.
loop.remove_writer
Stop monitoring the fd file descriptor for write availability.
loop.run_forever
Run the event loop until stop() is called.
loop.run_in_executor
Arrange for func to be called in the specified executor passing args as positional arguments.
loop.run_until_complete
Run until the future (an instance of Future) has completed.
loop.sendfile
Send a file over a transport.
loop.set_debug
Set the debug mode of the event loop.
loop.set_default_executor
Set executor as the default executor used by run_in_executor().
loop.set_exception_handler
Set handler as the new event loop exception handler.
loop.set_task_factory
Set a task factory that will be used by loop.create_task().
loop.shutdown_asyncgens
Schedule all currently open asynchronous generator objects to close with an aclose() call.
loop.shutdown_default_executor
Schedule the closure of the default executor and wait for it to join all of the threads in the ThreadPoolExecutor.
loop.slow_callback_duration
This attribute can be used to set the minimum execution duration in seconds that is considered “slow”.
loop.sock_accept
Accept a connection.
loop.sock_connect
Connect sock to a remote socket at address.
loop.sock_recv
Receive up to nbytes from sock.
loop.sock_recv_into
Receive data from sock into the buf buffer.
loop.sock_recvfrom
Receive a datagram of up to bufsize from sock.
loop.sock_recvfrom_into
Receive a datagram of up to nbytes from sock into buf.
loop.sock_sendall
Send data to the sock socket.
loop.sock_sendfile
Send a file using high-performance os.sendfile if possible.
loop.sock_sendto
Send a datagram from sock to address.
loop.start_tls
Upgrade an existing transport-based connection to TLS.
loop.stop
Stop the event loop.
loop.subprocess_exec
Create a subprocess from one or more string arguments specified by args.
loop.subprocess_shell
Create a subprocess from cmd, which can be a str or a bytes string encoded to the filesystem encoding, using the platform’s “shell” syntax.
loop.time
Return the current time, as a float value, according to the event loop’s internal monotonic clock.

n

new_event_loop
Equivalent to calling get_event_loop_policy().new_event_loop().

o

open_connection
A wrapper for create_connection() returning a (reader, writer) pair.
open_unix_connection
Similar to `open_connection` but works with UNIX Domain Sockets.

p

print_call_graph
Print the async call graph for the current task or the provided Future.
PriorityQueue
A subclass of Queue; retrieves entries in priority order (lowest first).
ProactorEventLoop
A subclass of AbstractEventLoop for Windows that uses “I/O Completion Ports” (IOCP).
Protocol
Interface for stream protocol.

q

Queue
A queue, useful for coordinating producer and consumer coroutines.
QueueEmpty
Raised when Queue.get_nowait() is called on an empty Queue.
QueueFull
Raised when the Queue.put_nowait() method is called on a full Queue.
QueueShutDown
Raised when putting on to or getting from a shut-down Queue.

r

ReadTransport
Interface for read-only transports.
run
Execute the coroutine and return the result.
run_coroutine_threadsafe
Submit a coroutine object to a given event loop.
Runner
A context manager that controls event loop life cycle.

s

SelectorEventLoop
Unix event loop.
Semaphore
A Semaphore implementation.
SendfileNotAvailableError
Sendfile syscall is not available.
Server
Server objects are asynchronous context managers.
set_event_loop
Equivalent to calling get_event_loop_policy().set_event_loop(loop).
set_event_loop_policy
Set the current process-wide policy to policy.
shield
Wait for a future, shielding it from cancellation.
sleep
Coroutine that completes after a given time (in seconds).
start_server
Start a socket server, call back for each client connected.
start_unix_server
Similar to `start_server` but works with UNIX Domain Sockets.
StreamReader
Represents a reader object that provides APIs to read data from the IO stream.
StreamWriter
Wraps a Transport.
subprocess.DEVNULL
Special value that can be used as the stdin, stdout or stderr argument to process creation functions.
subprocess.PIPE
Can be passed to the stdin, stdout or stderr parameters.
subprocess.Process
An object that wraps OS processes created by the create_subprocess_exec() and create_subprocess_shell() functions.
subprocess.STDOUT
Special value that can be used as the stderr argument and indicates that standard error should be redirected into standard output.
SubprocessProtocol
Interface for protocol for subprocess calls.
SubprocessTransport
An abstraction to represent a connection between a parent and its child OS process.

t

Task
A coroutine wrapped in a Future.
TaskGroup
Asynchronous context manager for managing groups of tasks.
timeout
Timeout async context manager.
Timeout
Asynchronous context manager for cancelling overdue coroutines.
timeout_at
Schedule the timeout at absolute time.
TimeoutError
Timeout expired.
TimerHandle
Object returned by timed callback registration methods.
to_thread
Asynchronously run function *func* in a separate thread.
Transport
Interface representing a bidirectional transport.

w

wait
Wait for the Futures or Tasks given by fs to complete.
wait_for
Wait for the single Future or coroutine to complete, with timeout.
WindowsProactorEventLoopPolicy
An alternative event loop policy that uses the ProactorEventLoop event loop implementation.
WindowsSelectorEventLoopPolicy
An alternative event loop policy that uses the SelectorEventLoop event loop implementation.
wrap_future
Wrap concurrent.futures.Future object.
WriteTransport
Interface for write-only transports.