anyio API reference
106 public APIs from anyio (agronholm/anyio) — 31 classes, 20 functions, 55 methods. Signatures extracted by static analysis of the actual source.
Repository: agronholm/anyio
| Kind | Count |
|---|---|
| Classes | 31 |
| Functions | 20 |
| Methods | 55 |
API list
method
src.anyio._backends._asyncio.Runner.close() -> NoneShutdown and close event loop.
method
src.anyio._backends._asyncio.Runner.get_loop() -> AbstractEventLoopReturn embedded event loop.
method
src.anyio._backends._asyncio.Runner.run(coro:Coroutine[T_Retval], *context=None) -> T_RetvalRun a coroutine inside the embedded event loop.
func
src.anyio._core._eventloop.get_all_backends() -> tuple[str, ...]Return a tuple of the names of all built-in backends.
func
src.anyio._core._eventloop.get_available_backends() -> tuple[str, ...]Test for the availability of built-in backends.
func
src.anyio._core._eventloop.sleep(delay:float) -> NonePause the current task for the specified duration.
func
src.anyio._core._eventloop.sleep_forever() -> NonePause the current task until it's cancelled.
func
src.anyio._core._eventloop.sleep_until(deadline:float) -> NonePause the current task until the given time.
class
src.anyio._core._exceptions.ConnectionFailedRaised when a connection attempt fails.
class
src.anyio._core._exceptions.WouldBlockRaised by ``X_nowait`` functions if ``X()`` would block.
class
src.anyio._core._fileio.AsyncFileAn asynchronous file object.
method
src.anyio._core._fileio.AsyncFile.wrapped() -> IO[AnyStr]The wrapped file object.
class
src.anyio._core._fileio.PathAn asynchronous version of :class:`pathlib.Path`.
func
src.anyio._core._fileio.wrap_file(file:IO[AnyStr], *limiter:CapacityLimiter | None=None) -> AsyncFile[AnyStr]Wrap an existing file as an asynchronous file.
class
src.anyio._core._futures.Future.StatusThe status of a future handle.
method
src.anyio._core._futures.Future.return_value() -> TThe return value of the future.
method
src.anyio._core._futures.Future.status() -> Future.StatusThe current status of a future.
method
src.anyio._core._futures.Future.wait() -> NoneWaits for the future to finish.
func
src.anyio._core._resources.aclose_forcefully(resource:AsyncResource) -> NoneClose an asynchronous resource in a cancelled scope.
func
src.anyio._core._signals.open_signal_receiver(*signals:Signals) -> AbstractContextManager[AsyncIterator[Signals]]Start receiving operating system signals.
class
src.anyio._core._sockets.TCPConnectableConnects to a TCP server at the given host and port.
class
src.anyio._core._sockets.UNIXConnectableConnects to a UNIX domain socket at the given path.
func
src.anyio._core._sockets.connect_unix(path:str | bytes | PathLike[Any]) -> UNIXSocketStreamConnect to the given UNIX socket.
func
src.anyio._core._sockets.create_udp_socket(family:AnyIPAddressFamily=AddressFamily.AF_UNSPEC, *local_host:IPAddressType | None=None, *local_port:int=0, *reuse_port:bool=False) -> UDPSocketCreate a UDP socket.
func
src.anyio._core._sockets.create_unix_datagram_socket(*local_path:None | str | bytes | PathLike[Any]=None, *local_mode:int | None=None) -> UNIXDatagramSocketCreate a UNIX datagram socket.
func
src.anyio._core._sockets.create_unix_listener(path:str | bytes | PathLike[Any], *mode:int | None=None, *backlog:int=65536) -> SocketListenerCreate a UNIX socket listener.
func
src.anyio._core._sockets.getnameinfo(sockaddr:IPSockAddrType, flags:int=0) -> Awaitable[tuple[str, str]]Look up the host name of an IP address.
func
src.anyio._core._sockets.wait_readable(obj:FileDescriptorLike) -> Awaitable[None]Wait until the given object has data to be read.
func
src.anyio._core._sockets.wait_socket_readable(sock:socket.socket) -> Awaitable[None]..
func
src.anyio._core._sockets.wait_socket_writable(sock:socket.socket) -> Awaitable[None]..
func
src.anyio._core._sockets.wait_writable(obj:FileDescriptorLike) -> Awaitable[None]Wait until the given object can be written to.
class
src.anyio._core._streams.create_memory_object_streamCreate a memory object stream.
method
src.anyio._core._synchronization.Condition.acquire() -> NoneAcquire the underlying lock.
method
src.anyio._core._synchronization.Condition.acquire_nowait() -> NoneAcquire the underlying lock, without blocking.
method
src.anyio._core._synchronization.Condition.locked() -> boolReturn True if the lock is set.
method
src.anyio._core._synchronization.Condition.notify(n:int=1) -> NoneNotify exactly n listeners.
method
src.anyio._core._synchronization.Condition.notify_all() -> NoneNotify all the listeners.
method
src.anyio._core._synchronization.Condition.release() -> NoneRelease the underlying lock.
method
src.anyio._core._synchronization.Condition.wait() -> NoneWait for a notification.
method
src.anyio._core._synchronization.Condition.wait_for(predicate:Callable[[], T]) -> TWait until a predicate becomes true.
method
src.anyio._core._synchronization.Event.is_set() -> boolReturn ``True`` if the flag is set, ``False`` if not.
method
src.anyio._core._synchronization.Event.set() -> NoneSet the flag, notifying all listeners.
method
src.anyio._core._synchronization.Event.wait() -> NoneWait until the flag has been set.
method
src.anyio._core._synchronization.Lock.acquire() -> NoneAcquire the lock.
method
src.anyio._core._synchronization.Lock.acquire_nowait() -> NoneAcquire the lock, without blocking.
method
src.anyio._core._synchronization.Lock.locked() -> boolReturn True if the lock is currently held.
method
src.anyio._core._synchronization.Lock.release() -> NoneRelease the lock.
method
src.anyio._core._synchronization.Semaphore.acquire() -> NoneDecrement the semaphore value, blocking if necessary.
method
src.anyio._core._synchronization.Semaphore.acquire_nowait() -> NoneAcquire the underlying lock, without blocking.
method
src.anyio._core._synchronization.Semaphore.max_value() -> int | NoneThe maximum value of the semaphore.
method
src.anyio._core._synchronization.Semaphore.release() -> NoneIncrement the semaphore value.
method
src.anyio._core._synchronization.Semaphore.value() -> intThe current value of the semaphore.
class
src.anyio._core._tasks.CancelScopeWraps a unit of work that can be made separately cancellable.
method
src.anyio._core._tasks.CancelScope.cancel(reason:str | None=None) -> NoneCancel this scope immediately.
method
src.anyio._core._tasks.CancelScope.cancel_called() -> bool``True`` if :meth:`cancel` has been called.
class
src.anyio._core._tasks.TaskHandle.StatusThe status of a task handle.
method
src.anyio._core._tasks.TaskHandle.cancel() -> NoneSet the task to a cancelled state.
method
src.anyio._core._tasks.TaskHandle.name() -> strThe name of the task.
method
src.anyio._core._tasks.TaskHandle.return_value() -> T_coThe return value of the task.
method
src.anyio._core._tasks.TaskHandle.status() -> TaskHandle.StatusThe current status of the task.
method
src.anyio._core._tasks.TaskHandle.wait() -> NoneWait for the task to finish.
func
src.anyio._core._tasks.create_task_group() -> TaskGroupCreate a task group.
class
src.anyio._core._typedattr.TypedAttributeSetSuperclass for typed attribute collections.
func
src.anyio._core._typedattr.typed_attribute() -> AnyReturn a unique object, used to mark typed attributes.
class
src.anyio.abc._resources.AsyncResourceAbstract base class for all closeable asynchronous resources.
method
src.anyio.abc._resources.AsyncResource.aclose() -> NoneClose the resource.
class
src.anyio.abc._sockets.ConnectedUDPSocketRepresents an connected UDP socket.
class
src.anyio.abc._sockets.ConnectedUNIXDatagramSocketRepresents a connected Unix datagram socket.
class
src.anyio.abc._sockets.SocketAttribute..
class
src.anyio.abc._sockets.SocketListenerListens to incoming socket connections.
method
src.anyio.abc._sockets.SocketListener.accept() -> SocketStreamAccept an incoming connection.
class
src.anyio.abc._sockets.SocketStreamTransports bytes over a socket.
class
src.anyio.abc._sockets.UDPSocketRepresents an unconnected UDP socket.
class
src.anyio.abc._sockets.UNIXDatagramSocketRepresents an unconnected Unix datagram socket.
class
src.anyio.abc._streams.ByteReceiveStreamAn interface for receiving bytes from a single peer.
method
src.anyio.abc._streams.ByteReceiveStream.receive(max_bytes:int=65536) -> bytesReceive at most ``max_bytes`` bytes from the peer.
class
src.anyio.abc._streams.ByteSendStreamAn interface for sending bytes to a single peer.
method
src.anyio.abc._streams.ByteSendStream.send(item:bytes) -> NoneSend the given bytes to the peer.
class
src.anyio.abc._streams.ByteStreamA bidirectional byte stream.
method
src.anyio.abc._streams.ByteStream.send_eof() -> NoneSend an end-of-file indication to the peer.
class
src.anyio.abc._streams.UnreliableObjectReceiveStreamAn interface for receiving objects.
method
src.anyio.abc._streams.UnreliableObjectReceiveStream.receive() -> T_coReceive the next item.
class
src.anyio.abc._streams.UnreliableObjectSendStreamAn interface for sending objects.
method
src.anyio.abc._streams.UnreliableObjectSendStream.send(item:T_contra) -> NoneSend an item to the peer(s).
class
src.anyio.abc._subprocesses.ProcessAn asynchronous version of :class:`subprocess.Popen`.
method
src.anyio.abc._subprocesses.Process.kill() -> NoneKills the process.
method
src.anyio.abc._subprocesses.Process.pid() -> intThe process ID of the process.
method
src.anyio.abc._subprocesses.Process.returncode() -> int | NoneThe return code of the process.
method
src.anyio.abc._subprocesses.Process.send_signal(signal:Signals) -> NoneSend a signal to the subprocess.
method
src.anyio.abc._subprocesses.Process.stdin() -> ByteSendStream | NoneThe stream for the standard input of the process.
method
src.anyio.abc._subprocesses.Process.stdout() -> ByteReceiveStream | NoneThe stream for the standard output of the process.
method
src.anyio.abc._subprocesses.Process.terminate() -> NoneTerminates the process, gracefully if possible.
method
src.anyio.abc._subprocesses.Process.wait() -> intWait until the process exits.
class
src.anyio.abc._tasks.TaskGroupGroups several asynchronous tasks together.
method
src.anyio.abc._tasks.TaskGroup.cancel(reason:str | None=None) -> NoneCancel this task group's cancel scope immediately.
method
src.anyio.abc._tasks.TaskGroup.start_soon(func:Callable[[Unpack[PosArgsT]], Coroutine[Any, Any, T_co]], *name:object=None, *args:Unpack[PosArgsT]) -> TaskHandle[T_co]Start a new task in this task group.
class
src.anyio.from_thread.BlockingPortalProviderA manager for a blocking portal.
func
src.anyio.from_thread.run(func:Callable[[Unpack[PosArgsT]], Coroutine[Any, Any, T_co]], *token:EventLoopToken | None=None, *args:Unpack[PosArgsT]) -> T_coCall a coroutine function from a worker thread.
class
src.anyio.lowlevel.EventLoopTokenAn opaque object that holds a reference to an event loop.
method
src.anyio.lowlevel.RunVar.set(value:T) -> RunvarToken[T]Set the value of this run variable for the current event loop.
class
src.anyio.streams.file.FileReadStreamA byte stream that reads from a file in the file system.
method
src.anyio.streams.file.FileReadStream.from_path(path:str | PathLike[str]) -> FileReadStreamCreate a file read stream by opening the given file.
method
src.anyio.streams.file.FileReadStream.seek(position:int, whence:int=SEEK_SET) -> intSeek the file to the given position.
method
src.anyio.streams.file.FileReadStream.tell() -> intReturn the current stream position.
class
src.anyio.streams.file.FileWriteStreamA byte stream that writes to a file in the file system.
class
src.anyio.streams.tls.TLSAttributeContains Transport Layer Security related attributes.
About this data
These signatures were extracted from the public source of agronholm/anyio
using Python's ast module. Argument names, default values,
type annotations and return types are taken verbatim from the code.
Implementation bodies are never stored. See
how it works for details.