Help on package anyio: NAME anyio PACKAGE CONTENTS _backends (package) _core (package) abc (package) from_thread functools itertools lowlevel pytest_plugin streams (package) to_interpreter to_process to_thread CLASSES anyio.abc.AsyncResource(builtins.object) AsyncFile(anyio.abc.AsyncResource, typing.Generic) SpooledTemporaryFile anyio.abc.ByteStreamConnectable(builtins.object) TCPConnectable UNIXConnectable builtins.Exception(builtins.BaseException) BrokenResourceError BrokenWorkerInterpreter BrokenWorkerProcess BusyResourceError ClosedResourceError DelimiterNotFound EndOfStream IncompleteRead TaskFailed TaskCancelled TaskNotFinished WouldBlock builtins.LookupError(builtins.Exception) TypedAttributeLookupError builtins.OSError(builtins.Exception) ConnectionFailed builtins.RuntimeError(builtins.Exception) NoEventLoopError RunFinishedError builtins.object AsyncContextManagerMixin CancelScope CapacityLimiter CapacityLimiterStatistics Condition ConditionStatistics ContextManagerMixin Event EventStatistics Lock LockStatistics Path ResourceGuard Semaphore SemaphoreStatistics TaskInfo TypedAttributeProvider TypedAttributeSet builtins.tuple(builtins.object) create_memory_object_stream typing.Generic(builtins.object) AsyncFile(anyio.abc.AsyncResource, typing.Generic) SpooledTemporaryFile NamedTemporaryFile TaskHandle TemporaryDirectory TemporaryFile class AsyncContextManagerMixin(builtins.object) | Mixin class providing async context manager functionality via a generator-based | implementation. | | This class allows you to implement a context manager via | :meth:`__asynccontextmanager__`. The mechanics are meant to mirror those of | :func:`@asynccontextmanager <contextlib.asynccontextmanager>`. | | .. note:: Classes using this mix-in are not reentrant as context managers, meaning | that once you enter it, you can't re-enter before first exiting it. | | .. seealso:: :doc:`contextmanagers` | | Methods defined here: | | async __aenter__(self: '_SupportsAsyncCtxMgr[_T_co, bool | None]') -> '_T_co' | | async __aexit__(self: '_SupportsAsyncCtxMgr[object, _ExitT_co]', exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> '_ExitT_co' | | __asynccontextmanager__(self) -> 'AbstractAsyncContextManager[object, bool | None]' | Implement your async context manager logic here. | | This method **must** be decorated with | :func:`@asynccontextmanager <contextlib.asynccontextmanager>`. | | .. note:: Remember that the ``yield`` will raise any exception raised in the | enclosed context block, so use a ``finally:`` block to clean up resources! | | :return: an async context manager object | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'_AsyncContextManagerMixin__cm': 'AbstractAsyncCont... class AsyncFile(anyio.abc.AsyncResource, typing.Generic) | AsyncFile(fp: 'IO[AnyStr]', *, limiter: 'CapacityLimiter | None' = None) -> 'None' | | An asynchronous file object. | | This class wraps a standard file object and provides async friendly versions of the | following blocking methods (where available on the original file object): | | * read | * read1 | * readline | * readlines | * readinto | * readinto1 | * write | * writelines | * truncate | * seek | * tell | * flush | | All other methods are directly passed through. | | This class supports the asynchronous context manager protocol which closes the | underlying file at the end of the context block. | | This class also supports asynchronous iteration:: | | async with await open_file(...) as f: | async for line in f: | print(line) | | Method resolution order: | AsyncFile | anyio.abc.AsyncResource | typing.Generic | builtins.object | | Methods defined here: | | async __aiter__(self) -> 'AsyncIterator[AnyStr]' | | __getattr__(self, name: 'str') -> 'object' | | __init__(self, fp: 'IO[AnyStr]', *, limiter: 'CapacityLimiter | None' = None) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | async aclose(self) -> 'None' | Close the resource. | | async flush(self) -> 'None' | | async read(self, size: 'int' = -1) -> 'AnyStr' | | async read1(self: 'AsyncFile[bytes]', size: 'int' = -1) -> 'bytes' | | async readinto(self: 'AsyncFile[bytes]', b: 'WriteableBuffer') -> 'int' | | async readinto1(self: 'AsyncFile[bytes]', b: 'WriteableBuffer') -> 'int' | | async readline(self) -> 'AnyStr' | | async readlines(self) -> 'list[AnyStr]' | | async seek(self, offset: 'int', whence: 'int | None' = 0) -> 'int' | | async tell(self) -> 'int' | | async truncate(self, size: 'int | None' = None) -> 'int' | | async write(self, b: 'ReadableBuffer | str') -> 'int' | | async writelines(self, lines: 'Iterable[ReadableBuffer] | Iterable[str]') -> 'None' | | ---------------------------------------------------------------------- | Readonly properties defined here: | | limiter | The capacity limiter used by this file object, if not the global limiter. | | wrapped | The wrapped file object. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __abstractmethods__ = frozenset() | | __orig_bases__ = (<class 'anyio.abc.AsyncResource'>, typing.Generic[~A... | | __parameters__ = (~AnyStr,) | | ---------------------------------------------------------------------- | Methods inherited from anyio.abc.AsyncResource: | | async __aenter__(self: 'T') -> 'T' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' | | ---------------------------------------------------------------------- | Class methods inherited from typing.Generic: | | __class_getitem__(params) from abc.ABCMeta | | __init_subclass__(*args, **kwargs) from abc.ABCMeta | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. class BrokenResourceError(builtins.Exception) | Raised when trying to use a resource that has been rendered unusable due to external | causes (e.g. a send stream whose peer has disconnected). | | Method resolution order: | BrokenResourceError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class BrokenWorkerInterpreter(builtins.Exception) | BrokenWorkerInterpreter(excinfo: 'Any') | | Raised by :meth:`~anyio.to_interpreter.run_sync` if an unexpected exception is | raised in the subinterpreter. | | Method resolution order: | BrokenWorkerInterpreter | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, excinfo: 'Any') | Initialize self. See help(type(self)) for accurate signature. | | __str__(self) -> 'str' | Return str(self). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class BrokenWorkerProcess(builtins.Exception) | Raised by :meth:`~anyio.to_process.run_sync` if the worker process terminates abruptly or | otherwise misbehaves. | | Method resolution order: | BrokenWorkerProcess | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class BusyResourceError(builtins.Exception) | BusyResourceError(action: 'str') | | Raised when two tasks are trying to read from or write to the same resource | concurrently. | | Method resolution order: | BusyResourceError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, action: 'str') | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class CancelScope(builtins.object) | CancelScope(*, deadline: 'float' = inf, shield: 'bool' = False) -> 'CancelScope' | | Wraps a unit of work that can be made separately cancellable. | | :param deadline: The time (clock value) when this scope is cancelled automatically | :param shield: ``True`` to shield the cancel scope from external cancellation | :raises NoEventLoopError: if no supported asynchronous event loop is running in the | current thread | | Methods defined here: | | __enter__(self) -> 'CancelScope' | | __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'bool' | | cancel(self, reason: 'str | None' = None) -> 'None' | Cancel this scope immediately. | | :param reason: a message describing the reason for the cancellation | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(cls, *, deadline: 'float' = inf, shield: 'bool' = False) -> 'CancelScope' | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | cancel_called | ``True`` if :meth:`cancel` has been called. | | cancelled_caught | ``True`` if this scope suppressed a cancellation exception it itself raised. | | This is typically used to check if any work was interrupted, or to see if the | scope was cancelled due to its deadline being reached. The value will, however, | only be ``True`` if the cancellation was triggered by the scope itself (and not | an outer scope). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | deadline | The time (clock value) when this scope is cancelled automatically. | | Will be ``float('inf')`` if no timeout has been set. | | shield | ``True`` if this scope is shielded from external cancellation. | | While a scope is shielded, it will not receive cancellations from outside. class CapacityLimiter(builtins.object) | CapacityLimiter(total_tokens: 'float') -> 'CapacityLimiter' | | Methods defined here: | | async __aenter__(self) -> 'None' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' | | async acquire(self) -> 'None' | Acquire a token for the current task, waiting if necessary for one to become | available. | | acquire_nowait(self) -> 'None' | Acquire a token for the current task without waiting for one to become | available. | | :raises ~anyio.WouldBlock: if there are no tokens available for borrowing | | async acquire_on_behalf_of(self, borrower: 'object') -> 'None' | Acquire a token, waiting if necessary for one to become available. | | :param borrower: the entity borrowing a token | | acquire_on_behalf_of_nowait(self, borrower: 'object') -> 'None' | Acquire a token without waiting for one to become available. | | :param borrower: the entity borrowing a token | :raises ~anyio.WouldBlock: if there are no tokens available for borrowing | | release(self) -> 'None' | Release the token held by the current task. | | :raises RuntimeError: if the current task has not borrowed a token from this | limiter. | | release_on_behalf_of(self, borrower: 'object') -> 'None' | Release the token held by the given borrower. | | :raises RuntimeError: if the borrower has not borrowed a token from this | limiter. | | statistics(self) -> 'CapacityLimiterStatistics' | Return statistics about the current state of this limiter. | | .. versionadded:: 3.0 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(cls, total_tokens: 'float') -> 'CapacityLimiter' | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | available_tokens | The number of tokens currently available to be borrowed | | borrowed_tokens | The number of tokens that have currently been borrowed. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | total_tokens | The total number of tokens available for borrowing. | | This is a read-write property. If the total number of tokens is increased, the | proportionate number of tasks waiting on this limiter will be granted their | tokens. | | .. versionchanged:: 3.0 | The property is now writable. | .. versionchanged:: 4.12 | The value can now be set to 0. class CapacityLimiterStatistics(builtins.object) | CapacityLimiterStatistics(borrowed_tokens: 'int', total_tokens: 'float', borrowers: 'tuple[object, ...]', tasks_waiting: 'int') -> None | | :ivar int borrowed_tokens: number of tokens currently borrowed by tasks | :ivar float total_tokens: total number of available tokens | :ivar tuple borrowers: tasks or other objects currently holding tokens borrowed from | this limiter | :ivar int tasks_waiting: number of tasks waiting on | :meth:`~.CapacityLimiter.acquire` or | :meth:`~.CapacityLimiter.acquire_on_behalf_of` | | Methods defined here: | | __delattr__(self, name) | Implement delattr(self, name). | | __eq__(self, other) | Return self==value. | | __hash__(self) | Return hash(self). | | __init__(self, borrowed_tokens: 'int', total_tokens: 'float', borrowers: 'tuple[object, ...]', tasks_waiting: 'int') -> None | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | __setattr__(self, name, value) | Implement setattr(self, name, value). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'borrowed_tokens': 'int', 'borrowers': 'tuple[objec... | | __dataclass_fields__ = {'borrowed_tokens': Field(name='borrowed_tokens... | | __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or... | | __match_args__ = ('borrowed_tokens', 'total_tokens', 'borrowers', 'tas... class ClosedResourceError(builtins.Exception) | Raised when trying to use a resource that has been closed. | | Method resolution order: | ClosedResourceError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class Condition(builtins.object) | Condition(lock: 'Lock | None' = None) | | Methods defined here: | | async __aenter__(self) -> 'None' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' | | __init__(self, lock: 'Lock | None' = None) | Initialize self. See help(type(self)) for accurate signature. | | async acquire(self) -> 'None' | Acquire the underlying lock. | | acquire_nowait(self) -> 'None' | Acquire the underlying lock, without blocking. | | :raises ~anyio.WouldBlock: if the operation would block | | locked(self) -> 'bool' | Return True if the lock is set. | | notify(self, n: 'int' = 1) -> 'None' | Notify exactly n listeners. | | notify_all(self) -> 'None' | Notify all the listeners. | | release(self) -> 'None' | Release the underlying lock. | | statistics(self) -> 'ConditionStatistics' | Return statistics about the current state of this condition. | | .. versionadded:: 3.0 | | async wait(self) -> 'None' | Wait for a notification. | | async wait_for(self, predicate: 'Callable[[], T]') -> 'T' | Wait until a predicate becomes true. | | :param predicate: a callable that returns a truthy value when the condition is | met | :return: the result of the predicate | | .. versionadded:: 4.11.0 | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) class ConditionStatistics(builtins.object) | ConditionStatistics(tasks_waiting: 'int', lock_statistics: 'LockStatistics') -> None | | :ivar int tasks_waiting: number of tasks blocked on :meth:`~.Condition.wait` | :ivar ~anyio.LockStatistics lock_statistics: statistics of the underlying | :class:`~.Lock` | | Methods defined here: | | __delattr__(self, name) | Implement delattr(self, name). | | __eq__(self, other) | Return self==value. | | __hash__(self) | Return hash(self). | | __init__(self, tasks_waiting: 'int', lock_statistics: 'LockStatistics') -> None | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | __setattr__(self, name, value) | Implement setattr(self, name, value). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'lock_statistics': 'LockStatistics', 'tasks_waiting... | | __dataclass_fields__ = {'lock_statistics': Field(name='lock_statistics... | | __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or... | | __match_args__ = ('tasks_waiting', 'lock_statistics') class ConnectionFailed(builtins.OSError) | Raised when a connection attempt fails. | | .. note:: This class inherits from :exc:`OSError` for backwards compatibility. | | Method resolution order: | ConnectionFailed | builtins.OSError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.OSError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | __reduce__(...) | Helper for pickle. | | __str__(self, /) | Return str(self). | | ---------------------------------------------------------------------- | Static methods inherited from builtins.OSError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.OSError: | | characters_written | | errno | POSIX exception code | | filename | exception filename | | filename2 | second exception filename | | strerror | exception strerror | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class ContextManagerMixin(builtins.object) | Mixin class providing context manager functionality via a generator-based | implementation. | | This class allows you to implement a context manager via :meth:`__contextmanager__` | which should return a generator. The mechanics are meant to mirror those of | :func:`@contextmanager <contextlib.contextmanager>`. | | .. note:: Classes using this mix-in are not reentrant as context managers, meaning | that once you enter it, you can't re-enter before first exiting it. | | .. seealso:: :doc:`contextmanagers` | | Methods defined here: | | __contextmanager__(self) -> 'AbstractContextManager[object, bool | None]' | Implement your context manager logic here. | | This method **must** be decorated with | :func:`@contextmanager <contextlib.contextmanager>`. | | .. note:: Remember that the ``yield`` will raise any exception raised in the | enclosed context block, so use a ``finally:`` block to clean up resources! | | :return: a context manager object | | __enter__(self: '_SupportsCtxMgr[_T_co, bool | None]') -> '_T_co' | | __exit__(self: '_SupportsCtxMgr[object, _ExitT_co]', exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> '_ExitT_co' | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'_ContextManagerMixin__cm': 'AbstractContextManager... class DelimiterNotFound(builtins.Exception) | DelimiterNotFound(max_bytes: 'int') -> 'None' | | Raised during | :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the | maximum number of bytes has been read without the delimiter being found. | | Method resolution order: | DelimiterNotFound | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self, max_bytes: 'int') -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class EndOfStream(builtins.Exception) | Raised when trying to read from a stream that has been closed from the other end. | | Method resolution order: | EndOfStream | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class Event(builtins.object) | Event() -> 'Event' | | Methods defined here: | | is_set(self) -> 'bool' | Return ``True`` if the flag is set, ``False`` if not. | | set(self) -> 'None' | Set the flag, notifying all listeners. | | statistics(self) -> 'EventStatistics' | Return statistics about the current state of this event. | | async wait(self) -> 'None' | Wait until the flag has been set. | | If the flag has already been set when this method is called, it returns | immediately. | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(cls) -> 'Event' | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) class EventStatistics(builtins.object) | EventStatistics(tasks_waiting: 'int') -> None | | :ivar int tasks_waiting: number of tasks waiting on :meth:`~.Event.wait` | | Methods defined here: | | __delattr__(self, name) | Implement delattr(self, name). | | __eq__(self, other) | Return self==value. | | __hash__(self) | Return hash(self). | | __init__(self, tasks_waiting: 'int') -> None | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | __setattr__(self, name, value) | Implement setattr(self, name, value). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'tasks_waiting': 'int'} | | __dataclass_fields__ = {'tasks_waiting': Field(name='tasks_waiting',ty... | | __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or... | | __match_args__ = ('tasks_waiting',) class IncompleteRead(builtins.Exception) | IncompleteRead() -> 'None' | | Raised during | :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_exactly` or | :meth:`~anyio.streams.buffered.BufferedByteReceiveStream.receive_until` if the | connection is closed before the requested amount of bytes has been read. | | Method resolution order: | IncompleteRead | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class Lock(builtins.object) | Lock(*, fast_acquire: 'bool' = False) -> 'Lock' | | Methods defined here: | | async __aenter__(self) -> 'None' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' | | async acquire(self) -> 'None' | Acquire the lock. | | acquire_nowait(self) -> 'None' | Acquire the lock, without blocking. | | :raises ~anyio.WouldBlock: if the operation would block | | locked(self) -> 'bool' | Return True if the lock is currently held. | | release(self) -> 'None' | Release the lock. | | statistics(self) -> 'LockStatistics' | Return statistics about the current state of this lock. | | .. versionadded:: 3.0 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(cls, *, fast_acquire: 'bool' = False) -> 'Lock' | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) class LockStatistics(builtins.object) | LockStatistics(locked: 'bool', owner: 'TaskInfo | None', tasks_waiting: 'int') -> None | | :ivar bool locked: flag indicating if this lock is locked or not | :ivar ~anyio.TaskInfo owner: task currently holding the lock (or ``None`` if the | lock is not held by any task) | :ivar int tasks_waiting: number of tasks waiting on :meth:`~.Lock.acquire` | | Methods defined here: | | __delattr__(self, name) | Implement delattr(self, name). | | __eq__(self, other) | Return self==value. | | __hash__(self) | Return hash(self). | | __init__(self, locked: 'bool', owner: 'TaskInfo | None', tasks_waiting: 'int') -> None | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | __setattr__(self, name, value) | Implement setattr(self, name, value). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'locked': 'bool', 'owner': 'TaskInfo | None', 'task... | | __dataclass_fields__ = {'locked': Field(name='locked',type='bool',defa... | | __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or... | | __match_args__ = ('locked', 'owner', 'tasks_waiting') class NamedTemporaryFile(typing.Generic) | NamedTemporaryFile(mode: 'OpenBinaryMode | OpenTextMode' = 'w+b', buffering: 'int' = -1, encoding: 'str | None' = None, newline: 'str | None' = None, suffix: 'str | None' = None, prefix: 'str | None' = None, dir: 'str | None' = None, delete: 'bool' = True, *, errors: 'str | None' = None, delete_on_close: 'bool' = True) -> 'None' | | An asynchronous named temporary file that is automatically created and cleaned up. | | This class provides an asynchronous context manager for a temporary file with a | visible name in the file system. It uses Python's standard | :func:`~tempfile.NamedTemporaryFile` function and wraps the file object with | :class:`AsyncFile` for asynchronous operations. | | :param mode: The mode in which the file is opened. Defaults to "w+b". | :param buffering: The buffering policy (-1 means the default buffering). | :param encoding: The encoding used to decode or encode the file. Only applicable in | text mode. | :param newline: Controls how universal newlines mode works (only applicable in text | mode). | :param suffix: The suffix for the temporary file name. | :param prefix: The prefix for the temporary file name. | :param dir: The directory in which the temporary file is created. | :param delete: Whether to delete the file when it is closed. | :param errors: The error handling scheme used for encoding/decoding errors. | :param delete_on_close: (Python 3.12+) Whether to delete the file on close. | | Method resolution order: | NamedTemporaryFile | typing.Generic | builtins.object | | Methods defined here: | | async __aenter__(self) -> 'AsyncFile[AnyStr]' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_value: 'BaseException | None', traceback: 'TracebackType | None') -> 'None' | | __init__(self, mode: 'OpenBinaryMode | OpenTextMode' = 'w+b', buffering: 'int' = -1, encoding: 'str | None' = None, newline: 'str | None' = None, suffix: 'str | None' = None, prefix: 'str | None' = None, dir: 'str | None' = None, delete: 'bool' = True, *, errors: 'str | None' = None, delete_on_close: 'bool' = True) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'_async_file': 'AsyncFile[AnyStr]'} | | __orig_bases__ = (typing.Generic[~AnyStr],) | | __parameters__ = (~AnyStr,) | | ---------------------------------------------------------------------- | Class methods inherited from typing.Generic: | | __class_getitem__(params) from builtins.type | | __init_subclass__(*args, **kwargs) from builtins.type | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. class NoEventLoopError(builtins.RuntimeError) | Raised by several functions that require an event loop to be running in the current | thread when there is no running event loop. | | This is also raised by :func:`.from_thread.run` and :func:`.from_thread.run_sync` | if not calling from an AnyIO worker thread, and no ``token`` was passed. | | Method resolution order: | NoEventLoopError | builtins.RuntimeError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.RuntimeError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.RuntimeError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class Path(builtins.object) | Path(*args: 'str | PathLike[str]', limiter: 'CapacityLimiter | None' = None) -> 'None' | | An asynchronous version of :class:`pathlib.Path`. | | This class cannot be substituted for :class:`pathlib.Path` or | :class:`pathlib.PurePath`, but it is compatible with the :class:`os.PathLike` | interface. | | It implements the Python 3.10 version of :class:`pathlib.Path` interface, except for | the deprecated :meth:`~pathlib.Path.link_to` method. | | Some methods may be unavailable or have limited functionality, based on the Python | version: | | * :meth:`~pathlib.Path.copy` (available on Python 3.14 or later) | * :meth:`~pathlib.Path.copy_into` (available on Python 3.14 or later) | * :meth:`~pathlib.Path.from_uri` (available on Python 3.13 or later) | * :meth:`~pathlib.PurePath.full_match` (available on Python 3.13 or later) | * :attr:`~pathlib.Path.info` (available on Python 3.14 or later) | * :meth:`~pathlib.Path.is_junction` (available on Python 3.12 or later) | * :meth:`~pathlib.PurePath.match` (the ``case_sensitive`` parameter is only | available on Python 3.13 or later) | * :meth:`~pathlib.Path.move` (available on Python 3.14 or later) | * :meth:`~pathlib.Path.move_into` (available on Python 3.14 or later) | * :meth:`~pathlib.PurePath.relative_to` (the ``walk_up`` parameter is only available | on Python 3.12 or later) | * :meth:`~pathlib.Path.walk` (available on Python 3.12 or later) | | Any methods that do disk I/O need to be awaited on. These methods are: | | * :meth:`~pathlib.Path.absolute` | * :meth:`~pathlib.Path.chmod` | * :meth:`~pathlib.Path.cwd` | * :meth:`~pathlib.Path.exists` | * :meth:`~pathlib.Path.expanduser` | * :meth:`~pathlib.Path.group` | * :meth:`~pathlib.Path.hardlink_to` | * :meth:`~pathlib.Path.home` | * :meth:`~pathlib.Path.is_block_device` | * :meth:`~pathlib.Path.is_char_device` | * :meth:`~pathlib.Path.is_dir` | * :meth:`~pathlib.Path.is_fifo` | * :meth:`~pathlib.Path.is_file` | * :meth:`~pathlib.Path.is_junction` | * :meth:`~pathlib.Path.is_mount` | * :meth:`~pathlib.Path.is_socket` | * :meth:`~pathlib.Path.is_symlink` | * :meth:`~pathlib.Path.lchmod` | * :meth:`~pathlib.Path.lstat` | * :meth:`~pathlib.Path.mkdir` | * :meth:`~pathlib.Path.open` | * :meth:`~pathlib.Path.owner` | * :meth:`~pathlib.Path.read_bytes` | * :meth:`~pathlib.Path.read_text` | * :meth:`~pathlib.Path.readlink` | * :meth:`~pathlib.Path.rename` | * :meth:`~pathlib.Path.replace` | * :meth:`~pathlib.Path.resolve` | * :meth:`~pathlib.Path.rmdir` | * :meth:`~pathlib.Path.samefile` | * :meth:`~pathlib.Path.stat` | * :meth:`~pathlib.Path.symlink_to` | * :meth:`~pathlib.Path.touch` | * :meth:`~pathlib.Path.unlink` | * :meth:`~pathlib.Path.walk` | * :meth:`~pathlib.Path.write_bytes` | * :meth:`~pathlib.Path.write_text` | | Additionally, the following methods return an async iterator yielding | :class:`~.Path` objects: | | * :meth:`~pathlib.Path.glob` | * :meth:`~pathlib.Path.iterdir` | * :meth:`~pathlib.Path.rglob` | | .. versionchanged:: 4.14.0 | Added the ``limiter`` keyword argument. | | Methods defined here: | | __bytes__(self) -> 'bytes' | | __eq__(self, other: 'object') -> 'bool' | Return self==value. | | __fspath__(self) -> 'str' | | __ge__(self, other: 'pathlib.PurePath | Path') -> 'bool' | Return self>=value. | | __gt__(self, other: 'pathlib.PurePath | Path') -> 'bool' | Return self>value. | | __hash__(self) -> 'int' | Return hash(self). | | __init__(self, *args: 'str | PathLike[str]', limiter: 'CapacityLimiter | None' = None) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | __le__(self, other: 'pathlib.PurePath | Path') -> 'bool' | Return self<=value. | | __lt__(self, other: 'pathlib.PurePath | Path') -> 'bool' | Return self<value. | | __repr__(self) -> 'str' | Return repr(self). | | __rtruediv__(self, other: 'str | PathLike[str]') -> 'Self' | | __str__(self) -> 'str' | Return str(self). | | __truediv__(self, other: 'str | PathLike[str]') -> 'Self' | | async absolute(self) -> 'Self' | | as_posix(self) -> 'str' | | as_uri(self) -> 'str' | | async chmod(self, mode: 'int', *, follow_symlinks: 'bool' = True) -> 'None' | | async exists(self) -> 'bool' | | async expanduser(self) -> 'Self' | | glob(self, pattern: 'str') -> 'AsyncIterator[Self]' | # Python 3.11 and earlier | | async group(self) -> 'str' | | async hardlink_to(self, target: 'str | bytes | PathLike[str] | PathLike[bytes]') -> 'None' | | is_absolute(self) -> 'bool' | | async is_block_device(self) -> 'bool' | | async is_char_device(self) -> 'bool' | | async is_dir(self) -> 'bool' | | async is_fifo(self) -> 'bool' | | async is_file(self) -> 'bool' | | async is_mount(self) -> 'bool' | | is_relative_to(self, other: 'str | PathLike[str]') -> 'bool' | | is_reserved(self) -> 'bool' | | async is_socket(self) -> 'bool' | | async is_symlink(self) -> 'bool' | | async iterdir(self) -> 'AsyncIterator[Self]' | | joinpath(self, *args: 'str | PathLike[str]') -> 'Self' | | async lchmod(self, mode: 'int') -> 'None' | | async lstat(self) -> 'os.stat_result' | | match(self, path_pattern: 'str') -> 'bool' | | async mkdir(self, mode: 'int' = 511, parents: 'bool' = False, exist_ok: 'bool' = False) -> 'None' | | async open(self, mode: 'str' = 'r', buffering: 'int' = -1, encoding: 'str | None' = None, errors: 'str | None' = None, newline: 'str | None' = None) -> 'AsyncFile[Any]' | | async owner(self) -> 'str' | | async read_bytes(self) -> 'bytes' | | async read_text(self, encoding: 'str | None' = None, errors: 'str | None' = None) -> 'str' | | async readlink(self) -> 'Self' | | relative_to(self, *other: 'str | PathLike[str]') -> 'Self' | | async rename(self, target: 'str | pathlib.PurePath | Path') -> 'Self' | | async replace(self, target: 'str | pathlib.PurePath | Path') -> 'Self' | | async resolve(self, strict: 'bool' = False) -> 'Self' | | rglob(self, pattern: 'str') -> 'AsyncIterator[Self]' | # Pre Python 3.12 | | async rmdir(self) -> 'None' | | async samefile(self, other_path: 'str | PathLike[str]') -> 'bool' | | async stat(self, *, follow_symlinks: 'bool' = True) -> 'os.stat_result' | | async symlink_to(self, target: 'str | bytes | PathLike[str] | PathLike[bytes]', target_is_directory: 'bool' = False) -> 'None' | | async touch(self, mode: 'int' = 438, exist_ok: 'bool' = True) -> 'None' | | async unlink(self, missing_ok: 'bool' = False) -> 'None' | | with_name(self, name: 'str') -> 'Self' | | with_segments(self, *pathsegments: 'str | PathLike[str]') -> 'Self' | | with_stem(self, stem: 'str') -> 'Self' | | with_suffix(self, suffix: 'str') -> 'Self' | | async write_bytes(self, data: 'ReadableBuffer') -> 'int' | | async write_text(self, data: 'str', encoding: 'str | None' = None, errors: 'str | None' = None, newline: 'str | None' = None) -> 'int' | | ---------------------------------------------------------------------- | Class methods defined here: | | async cwd(*, limiter: 'CapacityLimiter | None' = None) -> 'Self' from builtins.type | | async home(*, limiter: 'CapacityLimiter | None' = None) -> 'Self' from builtins.type | | ---------------------------------------------------------------------- | Readonly properties defined here: | | anchor | | drive | | limiter | The capacity limiter used by this path, if not the global limiter. | | name | | parent | | parents | | parts | | root | | stem | | suffix | | suffixes | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'__weakref__': 'Any'} class ResourceGuard(builtins.object) | ResourceGuard(action: 'str' = 'using') | | A context manager for ensuring that a resource is only used by a single task at a | time. | | Entering this context manager while the previous has not exited it yet will trigger | :exc:`BusyResourceError`. | | :param action: the action to guard against (visible in the :exc:`BusyResourceError` | when triggered, e.g. "Another task is already {action} this resource") | | .. versionadded:: 4.1 | | Methods defined here: | | __enter__(self) -> 'None' | | __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' | | __init__(self, action: 'str' = 'using') | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | action class RunFinishedError(builtins.RuntimeError) | RunFinishedError() -> 'None' | | Raised by :func:`.from_thread.run` and :func:`.from_thread.run_sync` if the event | loop associated with the explicitly passed token has already finished. | | Method resolution order: | RunFinishedError | builtins.RuntimeError | builtins.Exception | builtins.BaseException | builtins.object | | Methods defined here: | | __init__(self) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Static methods inherited from builtins.RuntimeError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class Semaphore(builtins.object) | Semaphore(initial_value: 'int', *, max_value: 'int | None' = None, fast_acquire: 'bool' = False) -> 'Semaphore' | | Methods defined here: | | async __aenter__(self) -> 'Semaphore' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' | | __init__(self, initial_value: 'int', *, max_value: 'int | None' = None, fast_acquire: 'bool' = False) | Initialize self. See help(type(self)) for accurate signature. | | async acquire(self) -> 'None' | Decrement the semaphore value, blocking if necessary. | | acquire_nowait(self) -> 'None' | Acquire the underlying lock, without blocking. | | :raises ~anyio.WouldBlock: if the operation would block | | release(self) -> 'None' | Increment the semaphore value. | | statistics(self) -> 'SemaphoreStatistics' | Return statistics about the current state of this semaphore. | | .. versionadded:: 3.0 | | ---------------------------------------------------------------------- | Static methods defined here: | | __new__(cls, initial_value: 'int', *, max_value: 'int | None' = None, fast_acquire: 'bool' = False) -> 'Semaphore' | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | max_value | The maximum value of the semaphore. | | value | The current value of the semaphore. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) class SemaphoreStatistics(builtins.object) | SemaphoreStatistics(tasks_waiting: 'int') -> None | | :ivar int tasks_waiting: number of tasks waiting on :meth:`~.Semaphore.acquire` | | Methods defined here: | | __delattr__(self, name) | Implement delattr(self, name). | | __eq__(self, other) | Return self==value. | | __hash__(self) | Return hash(self). | | __init__(self, tasks_waiting: 'int') -> None | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | __setattr__(self, name, value) | Implement setattr(self, name, value). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'tasks_waiting': 'int'} | | __dataclass_fields__ = {'tasks_waiting': Field(name='tasks_waiting',ty... | | __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or... | | __match_args__ = ('tasks_waiting',) class SpooledTemporaryFile(AsyncFile) | SpooledTemporaryFile(max_size: 'int' = 0, mode: 'OpenBinaryMode | OpenTextMode' = 'w+b', buffering: 'int' = -1, encoding: 'str | None' = None, newline: 'str | None' = None, suffix: 'str | None' = None, prefix: 'str | None' = None, dir: 'str | None' = None, *, errors: 'str | None' = None) -> 'None' | | An asynchronous spooled temporary file that starts in memory and is spooled to disk. | | This class provides an asynchronous interface to a spooled temporary file, much like | Python's standard :class:`~tempfile.SpooledTemporaryFile`. It supports asynchronous | write operations and provides a method to force a rollover to disk. | | :param max_size: Maximum size in bytes before the file is rolled over to disk. | :param mode: The mode in which the file is opened. Defaults to "w+b". | :param buffering: The buffering policy (-1 means the default buffering). | :param encoding: The encoding used to decode or encode the file (text mode only). | :param newline: Controls how universal newlines mode works (text mode only). | :param suffix: The suffix for the temporary file name. | :param prefix: The prefix for the temporary file name. | :param dir: The directory in which the temporary file is created. | :param errors: The error handling scheme used for encoding/decoding errors. | | Method resolution order: | SpooledTemporaryFile | AsyncFile | anyio.abc.AsyncResource | typing.Generic | builtins.object | | Methods defined here: | | __init__(self, max_size: 'int' = 0, mode: 'OpenBinaryMode | OpenTextMode' = 'w+b', buffering: 'int' = -1, encoding: 'str | None' = None, newline: 'str | None' = None, suffix: 'str | None' = None, prefix: 'str | None' = None, dir: 'str | None' = None, *, errors: 'str | None' = None) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | async aclose(self) -> 'None' | Close the resource. | | async read(self, size: 'int' = -1) -> 'AnyStr' | | async read1(self: 'SpooledTemporaryFile[bytes]', size: 'int' = -1) -> 'bytes' | | async readinto(self: 'SpooledTemporaryFile[bytes]', b: 'WriteableBuffer') -> 'int' | | async readinto1(self: 'SpooledTemporaryFile[bytes]', b: 'WriteableBuffer') -> 'int' | | async readline(self) -> 'AnyStr' | | async readlines(self) -> 'list[AnyStr]' | | async rollover(self) -> 'None' | | async seek(self, offset: 'int', whence: 'int | None' = 0) -> 'int' | | async tell(self) -> 'int' | | async truncate(self, size: 'int | None' = None) -> 'int' | | async write(self, b: 'ReadableBuffer | str') -> 'int' | Asynchronously write data to the spooled temporary file. | | If the file has not yet been rolled over, the data is written synchronously, | and a rollover is triggered if the size exceeds the maximum size. | | :param s: The data to write. | :return: The number of bytes written. | :raises RuntimeError: If the underlying file is not initialized. | | async writelines(self, lines: 'Iterable[str] | Iterable[ReadableBuffer]') -> 'None' | Asynchronously write a list of lines to the spooled temporary file. | | If the file has not yet been rolled over, the lines are written synchronously, | and a rollover is triggered if the size exceeds the maximum size. | | :param lines: An iterable of lines to write. | :raises RuntimeError: If the underlying file is not initialized. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | closed | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __abstractmethods__ = frozenset() | | __annotations__ = {'_rolled': 'bool'} | | __orig_bases__ = (anyio.AsyncFile[~AnyStr],) | | __parameters__ = (~AnyStr,) | | ---------------------------------------------------------------------- | Methods inherited from AsyncFile: | | async __aiter__(self) -> 'AsyncIterator[AnyStr]' | | __getattr__(self, name: 'str') -> 'object' | | async flush(self) -> 'None' | | ---------------------------------------------------------------------- | Readonly properties inherited from AsyncFile: | | limiter | The capacity limiter used by this file object, if not the global limiter. | | wrapped | The wrapped file object. | | ---------------------------------------------------------------------- | Data descriptors inherited from AsyncFile: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from anyio.abc.AsyncResource: | | async __aenter__(self: 'T') -> 'T' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' | | ---------------------------------------------------------------------- | Class methods inherited from typing.Generic: | | __class_getitem__(params) from abc.ABCMeta | | __init_subclass__(*args, **kwargs) from abc.ABCMeta | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. class TCPConnectable(anyio.abc.ByteStreamConnectable) | TCPConnectable(host: 'str | IPv4Address | IPv6Address', port: 'int') -> None | | Connects to a TCP server at the given host and port. | | :param host: host name or IP address of the server | :param port: TCP port number of the server | | Method resolution order: | TCPConnectable | anyio.abc.ByteStreamConnectable | builtins.object | | Methods defined here: | | __eq__(self, other) | Return self==value. | | __init__(self, host: 'str | IPv4Address | IPv6Address', port: 'int') -> None | Initialize self. See help(type(self)) for accurate signature. | | __post_init__(self) -> 'None' | | __repr__(self) | Return repr(self). | | async connect(self) -> 'SocketStream' | Connect to the remote endpoint. | | :return: a bytestream connected to the remote end | :raises ConnectionFailed: if the connection fails | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __abstractmethods__ = frozenset() | | __annotations__ = {'host': 'str | IPv4Address | IPv6Address', 'port': ... | | __dataclass_fields__ = {'host': Field(name='host',type='str | IPv4Addr... | | __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or... | | __hash__ = None | | __match_args__ = ('host', 'port') | | ---------------------------------------------------------------------- | Data descriptors inherited from anyio.abc.ByteStreamConnectable: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) class TaskCancelled(TaskFailed) | Raised when awaiting on, or attempting to access the return value of, a | :class:`.TaskHandle` that was cancelled. | | Method resolution order: | TaskCancelled | TaskFailed | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors inherited from TaskFailed: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class TaskFailed(builtins.Exception) | Raised when awaiting on, or attempting to access the return value of, a | :class:`.TaskHandle` that raised an exception. | | Method resolution order: | TaskFailed | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class TaskHandle(typing.Generic) | TaskHandle(coro: 'Coroutine[Any, Any, T_co]', name: 'object') -> 'None' | | Returned from the task-spawning methods of :class:`TaskGroup`. Can be awaited on to | get the return value of the task (or the raised exception). If the task was | terminated by a :exc:`BaseException`, :exc:`TaskFailed` will be raised (or its | subclass :exc:`TaskCancelled` if the task was cancelled). | | .. versionadded:: 4.14.0 | | Method resolution order: | TaskHandle | typing.Generic | builtins.object | | Methods defined here: | | __await__(self) -> 'Generator[Any, Any, T_co]' | | __init__(self, coro: 'Coroutine[Any, Any, T_co]', name: 'object') -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) -> 'str' | Return repr(self). | | cancel(self) -> 'None' | Set the task to a cancelled state. | | This will interrupt any interruptible asynchronous operation, and will cause | any further awaits on this task to get immediately cancelled, unless done in | a shielded cancel scope. | | If the task has already finished, this method has no effect. | | async wait(self) -> 'None' | Wait for the task to finish. | | This method will return as soon as the task has finished, no matter how it | happened. | | ---------------------------------------------------------------------- | Readonly properties defined here: | | coro | The coroutine object that was passed to one of the task-spawning methods in | :class:`TaskGroup`. | | exception | The exception raised by the task, or ``None`` if it finished without raising. | | :raises TaskNotFinished: if the task has not finished yet | :raises TaskCancelled: if the task was cancelled | | name | The name of the task. | | return_value | The return value of the task. | | :raises TaskNotFinished: if the task has not finished yet | :raises TaskCancelled: if the task was cancelled | :raises TaskFailed: if the task raised an exception | | start_value | The value passed to :meth:`task_status.started() <.abc.TaskStatus.started>`, | | :raises RuntimeError: if the task was not started with :meth:`TaskGroup.start() | <.abc.TaskGroup.start>` | | status | The current status of the task. | | Every task starts in the :attr:`~TaskHandle.Status.PENDING` state. | If a task is cancelled while in this state, it will transition to the | :attr:`~TaskHandle.Status.CANCELLING` state. When the task finishes, it will | transition to one of the three final states ( | :attr:`~TaskHandle.Status.FINISHED`, :attr:`~TaskHandle.Status.FAILED`, or | :attr:`~TaskHandle.Status.CANCELLING`) depending on the exception the task | raised, if any. No other status transitions will happen. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | Status = <enum 'Status'> | The status of a task handle. | | .. attribute:: PENDING | | The task has not finished yet. | .. attribute:: FINISHED | | The task has finished with a return value. | .. attribute:: CANCELLING | | The task has been cancelled but has not finished yet. | .. attribute:: CANCELLED | | The task was cancelled and has finished since. | .. attribute:: FAILED | | The task raised an exception. | | | __annotations__ = {'_return_value': 'T_co', '_start_value': 'T_startva... | | __orig_bases__ = (typing.Generic[+T_co, +T_startval],) | | __parameters__ = (+T_co, +T_startval) | | ---------------------------------------------------------------------- | Class methods inherited from typing.Generic: | | __class_getitem__(params) from builtins.type | | __init_subclass__(*args, **kwargs) from builtins.type | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. class TaskInfo(builtins.object) | TaskInfo(id: 'int', parent_id: 'int | None', name: 'str | None', coro: 'Generator[Any, Any, Any] | Awaitable[Any]') | | Represents an asynchronous task. | | :ivar int id: the unique identifier of the task | :ivar parent_id: the identifier of the parent task, if any | :vartype parent_id: Optional[int] | :ivar str name: the description of the task (if any) | :ivar ~collections.abc.Coroutine coro: the coroutine object of the task | | Methods defined here: | | __eq__(self, other: 'object') -> 'bool' | Return self==value. | | __hash__(self) -> 'int' | Return hash(self). | | __init__(self, id: 'int', parent_id: 'int | None', name: 'str | None', coro: 'Generator[Any, Any, Any] | Awaitable[Any]') | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) -> 'str' | Return repr(self). | | has_pending_cancellation(self) -> 'bool' | Return ``True`` if the task has a cancellation pending, ``False`` otherwise. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | coro | | id | | name | | parent_id class TaskNotFinished(builtins.Exception) | Raised when attempting to access the return value or exception of a | :class:`.TaskHandle` that is still pending completion. | | Method resolution order: | TaskNotFinished | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class TemporaryDirectory(typing.Generic) | TemporaryDirectory(suffix: 'AnyStr | None' = None, prefix: 'AnyStr | None' = None, dir: 'AnyStr | None' = None, *, ignore_cleanup_errors: 'bool' = False, delete: 'bool' = True) -> 'None' | | An asynchronous temporary directory that is created and cleaned up automatically. | | This class provides an asynchronous context manager for creating a temporary | directory. It wraps Python's standard :class:`~tempfile.TemporaryDirectory` to | perform directory creation and cleanup operations in a background thread. | | :param suffix: Suffix to be added to the temporary directory name. | :param prefix: Prefix to be added to the temporary directory name. | :param dir: The parent directory where the temporary directory is created. | :param ignore_cleanup_errors: Whether to ignore errors during cleanup | :param delete: Whether to delete the directory upon closing (Python 3.12+). | | Method resolution order: | TemporaryDirectory | typing.Generic | builtins.object | | Methods defined here: | | async __aenter__(self) -> 'str' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_value: 'BaseException | None', traceback: 'TracebackType | None') -> 'None' | | __init__(self, suffix: 'AnyStr | None' = None, prefix: 'AnyStr | None' = None, dir: 'AnyStr | None' = None, *, ignore_cleanup_errors: 'bool' = False, delete: 'bool' = True) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | async cleanup(self) -> 'None' | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {} | | __orig_bases__ = (typing.Generic[~AnyStr],) | | __parameters__ = (~AnyStr,) | | ---------------------------------------------------------------------- | Class methods inherited from typing.Generic: | | __class_getitem__(params) from builtins.type | | __init_subclass__(*args, **kwargs) from builtins.type | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. class TemporaryFile(typing.Generic) | TemporaryFile(mode: 'OpenTextMode | OpenBinaryMode' = 'w+b', buffering: 'int' = -1, encoding: 'str | None' = None, newline: 'str | None' = None, suffix: 'str | None' = None, prefix: 'str | None' = None, dir: 'str | None' = None, *, errors: 'str | None' = None) -> 'None' | | An asynchronous temporary file that is automatically created and cleaned up. | | This class provides an asynchronous context manager interface to a temporary file. | The file is created using Python's standard `tempfile.TemporaryFile` function in a | background thread, and is wrapped as an asynchronous file using `AsyncFile`. | | :param mode: The mode in which the file is opened. Defaults to "w+b". | :param buffering: The buffering policy (-1 means the default buffering). | :param encoding: The encoding used to decode or encode the file. Only applicable in | text mode. | :param newline: Controls how universal newlines mode works (only applicable in text | mode). | :param suffix: The suffix for the temporary file name. | :param prefix: The prefix for the temporary file name. | :param dir: The directory in which the temporary file is created. | :param errors: The error handling scheme used for encoding/decoding errors. | | Method resolution order: | TemporaryFile | typing.Generic | builtins.object | | Methods defined here: | | async __aenter__(self) -> 'AsyncFile[AnyStr]' | | async __aexit__(self, exc_type: 'type[BaseException] | None', exc_value: 'BaseException | None', traceback: 'TracebackType | None') -> 'None' | | __init__(self, mode: 'OpenTextMode | OpenBinaryMode' = 'w+b', buffering: 'int' = -1, encoding: 'str | None' = None, newline: 'str | None' = None, suffix: 'str | None' = None, prefix: 'str | None' = None, dir: 'str | None' = None, *, errors: 'str | None' = None) -> 'None' | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __annotations__ = {'_async_file': 'AsyncFile[AnyStr]'} | | __orig_bases__ = (typing.Generic[~AnyStr],) | | __parameters__ = (~AnyStr,) | | ---------------------------------------------------------------------- | Class methods inherited from typing.Generic: | | __class_getitem__(params) from builtins.type | | __init_subclass__(*args, **kwargs) from builtins.type | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. class TypedAttributeLookupError(builtins.LookupError) | Raised by :meth:`~anyio.TypedAttributeProvider.extra` when the given typed attribute | is not found and no default value has been given. | | Method resolution order: | TypedAttributeLookupError | builtins.LookupError | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.LookupError: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.LookupError: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class TypedAttributeProvider(builtins.object) | Base class for classes that wish to provide typed extra attributes. | | Methods defined here: | | extra(self, attribute: 'Any', default: 'object' = <object object at 0x7fa26d5fcc70>) -> 'object' | extra(attribute, default=undefined) | | Return the value of the given typed extra attribute. | | :param attribute: the attribute (member of a :class:`~TypedAttributeSet`) to | look for | :param default: the value that should be returned if no value is found for the | attribute | :raises ~anyio.TypedAttributeLookupError: if the search failed and no default | value was given | | ---------------------------------------------------------------------- | Readonly properties defined here: | | extra_attributes | A mapping of the extra attributes to callables that return the corresponding | values. | | If the provider wraps another provider, the attributes from that wrapper should | also be included in the returned mapping (but the wrapper may override the | callables from the wrapped instance). | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) class TypedAttributeSet(builtins.object) | Superclass for typed attribute collections. | | Checks that every public attribute of every subclass has a type annotation. | | Class methods defined here: | | __init_subclass__() -> 'None' from builtins.type | This method is called when a class is subclassed. | | The default implementation does nothing. It may be | overridden to extend subclasses. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) class UNIXConnectable(anyio.abc.ByteStreamConnectable) | UNIXConnectable(path: 'str | bytes | PathLike[str] | PathLike[bytes]') -> None | | Connects to a UNIX domain socket at the given path. | | :param path: the file system path of the socket | | Method resolution order: | UNIXConnectable | anyio.abc.ByteStreamConnectable | builtins.object | | Methods defined here: | | __eq__(self, other) | Return self==value. | | __init__(self, path: 'str | bytes | PathLike[str] | PathLike[bytes]') -> None | Initialize self. See help(type(self)) for accurate signature. | | __repr__(self) | Return repr(self). | | async connect(self) -> 'UNIXSocketStream' | Connect to the remote endpoint. | | :return: a bytestream connected to the remote end | :raises ConnectionFailed: if the connection fails | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __abstractmethods__ = frozenset() | | __annotations__ = {'path': 'str | bytes | PathLike[str] | PathLike[byt... | | __dataclass_fields__ = {'path': Field(name='path',type='str | bytes | ... | | __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or... | | __hash__ = None | | __match_args__ = ('path',) | | ---------------------------------------------------------------------- | Data descriptors inherited from anyio.abc.ByteStreamConnectable: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) class WouldBlock(builtins.Exception) | Raised by ``X_nowait`` functions if ``X()`` would block. | | Method resolution order: | WouldBlock | builtins.Exception | builtins.BaseException | builtins.object | | Data descriptors defined here: | | __weakref__ | list of weak references to the object (if defined) | | ---------------------------------------------------------------------- | Methods inherited from builtins.Exception: | | __init__(self, /, *args, **kwargs) | Initialize self. See help(type(self)) for accurate signature. | | ---------------------------------------------------------------------- | Static methods inherited from builtins.Exception: | | __new__(*args, **kwargs) from builtins.type | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Methods inherited from builtins.BaseException: | | __delattr__(self, name, /) | Implement delattr(self, name). | | __getattribute__(self, name, /) | Return getattr(self, name). | | __reduce__(...) | Helper for pickle. | | __repr__(self, /) | Return repr(self). | | __setattr__(self, name, value, /) | Implement setattr(self, name, value). | | __setstate__(...) | | __str__(self, /) | Return str(self). | | with_traceback(...) | Exception.with_traceback(tb) -- | set self.__traceback__ to tb and return self. | | ---------------------------------------------------------------------- | Data descriptors inherited from builtins.BaseException: | | __cause__ | exception cause | | __context__ | exception context | | __dict__ | | __suppress_context__ | | __traceback__ | | args class create_memory_object_stream(builtins.tuple) | create_memory_object_stream(max_buffer_size: 'float' = 0, item_type: 'object' = None) -> 'tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]]' | | Create a memory object stream. | | The stream's item type can be annotated like | :func:`create_memory_object_stream[T_Item]`. | | :param max_buffer_size: number of items held in the buffer until ``send()`` starts | blocking | :param item_type: old way of marking the streams with the right generic type for | static typing (does nothing on AnyIO 4) | | .. deprecated:: 4.0 | Use ``create_memory_object_stream[YourItemType](...)`` instead. | :return: a tuple of (send stream, receive stream) | | Method resolution order: | create_memory_object_stream | builtins.tuple | builtins.object | | Static methods defined here: | | __new__(cls, max_buffer_size: 'float' = 0, item_type: 'object' = None) -> 'tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]]' | Create and return a new object. See help(type) for accurate signature. | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | ---------------------------------------------------------------------- | Data and other attributes defined here: | | __orig_bases__ = (tuple[anyio.streams.memory.MemoryObjectSendStrea...t... | | ---------------------------------------------------------------------- | Methods inherited from builtins.tuple: | | __add__(self, value, /) | Return self+value. | | __contains__(self, key, /) | Return key in self. | | __eq__(self, value, /) | Return self==value. | | __ge__(self, value, /) | Return self>=value. | | __getattribute__(self, name, /) | Return getattr(self, name). | | __getitem__(self, key, /) | Return self[key]. | | __getnewargs__(self, /) | | __gt__(self, value, /) | Return self>value. | | __hash__(self, /) | Return hash(self). | | __iter__(self, /) | Implement iter(self). | | __le__(self, value, /) | Return self<=value. | | __len__(self, /) | Return len(self). | | __lt__(self, value, /) | Return self<value. | | __mul__(self, value, /) | Return self*value. | | __ne__(self, value, /) | Return self!=value. | | __repr__(self, /) | Return repr(self). | | __rmul__(self, value, /) | Return value*self. | | count(self, value, /) | Return number of occurrences of value. | | index(self, value, start=0, stop=9223372036854775807, /) | Return first index of value. | | Raises ValueError if the value is not present. | | ---------------------------------------------------------------------- | Class methods inherited from builtins.tuple: | | __class_getitem__(...) from builtins.type | See PEP 585 FUNCTIONS __getattr__(attr: 'str') -> 'type[BrokenWorkerInterpreter]' Support deprecated aliases. async aclose_forcefully(resource: 'AsyncResource') -> 'None' Close an asynchronous resource in a cancelled scope. Doing this closes the resource without waiting on anything. :param resource: the resource to close as_connectable(remote: 'ByteStreamConnectable | tuple[str | IPv4Address | IPv6Address, int] | str | bytes | PathLike[str]', /, *, tls: 'bool' = False, ssl_context: 'ssl.SSLContext | None' = None, tls_hostname: 'str | None' = None, tls_standard_compatible: 'bool' = True) -> 'ByteStreamConnectable' Return a byte stream connectable from the given object. If a bytestream connectable is given, it is returned unchanged. If a tuple of (host, port) is given, a TCP connectable is returned. If a string or bytes path is given, a UNIX connectable is returned. If ``tls=True``, the connectable will be wrapped in a :class:`~.streams.tls.TLSConnectable`. :param remote: a connectable, a tuple of (host, port) or a path to a UNIX socket :param tls: if ``True``, wrap the plaintext connectable in a :class:`~.streams.tls.TLSConnectable`, using the provided TLS settings) :param ssl_context: if ``tls=True``, the SSLContext object to use (if not provided, a secure default will be created) :param tls_hostname: if ``tls=True``, host name of the server to use for checking the server certificate (defaults to the host portion of the address for TCP connectables) :param tls_standard_compatible: if ``False`` and ``tls=True``, makes the TLS stream skip the closing handshake when closing the connection, so it won't raise an exception if the server does the same async connect_tcp(remote_host: 'IPAddressType', remote_port: 'int', *, local_host: 'IPAddressType | None' = None, local_port: 'int | None' = None, tls: 'bool' = False, ssl_context: 'ssl.SSLContext | None' = None, tls_standard_compatible: 'bool' = True, tls_hostname: 'str | None' = None, happy_eyeballs_delay: 'float' = 0.25) -> 'SocketStream | TLSStream' Connect to a host using the TCP protocol. This function implements the stateless version of the Happy Eyeballs algorithm (RFC 6555). If ``remote_host`` is a host name that resolves to multiple IP addresses, each one is tried until one connection attempt succeeds. If the first attempt does not connected within 250 milliseconds, a second attempt is started using the next address in the list, and so on. On IPv6 enabled systems, an IPv6 address (if available) is tried first. When the connection has been established, a TLS handshake will be done if either ``ssl_context`` or ``tls_hostname`` is not ``None``, or if ``tls`` is ``True``. :param remote_host: the IP address or host name to connect to :param remote_port: port on the target host to connect to :param local_host: the interface address or name to bind the socket to before connecting :param local_port: the local port to bind to (requires ``local_host`` to also be set) :param tls: ``True`` to do a TLS handshake with the connected stream and return a :class:`~anyio.streams.tls.TLSStream` instead :param ssl_context: the SSL context object to use (if omitted, a default context is created) :param tls_standard_compatible: If ``True``, performs the TLS shutdown handshake before closing the stream and requires that the server does this as well. Otherwise, :exc:`~ssl.SSLEOFError` may be raised during reads from the stream. Some protocols, such as HTTP, require this option to be ``False``. See :meth:`~ssl.SSLContext.wrap_socket` for details. :param tls_hostname: host name to check the server certificate against (defaults to the value of ``remote_host``) :param happy_eyeballs_delay: delay (in seconds) before starting the next connection attempt :return: a socket stream object if no TLS handshake was done, otherwise a TLS stream :raises ConnectionFailed: if the connection fails async connect_unix(path: 'str | bytes | PathLike[Any]') -> 'UNIXSocketStream' Connect to the given UNIX socket. Not available on Windows. :param path: path to the socket :return: a socket stream object :raises ConnectionFailed: if the connection fails async create_connected_udp_socket(remote_host: 'IPAddressType', remote_port: 'int', *, family: 'AnyIPAddressFamily' = <AddressFamily.AF_UNSPEC: 0>, local_host: 'IPAddressType | None' = None, local_port: 'int' = 0, reuse_port: 'bool' = False) -> 'ConnectedUDPSocket' Create a connected UDP socket. Connected UDP sockets can only communicate with the specified remote host/port, an any packets sent from other sources are dropped. :param remote_host: remote host to set as the default target :param remote_port: port on the remote host to set as the default target :param family: address family (``AF_INET`` or ``AF_INET6``) – automatically determined from ``local_host`` or ``remote_host`` if omitted :param local_host: IP address or host name of the local interface to bind to :param local_port: local port to bind to :param reuse_port: ``True`` to allow multiple sockets to bind to the same address/port (not supported on Windows) :return: a connected UDP socket async create_connected_unix_datagram_socket(remote_path: 'str | bytes | PathLike[Any]', *, local_path: 'None | str | bytes | PathLike[Any]' = None, local_mode: 'int | None' = None) -> 'ConnectedUNIXDatagramSocket' Create a connected UNIX datagram socket. Connected datagram sockets can only communicate with the specified remote path. If ``local_path`` has been given, the socket will be bound to this path, making this socket suitable for receiving datagrams from other processes. Other processes can send datagrams to this socket only if ``local_path`` is set. If a socket already exists on the file system in the ``local_path``, it will be removed first. :param remote_path: the path to set as the default target :param local_path: the path on which to bind to :param local_mode: permissions to set on the local socket :return: a connected UNIX datagram socket create_task_group() -> 'TaskGroup' Create a task group. :return: a task group :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread async create_tcp_listener(*, local_host: 'IPAddressType | None' = None, local_port: 'int' = 0, family: 'AnyIPAddressFamily' = <AddressFamily.AF_UNSPEC: 0>, backlog: 'int' = 65536, reuse_port: 'bool' = False) -> 'MultiListener[SocketStream]' Create a TCP socket listener. :param local_port: port number to listen on :param local_host: IP address of the interface to listen on. If omitted, listen on all IPv4 and IPv6 interfaces. To listen on all interfaces on a specific address family, use ``0.0.0.0`` for IPv4 or ``::`` for IPv6. :param family: address family (used if ``local_host`` was omitted) :param backlog: maximum number of queued incoming connections (up to a maximum of 2**16, or 65536) :param reuse_port: ``True`` to allow multiple sockets to bind to the same address/port (not supported on Windows) :return: a multi-listener object containing one or more socket listeners :raises OSError: if there's an error creating a socket, or binding to one or more interfaces failed async create_udp_socket(family: 'AnyIPAddressFamily' = <AddressFamily.AF_UNSPEC: 0>, *, local_host: 'IPAddressType | None' = None, local_port: 'int' = 0, reuse_port: 'bool' = False) -> 'UDPSocket' Create a UDP socket. If ``port`` has been given, the socket will be bound to this port on the local machine, making this socket suitable for providing UDP based services. :param family: address family (``AF_INET`` or ``AF_INET6``) – automatically determined from ``local_host`` if omitted :param local_host: IP address or host name of the local interface to bind to :param local_port: local port to bind to :param reuse_port: ``True`` to allow multiple sockets to bind to the same address/port (not supported on Windows) :return: a UDP socket async create_unix_datagram_socket(*, local_path: 'None | str | bytes | PathLike[Any]' = None, local_mode: 'int | None' = None) -> 'UNIXDatagramSocket' Create a UNIX datagram socket. Not available on Windows. If ``local_path`` has been given, the socket will be bound to this path, making this socket suitable for receiving datagrams from other processes. Other processes can send datagrams to this socket only if ``local_path`` is set. If a socket already exists on the file system in the ``local_path``, it will be removed first. :param local_path: the path on which to bind to :param local_mode: permissions to set on the local socket :return: a UNIX datagram socket async create_unix_listener(path: 'str | bytes | PathLike[Any]', *, mode: 'int | None' = None, backlog: 'int' = 65536) -> 'SocketListener' Create a UNIX socket listener. Not available on Windows. :param path: path of the socket :param mode: permissions to set on the socket :param backlog: maximum number of queued incoming connections (up to a maximum of 2**16, or 65536) :return: a listener object .. versionchanged:: 3.0 If a socket already exists on the file system in the given path, it will be removed first. current_effective_deadline() -> 'float' Return the nearest deadline among all the cancel scopes effective for the current task. :return: a clock value from the event loop's internal clock (or ``float('inf')`` if there is no deadline in effect, or ``float('-inf')`` if the current scope has been cancelled) :rtype: float :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread current_time() -> 'float' Return the current value of the event loop's internal clock. :return: the clock value (seconds) :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread fail_after(delay: 'float | None', shield: 'bool' = False) -> 'Generator[CancelScope, None, None]' Create a context manager which raises a :class:`TimeoutError` if does not finish in time. :param delay: maximum allowed time (in seconds) before raising the exception, or ``None`` to disable the timeout :param shield: ``True`` to shield the cancel scope from external cancellation :return: a context manager that yields a cancel scope :rtype: :class:`~typing.ContextManager`\[:class:`~anyio.CancelScope`\] :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread get_all_backends() -> 'tuple[str, ...]' Return a tuple of the names of all built-in backends. get_available_backends() -> 'tuple[str, ...]' Test for the availability of built-in backends. :return a tuple of the built-in backend names that were successfully imported .. versionadded:: 4.12 get_cancelled_exc_class() -> 'type[BaseException]' Return the current async library's cancellation exception class. :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread get_current_task() -> 'TaskInfo' Return the current task. :return: a representation of the current task :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread get_running_tasks() -> 'list[TaskInfo]' Return a list of running tasks in the current event loop. :return: a list of task info objects :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread async getaddrinfo(host: 'bytes | str | None', port: 'str | int | None', *, family: 'int | AddressFamily' = 0, type: 'int | SocketKind' = 0, proto: 'int' = 0, flags: 'int' = 0) -> 'list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int]]]' Look up a numeric IP address given a host name. Internationalized domain names are translated according to the (non-transitional) IDNA 2008 standard. .. note:: 4-tuple IPv6 socket addresses are automatically converted to 2-tuples of (host, port), unlike what :func:`socket.getaddrinfo` does. :param host: host name :param port: port number :param family: socket family (`'AF_INET``, ...) :param type: socket type (``SOCK_STREAM``, ...) :param proto: protocol number :param flags: flags to pass to upstream ``getaddrinfo()`` :return: list of tuples containing (family, type, proto, canonname, sockaddr) .. seealso:: :func:`socket.getaddrinfo` getnameinfo(sockaddr: 'IPSockAddrType', flags: 'int' = 0) -> 'Awaitable[tuple[str, str]]' Look up the host name of an IP address. :param sockaddr: socket address (e.g. (ipaddress, port) for IPv4) :param flags: flags to pass to upstream ``getnameinfo()`` :return: a tuple of (host name, service name) :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread .. seealso:: :func:`socket.getnameinfo` async gettempdir() -> 'str' Asynchronously return the name of the directory used for temporary files. This function wraps `tempfile.gettempdir` and executes it in a background thread. :return: The path of the temporary directory as a string. async gettempdirb() -> 'bytes' Asynchronously return the name of the directory used for temporary files in bytes. This function wraps `tempfile.gettempdirb` and executes it in a background thread. :return: The path of the temporary directory as bytes. async mkdtemp(suffix: 'AnyStr | None' = None, prefix: 'AnyStr | None' = None, dir: 'AnyStr | None' = None) -> 'str | bytes' Asynchronously create a temporary directory and return its path. This function wraps `tempfile.mkdtemp` and executes it in a background thread. :param suffix: Suffix to be added to the directory name. :param prefix: Prefix to be added to the directory name. :param dir: Parent directory where the temporary directory is created. :return: The path of the created temporary directory. async mkstemp(suffix: 'AnyStr | None' = None, prefix: 'AnyStr | None' = None, dir: 'AnyStr | None' = None, text: 'bool' = False) -> 'tuple[int, str | bytes]' Asynchronously create a temporary file and return an OS-level handle and the file name. This function wraps `tempfile.mkstemp` and executes it in a background thread. :param suffix: Suffix to be added to the file name. :param prefix: Prefix to be added to the file name. :param dir: Directory in which the temporary file is created. :param text: Whether the file is opened in text mode. :return: A tuple containing the file descriptor and the file name. move_on_after(delay: 'float | None', shield: 'bool' = False) -> 'CancelScope' Create a cancel scope with a deadline that expires after the given delay. :param delay: maximum allowed time (in seconds) before exiting the context block, or ``None`` to disable the timeout :param shield: ``True`` to shield the cancel scope from external cancellation :return: a cancel scope :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread notify_closing(obj: 'FileDescriptorLike') -> 'None' Call this before closing a file descriptor (on Unix) or socket (on Windows). This will cause any `wait_readable` or `wait_writable` calls on the given object to immediately wake up and raise `~anyio.ClosedResourceError`. This doesn't actually close the object – you still have to do that yourself afterwards. Also, you want to be careful to make sure no new tasks start waiting on the object in between when you call this and when it's actually closed. So to close something properly, you usually want to do these steps in order: 1. Explicitly mark the object as closed, so that any new attempts to use it will abort before they start. 2. Call `notify_closing` to wake up any already-existing users. 3. Actually close the object. It's also possible to do them in a different order if that's more convenient, *but only if* you make sure not to have any checkpoints in between the steps. This way they all happen in a single atomic step, so other tasks won't be able to tell what order they happened in anyway. :param obj: an object with a ``.fileno()`` method or an integer handle :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread async open_file(file: 'str | PathLike[str] | int', mode: 'str' = 'r', buffering: 'int' = -1, encoding: 'str | None' = None, errors: 'str | None' = None, newline: 'str | None' = None, closefd: 'bool' = True, opener: 'Callable[[str, int], int] | None' = None, *, limiter: 'CapacityLimiter | None' = None) -> 'AsyncFile[Any]' Open a file asynchronously. Except for ``limiter``, the arguments are exactly the same as for the builtin :func:`open`. :param limiter: an optional capacity limiter to use with the file instead of the default one :return: an asynchronous file object .. versionchanged:: 4.14.0 Added the ``limiter`` keyword argument. async open_process(command: 'StrOrBytesPath | Sequence[StrOrBytesPath]', *, stdin: 'int | IO[Any] | None' = -1, stdout: 'int | IO[Any] | None' = -1, stderr: 'int | IO[Any] | None' = -1, cwd: 'StrOrBytesPath | None' = None, env: 'Mapping[str, str] | None' = None, startupinfo: 'Any' = None, creationflags: 'int' = 0, start_new_session: 'bool' = False, pass_fds: 'Sequence[int]' = (), user: 'str | int | None' = None, group: 'str | int | None' = None, extra_groups: 'Iterable[str | int] | None' = None, umask: 'int' = -1) -> 'Process' Start an external command in a subprocess. .. seealso:: :class:`subprocess.Popen` :param command: either a string to pass to the shell, or an iterable of strings containing the executable name or path and its arguments :param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, a file-like object, or ``None`` :param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, a file-like object, or ``None`` :param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, :data:`subprocess.STDOUT`, a file-like object, or ``None`` :param cwd: If not ``None``, the working directory is changed before executing :param env: If env is not ``None``, it must be a mapping that defines the environment variables for the new process :param creationflags: flags that can be used to control the creation of the subprocess (see :class:`subprocess.Popen` for the specifics) :param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used to specify process startup parameters (Windows only) :param start_new_session: if ``true`` the setsid() system call will be made in the child process prior to the execution of the subprocess. (POSIX only) :param pass_fds: sequence of file descriptors to keep open between the parent and child processes. (POSIX only) :param user: effective user to run the process as (POSIX only) :param group: effective group to run the process as (POSIX only) :param extra_groups: supplementary groups to set in the subprocess (POSIX only) :param umask: if not negative, this umask is applied in the child process before running the given command (POSIX only) :return: an asynchronous process object open_signal_receiver(*signals: 'Signals') -> 'AbstractContextManager[AsyncIterator[Signals]]' Start receiving operating system signals. :param signals: signals to receive (e.g. ``signal.SIGINT``) :return: an asynchronous context manager for an asynchronous iterator which yields signal numbers :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread .. warning:: Windows does not support signals natively so it is best to avoid relying on this in cross-platform applications. .. warning:: On asyncio, this permanently replaces any previous signal handler for the given signals, as set via :meth:`~asyncio.loop.add_signal_handler`. run(func: 'Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]', *args: 'Unpack[PosArgsT]', backend: 'str' = 'asyncio', backend_options: 'dict[str, Any] | None' = None) -> 'T_Retval' Run the given coroutine function in an asynchronous event loop. The current thread must not be already running an event loop. :param func: a coroutine function :param args: positional arguments to ``func`` :param backend: name of the asynchronous event loop implementation – currently either ``asyncio`` or ``trio`` :param backend_options: keyword arguments to call the backend ``run()`` implementation with (documented :ref:`here <backend options>`) :return: the return value of the coroutine function :raises RuntimeError: if an asynchronous event loop is already running in this thread :raises LookupError: if the named backend is not found async run_process(command: 'StrOrBytesPath | Sequence[StrOrBytesPath]', *, input: 'bytes | None' = None, stdin: 'int | IO[Any] | None' = None, stdout: 'int | IO[Any] | None' = -1, stderr: 'int | IO[Any] | None' = -1, check: 'bool' = True, cwd: 'StrOrBytesPath | None' = None, env: 'Mapping[str, str] | None' = None, startupinfo: 'Any' = None, creationflags: 'int' = 0, start_new_session: 'bool' = False, pass_fds: 'Sequence[int]' = (), user: 'str | int | None' = None, group: 'str | int | None' = None, extra_groups: 'Iterable[str | int] | None' = None, umask: 'int' = -1) -> 'CompletedProcess[bytes]' Run an external command in a subprocess and wait until it completes. .. seealso:: :func:`subprocess.run` :param command: either a string to pass to the shell, or an iterable of strings containing the executable name or path and its arguments :param input: bytes passed to the standard input of the subprocess :param stdin: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, a file-like object, or `None`; ``input`` overrides this :param stdout: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, a file-like object, or `None` :param stderr: one of :data:`subprocess.PIPE`, :data:`subprocess.DEVNULL`, :data:`subprocess.STDOUT`, a file-like object, or `None` :param check: if ``True``, raise :exc:`~subprocess.CalledProcessError` if the process terminates with a return code other than 0 :param cwd: If not ``None``, change the working directory to this before running the command :param env: if not ``None``, this mapping replaces the inherited environment variables from the parent process :param startupinfo: an instance of :class:`subprocess.STARTUPINFO` that can be used to specify process startup parameters (Windows only) :param creationflags: flags that can be used to control the creation of the subprocess (see :class:`subprocess.Popen` for the specifics) :param start_new_session: if ``true`` the setsid() system call will be made in the child process prior to the execution of the subprocess. (POSIX only) :param pass_fds: sequence of file descriptors to keep open between the parent and child processes. (POSIX only) :param user: effective user to run the process as (Python >= 3.9, POSIX only) :param group: effective group to run the process as (Python >= 3.9, POSIX only) :param extra_groups: supplementary groups to set in the subprocess (Python >= 3.9, POSIX only) :param umask: if not negative, this umask is applied in the child process before running the given command (Python >= 3.9, POSIX only) :return: an object representing the completed process :raises ~subprocess.CalledProcessError: if ``check`` is ``True`` and the process exits with a nonzero return code async sleep(delay: 'float') -> 'None' Pause the current task for the specified duration. :param delay: the duration, in seconds async sleep_forever() -> 'None' Pause the current task until it's cancelled. This is a shortcut for ``sleep(math.inf)``. .. versionadded:: 3.1 async sleep_until(deadline: 'float') -> 'None' Pause the current task until the given time. :param deadline: the absolute time to wake up at (according to the internal monotonic clock of the event loop) .. versionadded:: 3.1 typed_attribute() -> 'Any' Return a unique object, used to mark typed attributes. async wait_all_tasks_blocked() -> 'None' Wait until all other tasks are waiting for something. wait_readable(obj: 'FileDescriptorLike') -> 'Awaitable[None]' Wait until the given object has data to be read. On Unix systems, ``obj`` must either be an integer file descriptor, or else an object with a ``.fileno()`` method which returns an integer file descriptor. Any kind of file descriptor can be passed, though the exact semantics will depend on your kernel. For example, this probably won't do anything useful for on-disk files. On Windows systems, ``obj`` must either be an integer ``SOCKET`` handle, or else an object with a ``.fileno()`` method which returns an integer ``SOCKET`` handle. File descriptors aren't supported, and neither are handles that refer to anything besides a ``SOCKET``. On backends where this functionality is not natively provided (asyncio ``ProactorEventLoop`` on Windows), it is provided using a separate selector thread which is set to shut down when the interpreter shuts down. .. warning:: Don't use this on raw sockets that have been wrapped by any higher level constructs like socket streams! :param obj: an object with a ``.fileno()`` method or an integer handle :raises ~anyio.ClosedResourceError: if the object was closed while waiting for the object to become readable :raises ~anyio.BusyResourceError: if another task is already waiting for the object to become readable :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread wait_socket_readable(sock: 'socket.socket') -> 'Awaitable[None]' .. deprecated:: 4.7.0 Use :func:`wait_readable` instead. Wait until the given socket has data to be read. .. warning:: Only use this on raw sockets that have not been wrapped by any higher level constructs like socket streams! :param sock: a socket object :raises ~anyio.ClosedResourceError: if the socket was closed while waiting for the socket to become readable :raises ~anyio.BusyResourceError: if another task is already waiting for the socket to become readable :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread wait_socket_writable(sock: 'socket.socket') -> 'Awaitable[None]' .. deprecated:: 4.7.0 Use :func:`wait_writable` instead. Wait until the given socket can be written to. This does **NOT** work on Windows when using the asyncio backend with a proactor event loop (default on py3.8+). .. warning:: Only use this on raw sockets that have not been wrapped by any higher level constructs like socket streams! :param sock: a socket object :raises ~anyio.ClosedResourceError: if the socket was closed while waiting for the socket to become writable :raises ~anyio.BusyResourceError: if another task is already waiting for the socket to become writable :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread wait_writable(obj: 'FileDescriptorLike') -> 'Awaitable[None]' Wait until the given object can be written to. :param obj: an object with a ``.fileno()`` method or an integer handle :raises ~anyio.ClosedResourceError: if the object was closed while waiting for the object to become writable :raises ~anyio.BusyResourceError: if another task is already waiting for the object to become writable :raises NoEventLoopError: if no supported asynchronous event loop is running in the current thread .. seealso:: See the documentation of :func:`wait_readable` for the definition of ``obj`` and notes on backend compatibility. .. warning:: Don't use this on raw sockets that have been wrapped by any higher level constructs like socket streams! wrap_file(file: 'IO[AnyStr]', *, limiter: 'CapacityLimiter | None' = None) -> 'AsyncFile[AnyStr]' Wrap an existing file as an asynchronous file. :param file: an existing file-like object :param limiter: an optional capacity limiter to use with the file instead of the default one :return: an asynchronous file object .. versionchanged:: 4.14.0 Added the ``limiter`` keyword argument. DATA TASK_STATUS_IGNORED = <anyio._core._tasks._IgnoredTaskStatus object> annotations = _Feature((3, 7, 0, 'beta', 1), (3, 11, 0, 'alpha', 0), 1... FILE /home/chedong/.local/lib/python3.10/site-packages/anyio/__init__.py
Generated by phpman v4.9.29 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-20 19:16 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)