anyio API Reference

Asynchronous compatibility layer that works on top of both asyncio and trio.

anyio.Any
Python Library Documentation: class Any in module typing

class Any(builtins.object)
 |  Any(*args, **kwargs)
 |
 |  Special type indicating an unconstrained type.
 |
 |  - Any is compatible with every type.
 |  - Any assumed to have all methods.
 |  - All values assumed to be instances of Any.
 |
 |  Note that all the above statements are true from the point of view of
 |  static type checkers. At runtime, Any should not be used with instance
 |  checks.
 |
 |  Static methods defined here:
 |
 |  __new__(cls, *args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.AsyncFile
Python Library Documentation: class AsyncFile in module anyio

class AsyncFile(anyio.abc.AsyncResource, typing.Generic)
 |  AsyncFile(fp: 'IO[AnyStr]') -> '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]' from anyio._core._fileio.AsyncFile
 |
 |  __getattr__(self, name: 'str') -> 'object' from anyio._core._fileio.AsyncFile
 |
 |  __init__(self, fp: 'IO[AnyStr]') -> 'None' from anyio._core._fileio.AsyncFile
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  async aclose(self) -> 'None' from anyio._core._fileio.AsyncFile
 |      Close the resource.
 |
 |  async flush(self) -> 'None' from anyio._core._fileio.AsyncFile
 |
 |  async read(self, size: 'int' = -1) -> 'AnyStr' from anyio._core._fileio.AsyncFile
 |
 |  async read1(self: 'AsyncFile[bytes]', size: 'int' = -1) -> 'bytes' from anyio._core._fileio.AsyncFile
 |
 |  async readinto(self: 'AsyncFile[bytes]', b: 'WriteableBuffer') -> 'bytes' from anyio._core._fileio.AsyncFile
 |
 |  async readinto1(self: 'AsyncFile[bytes]', b: 'WriteableBuffer') -> 'bytes' from anyio._core._fileio.AsyncFile
 |
 |  async readline(self) -> 'AnyStr' from anyio._core._fileio.AsyncFile
 |
 |  async readlines(self) -> 'list[AnyStr]' from anyio._core._fileio.AsyncFile
 |
 |  async seek(self, offset: 'int', whence: 'int | None' = 0) -> 'int' from anyio._core._fileio.AsyncFile
 |
 |  async tell(self) -> 'int' from anyio._core._fileio.AsyncFile
 |
 |  async truncate(self, size: 'int | None' = None) -> 'int' from anyio._core._fileio.AsyncFile
 |
 |  async write(self, b: 'ReadableBuffer | str') -> 'int' from anyio._core._fileio.AsyncFile
 |
 |  async writelines(self, lines: 'Iterable[ReadableBuffer] | Iterable[str]') -> 'None' from anyio._core._fileio.AsyncFile
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  wrapped
 |      The wrapped file object.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  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' from anyio.abc._resources.AsyncResource
 |
 |  async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' from anyio.abc._resources.AsyncResource
 |
 |  ----------------------------------------------------------------------
 |  Class methods inherited from typing.Generic:
 |
 |  __class_getitem__(...)
 |      Parameterizes a generic class.
 |
 |      At least, parameterizing a generic class is the *main* thing this
 |      method does. For example, for some generic class `Foo`, this is called
 |      when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
 |
 |      However, note that this method is also called when defining generic
 |      classes in the first place with `class Foo[T]: ...`.
 |
 |  __init_subclass__(...)
 |      Function to initialize subclasses.
anyio.BrokenResourceError
Python Library Documentation: class BrokenResourceError in module anyio

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
 |
 |  ----------------------------------------------------------------------
 |  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) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.BrokenWorkerProcess
Python Library Documentation: class BrokenWorkerProcess in module anyio

class BrokenWorkerProcess(builtins.Exception)
 |  Raised by :func:`run_sync_in_process` 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
 |
 |  ----------------------------------------------------------------------
 |  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) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.BusyResourceError
Python Library Documentation: class BusyResourceError in module anyio

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') from anyio._core._exceptions.BusyResourceError
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Static methods inherited from builtins.Exception:
 |
 |  __new__(*args, **kwargs) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.CancelScope
Python Library Documentation: class CancelScope in module anyio

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
 |
 |  Methods defined here:
 |
 |  __enter__(self) -> 'CancelScope' from anyio._core._tasks.CancelScope
 |
 |  __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'bool | None' from anyio._core._tasks.CancelScope
 |
 |  cancel(self) -> 'None' from anyio._core._tasks.CancelScope
 |      Cancel this scope immediately.
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(cls, *, deadline: 'float' = inf, shield: 'bool' = False) -> 'CancelScope' from anyio._core._tasks.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:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  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.
anyio.CapacityLimiter
Python Library Documentation: class CapacityLimiter in module anyio

class CapacityLimiter(builtins.object)
 |  CapacityLimiter(total_tokens: 'float') -> 'CapacityLimiter'
 |
 |  Methods defined here:
 |
 |  async __aenter__(self) -> 'None' from anyio._core._synchronization.CapacityLimiter
 |
 |  async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'bool | None' from anyio._core._synchronization.CapacityLimiter
 |
 |  async acquire(self) -> 'None' from anyio._core._synchronization.CapacityLimiter
 |      Acquire a token for the current task, waiting if necessary for one to become
 |      available.
 |
 |  acquire_nowait(self) -> 'None' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      Release the token held by the given borrower.
 |
 |      :raises RuntimeError: if the borrower has not borrowed a token from this
 |          limiter.
 |
 |  statistics(self) -> 'CapacityLimiterStatistics' from anyio._core._synchronization.CapacityLimiter
 |      Return statistics about the current state of this limiter.
 |
 |      .. versionadded:: 3.0
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(cls, total_tokens: 'float') -> 'CapacityLimiter' from anyio._core._synchronization.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:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  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.
anyio.CapacityLimiterStatistics
Python Library Documentation: class CapacityLimiterStatistics in module anyio

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) from anyio._core._synchronization.CapacityLimiterStatistics
 |      Implement delattr(self, name).
 |
 |  __eq__(self, other) from anyio._core._synchronization.CapacityLimiterStatistics
 |      Return self==value.
 |
 |  __hash__(self) from anyio._core._synchronization.CapacityLimiterStatistics
 |      Return hash(self).
 |
 |  __init__(self, borrowed_tokens: 'int', total_tokens: 'float', borrowers: 'tuple[object, ...]', tasks_waiting: 'int') -> None from anyio._core._synchronization.CapacityLimiterStatistics
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self) from anyio._core._synchronization.CapacityLimiterStatistics
 |      Return repr(self).
 |
 |  __setattr__(self, name, value) from anyio._core._synchronization.CapacityLimiterStatistics
 |      Implement setattr(self, name, value).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  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...
anyio.ClosedResourceError
Python Library Documentation: class ClosedResourceError in module anyio

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
 |
 |  ----------------------------------------------------------------------
 |  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) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.Condition
Python Library Documentation: class Condition in module anyio

class Condition(builtins.object)
 |  Condition(lock: 'Lock | None' = None)
 |
 |  Methods defined here:
 |
 |  async __aenter__(self) -> 'None' from anyio._core._synchronization.Condition
 |
 |  async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' from anyio._core._synchronization.Condition
 |
 |  __init__(self, lock: 'Lock | None' = None) from anyio._core._synchronization.Condition
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  async acquire(self) -> 'None' from anyio._core._synchronization.Condition
 |      Acquire the underlying lock.
 |
 |  acquire_nowait(self) -> 'None' from anyio._core._synchronization.Condition
 |      Acquire the underlying lock, without blocking.
 |
 |      :raises ~anyio.WouldBlock: if the operation would block
 |
 |  locked(self) -> 'bool' from anyio._core._synchronization.Condition
 |      Return True if the lock is set.
 |
 |  notify(self, n: 'int' = 1) -> 'None' from anyio._core._synchronization.Condition
 |      Notify exactly n listeners.
 |
 |  notify_all(self) -> 'None' from anyio._core._synchronization.Condition
 |      Notify all the listeners.
 |
 |  release(self) -> 'None' from anyio._core._synchronization.Condition
 |      Release the underlying lock.
 |
 |  statistics(self) -> 'ConditionStatistics' from anyio._core._synchronization.Condition
 |      Return statistics about the current state of this condition.
 |
 |      .. versionadded:: 3.0
 |
 |  async wait(self) -> 'None' from anyio._core._synchronization.Condition
 |      Wait for a notification.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __annotations__ = {'_owner_task': 'TaskInfo | None'}
anyio.ConditionStatistics
Python Library Documentation: class ConditionStatistics in module anyio

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) from anyio._core._synchronization.ConditionStatistics
 |      Implement delattr(self, name).
 |
 |  __eq__(self, other) from anyio._core._synchronization.ConditionStatistics
 |      Return self==value.
 |
 |  __hash__(self) from anyio._core._synchronization.ConditionStatistics
 |      Return hash(self).
 |
 |  __init__(self, tasks_waiting: 'int', lock_statistics: 'LockStatistics') -> None from anyio._core._synchronization.ConditionStatistics
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self) from anyio._core._synchronization.ConditionStatistics
 |      Return repr(self).
 |
 |  __setattr__(self, name, value) from anyio._core._synchronization.ConditionStatistics
 |      Implement setattr(self, name, value).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  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')
anyio.DelimiterNotFound
Python Library Documentation: class DelimiterNotFound in module anyio

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' from anyio._core._exceptions.DelimiterNotFound
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Static methods inherited from builtins.Exception:
 |
 |  __new__(*args, **kwargs) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.EndOfStream
Python Library Documentation: class EndOfStream in module anyio

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
 |
 |  ----------------------------------------------------------------------
 |  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) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.Event
Python Library Documentation: class Event in module anyio

class Event(builtins.object)
 |  Event() -> 'Event'
 |
 |  Methods defined here:
 |
 |  is_set(self) -> 'bool' from anyio._core._synchronization.Event
 |      Return ``True`` if the flag is set, ``False`` if not.
 |
 |  set(self) -> 'None' from anyio._core._synchronization.Event
 |      Set the flag, notifying all listeners.
 |
 |  statistics(self) -> 'EventStatistics' from anyio._core._synchronization.Event
 |      Return statistics about the current state of this event.
 |
 |  async wait(self) -> 'None' from anyio._core._synchronization.Event
 |      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' from anyio._core._synchronization.Event
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.EventStatistics
Python Library Documentation: class EventStatistics in module anyio

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) from anyio._core._synchronization.EventStatistics
 |      Implement delattr(self, name).
 |
 |  __eq__(self, other) from anyio._core._synchronization.EventStatistics
 |      Return self==value.
 |
 |  __hash__(self) from anyio._core._synchronization.EventStatistics
 |      Return hash(self).
 |
 |  __init__(self, tasks_waiting: 'int') -> None from anyio._core._synchronization.EventStatistics
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self) from anyio._core._synchronization.EventStatistics
 |      Return repr(self).
 |
 |  __setattr__(self, name, value) from anyio._core._synchronization.EventStatistics
 |      Implement setattr(self, name, value).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  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',)
anyio.IncompleteRead
Python Library Documentation: class IncompleteRead in module anyio

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' from anyio._core._exceptions.IncompleteRead
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Static methods inherited from builtins.Exception:
 |
 |  __new__(*args, **kwargs) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.Lock
Python Library Documentation: class Lock in module anyio

class Lock(builtins.object)
 |  Lock() -> 'None'
 |
 |  Methods defined here:
 |
 |  async __aenter__(self) -> 'None' from anyio._core._synchronization.Lock
 |
 |  async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' from anyio._core._synchronization.Lock
 |
 |  __init__(self) -> 'None' from anyio._core._synchronization.Lock
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  async acquire(self) -> 'None' from anyio._core._synchronization.Lock
 |      Acquire the lock.
 |
 |  acquire_nowait(self) -> 'None' from anyio._core._synchronization.Lock
 |      Acquire the lock, without blocking.
 |
 |      :raises ~anyio.WouldBlock: if the operation would block
 |
 |  locked(self) -> 'bool' from anyio._core._synchronization.Lock
 |      Return True if the lock is currently held.
 |
 |  release(self) -> 'None' from anyio._core._synchronization.Lock
 |      Release the lock.
 |
 |  statistics(self) -> 'LockStatistics' from anyio._core._synchronization.Lock
 |      Return statistics about the current state of this lock.
 |
 |      .. versionadded:: 3.0
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __annotations__ = {'_owner_task': 'TaskInfo | None'}
anyio.LockStatistics
Python Library Documentation: class LockStatistics in module anyio

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) from anyio._core._synchronization.LockStatistics
 |      Implement delattr(self, name).
 |
 |  __eq__(self, other) from anyio._core._synchronization.LockStatistics
 |      Return self==value.
 |
 |  __hash__(self) from anyio._core._synchronization.LockStatistics
 |      Return hash(self).
 |
 |  __init__(self, locked: 'bool', owner: 'TaskInfo | None', tasks_waiting: 'int') -> None from anyio._core._synchronization.LockStatistics
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self) from anyio._core._synchronization.LockStatistics
 |      Return repr(self).
 |
 |  __setattr__(self, name, value) from anyio._core._synchronization.LockStatistics
 |      Implement setattr(self, name, value).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  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')
anyio.Path
Python Library Documentation: class Path in module anyio

class Path(builtins.object)
 |  Path(*args: 'str | PathLike[str]') -> '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.
 |
 |  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_mount`
 |  * :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.rmdir`
 |  * :meth:`~pathlib.Path.samefile`
 |  * :meth:`~pathlib.Path.stat`
 |  * :meth:`~pathlib.Path.touch`
 |  * :meth:`~pathlib.Path.unlink`
 |  * :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`
 |
 |  Methods defined here:
 |
 |  __bytes__(self) -> 'bytes' from anyio._core._fileio.Path
 |
 |  __eq__(self, other: 'object') -> 'bool' from anyio._core._fileio.Path
 |      Return self==value.
 |
 |  __fspath__(self) -> 'str' from anyio._core._fileio.Path
 |
 |  __ge__(self, other: 'pathlib.PurePath | Path') -> 'bool' from anyio._core._fileio.Path
 |      Return self>=value.
 |
 |  __gt__(self, other: 'pathlib.PurePath | Path') -> 'bool' from anyio._core._fileio.Path
 |      Return self>value.
 |
 |  __hash__(self) -> 'int' from anyio._core._fileio.Path
 |      Return hash(self).
 |
 |  __init__(self, *args: 'str | PathLike[str]') -> 'None' from anyio._core._fileio.Path
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __le__(self, other: 'pathlib.PurePath | Path') -> 'bool' from anyio._core._fileio.Path
 |      Return self<=value.
 |
 |  __lt__(self, other: 'pathlib.PurePath | Path') -> 'bool' from anyio._core._fileio.Path
 |      Return self<value.
 |
 |  __repr__(self) -> 'str' from anyio._core._fileio.Path
 |      Return repr(self).
 |
 |  __rtruediv__(self, other: 'str | PathLike[str]') -> 'Path' from anyio._core._fileio.Path
 |
 |  __str__(self) -> 'str' from anyio._core._fileio.Path
 |      Return str(self).
 |
 |  __truediv__(self, other: 'str | PathLike[str]') -> 'Path' from anyio._core._fileio.Path
 |
 |  async absolute(self) -> 'Path' from anyio._core._fileio.Path
 |
 |  as_posix(self) -> 'str' from anyio._core._fileio.Path
 |
 |  as_uri(self) -> 'str' from anyio._core._fileio.Path
 |
 |  async chmod(self, mode: 'int', *, follow_symlinks: 'bool' = True) -> 'None' from anyio._core._fileio.Path
 |
 |  async exists(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async expanduser(self) -> 'Path' from anyio._core._fileio.Path
 |
 |  glob(self, pattern: 'str') -> 'AsyncIterator[Path]' from anyio._core._fileio.Path
 |
 |  async group(self) -> 'str' from anyio._core._fileio.Path
 |
 |  async hardlink_to(self, target: 'str | bytes | PathLike[str] | PathLike[bytes]') -> 'None' from anyio._core._fileio.Path
 |
 |  is_absolute(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_block_device(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_char_device(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_dir(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_fifo(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_file(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_junction(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_mount(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  is_relative_to(self, other: 'str | PathLike[str]') -> 'bool' from anyio._core._fileio.Path
 |
 |  is_reserved(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_socket(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  async is_symlink(self) -> 'bool' from anyio._core._fileio.Path
 |
 |  iterdir(self) -> 'AsyncIterator[Path]' from anyio._core._fileio.Path
 |
 |  joinpath(self, *args: 'str | PathLike[str]') -> 'Path' from anyio._core._fileio.Path
 |
 |  async lchmod(self, mode: 'int') -> 'None' from anyio._core._fileio.Path
 |
 |  async lstat(self) -> 'os.stat_result' from anyio._core._fileio.Path
 |
 |  match(self, path_pattern: 'str') -> 'bool' from anyio._core._fileio.Path
 |
 |  async mkdir(self, mode: 'int' = 511, parents: 'bool' = False, exist_ok: 'bool' = False) -> 'None' from anyio._core._fileio.Path
 |
 |  async open(self, mode: 'str' = 'r', buffering: 'int' = -1, encoding: 'str | None' = None, errors: 'str | None' = None, newline: 'str | None' = None) -> 'AsyncFile[Any]' from anyio._core._fileio.Path
 |
 |  async owner(self) -> 'str' from anyio._core._fileio.Path
 |
 |  async read_bytes(self) -> 'bytes' from anyio._core._fileio.Path
 |
 |  async read_text(self, encoding: 'str | None' = None, errors: 'str | None' = None) -> 'str' from anyio._core._fileio.Path
 |
 |  async readlink(self) -> 'Path' from anyio._core._fileio.Path
 |
 |  relative_to(self, *other: 'str | PathLike[str]', walk_up: 'bool' = False) -> 'Path' from anyio._core._fileio.Path
 |
 |  async rename(self, target: 'str | pathlib.PurePath | Path') -> 'Path' from anyio._core._fileio.Path
 |
 |  async replace(self, target: 'str | pathlib.PurePath | Path') -> 'Path' from anyio._core._fileio.Path
 |
 |  async resolve(self, strict: 'bool' = False) -> 'Path' from anyio._core._fileio.Path
 |
 |  rglob(self, pattern: 'str') -> 'AsyncIterator[Path]' from anyio._core._fileio.Path
 |
 |  async rmdir(self) -> 'None' from anyio._core._fileio.Path
 |
 |  async samefile(self, other_path: 'str | PathLike[str]') -> 'bool' from anyio._core._fileio.Path
 |
 |  async stat(self, *, follow_symlinks: 'bool' = True) -> 'os.stat_result' from anyio._core._fileio.Path
 |
 |  async symlink_to(self, target: 'str | bytes | PathLike[str] | PathLike[bytes]', target_is_directory: 'bool' = False) -> 'None' from anyio._core._fileio.Path
 |
 |  async touch(self, mode: 'int' = 438, exist_ok: 'bool' = True) -> 'None' from anyio._core._fileio.Path
 |
 |  async unlink(self, missing_ok: 'bool' = False) -> 'None' from anyio._core._fileio.Path
 |
 |  async walk(self, top_down: 'bool' = True, on_error: 'Callable[[OSError], object] | None' = None, follow_symlinks: 'bool' = False) -> 'AsyncIterator[tuple[Path, list[str], list[str]]]' from anyio._core._fileio.Path
 |
 |  with_name(self, name: 'str') -> 'Path' from anyio._core._fileio.Path
 |
 |  with_segments(self, *pathsegments: 'str | PathLike[str]') -> 'Path' from anyio._core._fileio.Path
 |
 |  with_stem(self, stem: 'str') -> 'Path' from anyio._core._fileio.Path
 |
 |  with_suffix(self, suffix: 'str') -> 'Path' from anyio._core._fileio.Path
 |
 |  async write_bytes(self, data: 'bytes') -> 'int' from anyio._core._fileio.Path
 |
 |  async write_text(self, data: 'str', encoding: 'str | None' = None, errors: 'str | None' = None, newline: 'str | None' = None) -> 'int' from anyio._core._fileio.Path
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  async cwd() -> 'Path' from anyio._core._fileio.Path
 |
 |  async home() -> 'Path' from anyio._core._fileio.Path
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  anchor
 |
 |  drive
 |
 |  name
 |
 |  parent
 |
 |  parents
 |
 |  parts
 |
 |  root
 |
 |  stem
 |
 |  suffix
 |
 |  suffixes
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __annotations__ = {'__weakref__': 'Any'}
anyio.ResourceGuard
Python Library Documentation: class ResourceGuard in module anyio

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' from anyio._core._synchronization.ResourceGuard
 |
 |  __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'bool | None' from anyio._core._synchronization.ResourceGuard
 |
 |  __init__(self, action: 'str' = 'using') from anyio._core._synchronization.ResourceGuard
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  action
anyio.Semaphore
Python Library Documentation: class Semaphore in module anyio

class Semaphore(builtins.object)
 |  Semaphore(initial_value: 'int', *, max_value: 'int | None' = None)
 |
 |  Methods defined here:
 |
 |  async __aenter__(self) -> 'Semaphore' from anyio._core._synchronization.Semaphore
 |
 |  async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None' from anyio._core._synchronization.Semaphore
 |
 |  __init__(self, initial_value: 'int', *, max_value: 'int | None' = None) from anyio._core._synchronization.Semaphore
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  async acquire(self) -> 'None' from anyio._core._synchronization.Semaphore
 |      Decrement the semaphore value, blocking if necessary.
 |
 |  acquire_nowait(self) -> 'None' from anyio._core._synchronization.Semaphore
 |      Acquire the underlying lock, without blocking.
 |
 |      :raises ~anyio.WouldBlock: if the operation would block
 |
 |  release(self) -> 'None' from anyio._core._synchronization.Semaphore
 |      Increment the semaphore value.
 |
 |  statistics(self) -> 'SemaphoreStatistics' from anyio._core._synchronization.Semaphore
 |      Return statistics about the current state of this semaphore.
 |
 |      .. versionadded:: 3.0
 |
 |  ----------------------------------------------------------------------
 |  Readonly properties defined here:
 |
 |  max_value
 |      The maximum value of the semaphore.
 |
 |  value
 |      The current value of the semaphore.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.SemaphoreStatistics
Python Library Documentation: class SemaphoreStatistics in module anyio

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) from anyio._core._synchronization.SemaphoreStatistics
 |      Implement delattr(self, name).
 |
 |  __eq__(self, other) from anyio._core._synchronization.SemaphoreStatistics
 |      Return self==value.
 |
 |  __hash__(self) from anyio._core._synchronization.SemaphoreStatistics
 |      Return hash(self).
 |
 |  __init__(self, tasks_waiting: 'int') -> None from anyio._core._synchronization.SemaphoreStatistics
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self) from anyio._core._synchronization.SemaphoreStatistics
 |      Return repr(self).
 |
 |  __setattr__(self, name, value) from anyio._core._synchronization.SemaphoreStatistics
 |      Implement setattr(self, name, value).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  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',)
anyio.TASK_STATUS_IGNORED
Python Library Documentation: _IgnoredTaskStatus in module anyio object

class _IgnoredTaskStatus(anyio.abc.TaskStatus)
 |  Method resolution order:
 |      _IgnoredTaskStatus
 |      anyio.abc.TaskStatus
 |      typing.Protocol
 |      typing.Generic
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __init__(self, /, *args, **kwargs) from builtins.object
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  started(self, value: 'object' = None) -> 'None'
 |      Signal that the task has started.
 |
 |      :param value: object passed back to the starter of the task
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __subclasshook__ = _proto_hook(other) from typing
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset()
 |
 |  __annotations__ = {}
 |
 |  __orig_bases__ = (anyio.abc.TaskStatus[object],)
 |
 |  __parameters__ = ()
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from anyio.abc.TaskStatus:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes inherited from anyio.abc.TaskStatus:
 |
 |  __protocol_attrs__ = {'started'}
 |
 |  ----------------------------------------------------------------------
 |  Class methods inherited from typing.Protocol:
 |
 |  __init_subclass__(*args, **kwargs)
 |      Function to initialize subclasses.
 |
 |  ----------------------------------------------------------------------
 |  Class methods inherited from typing.Generic:
 |
 |  __class_getitem__(...)
 |      Parameterizes a generic class.
 |
 |      At least, parameterizing a generic class is the *main* thing this
 |      method does. For example, for some generic class `Foo`, this is called
 |      when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
 |
 |      However, note that this method is also called when defining generic
 |      classes in the first place with `class Foo[T]: ...`.
anyio.TaskInfo
Python Library Documentation: class TaskInfo in module anyio

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' from anyio._core._testing.TaskInfo
 |      Return self==value.
 |
 |  __hash__(self) -> 'int' from anyio._core._testing.TaskInfo
 |      Return hash(self).
 |
 |  __init__(self, id: 'int', parent_id: 'int | None', name: 'str | None', coro: 'Generator[Any, Any, Any] | Awaitable[Any]') from anyio._core._testing.TaskInfo
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self) -> 'str' from anyio._core._testing.TaskInfo
 |      Return repr(self).
 |
 |  has_pending_cancellation(self) -> 'bool' from anyio._core._testing.TaskInfo
 |      Return ``True`` if the task has a cancellation pending, ``False`` otherwise.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  coro
 |
 |  id
 |
 |  name
 |
 |  parent_id
anyio.TypedAttributeLookupError
Python Library Documentation: class TypedAttributeLookupError in module anyio

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
 |
 |  ----------------------------------------------------------------------
 |  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) class method of builtins.LookupError
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.TypedAttributeProvider
Python Library Documentation: class TypedAttributeProvider in module anyio

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 0x000001D979498920>) -> 'object' from anyio._core._typedattr.TypedAttributeProvider
 |      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
 |
 |  __weakref__
 |      list of weak references to the object
anyio.TypedAttributeSet
Python Library Documentation: class TypedAttributeSet in module anyio

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 anyio._core._typedattr.TypedAttributeSet
 |      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
 |
 |  __weakref__
 |      list of weak references to the object
anyio.WouldBlock
Python Library Documentation: class WouldBlock in module anyio

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
 |
 |  ----------------------------------------------------------------------
 |  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) class method of builtins.Exception
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.BaseException:
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __reduce__(...)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __setstate__(...)
 |
 |  __str__(self, /)
 |      Return str(self).
 |
 |  add_note(...)
 |      Exception.add_note(note) --
 |      add a note to the exception
 |
 |  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
anyio.aclose_forcefully
Python Library Documentation: function aclose_forcefully in module anyio

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
anyio.annotations
Python Library Documentation: _Feature in module __future__ object

class _Feature(builtins.object)
 |  _Feature(optionalRelease, mandatoryRelease, compiler_flag)
 |
 |  Methods defined here:
 |
 |  __init__(self, optionalRelease, mandatoryRelease, compiler_flag)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  getMandatoryRelease(self)
 |      Return release in which this feature will become mandatory.
 |
 |      This is a 5-tuple, of the same form as sys.version_info, or, if
 |      the feature was dropped, or the release date is undetermined, is None.
 |
 |  getOptionalRelease(self)
 |      Return first release in which this feature was recognized.
 |
 |      This is a 5-tuple, of the same form as sys.version_info.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.connect_tcp
Python Library Documentation: function connect_tcp in module anyio

async connect_tcp(remote_host: 'IPAddressType', remote_port: 'int', *, local_host: 'IPAddressType | 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 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 OSError: if the connection attempt fails
anyio.connect_unix
Python Library Documentation: function connect_unix in module anyio

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
anyio.create_connected_udp_socket
Python Library Documentation: function create_connected_udp_socket in module anyio

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
anyio.create_connected_unix_datagram_socket
Python Library Documentation: function create_connected_unix_datagram_socket in module anyio

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
anyio.create_memory_object_stream
Python Library Documentation: class create_memory_object_stream in module anyio

class create_memory_object_stream(builtins.tuple, typing.Generic)
 |  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
 |      typing.Generic
 |      builtins.object
 |
 |  Static methods defined here:
 |
 |  __new__(cls, max_buffer_size: 'float' = 0, item_type: 'object' = None) -> 'tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]]' from anyio._core._streams.create_memory_object_stream
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __annotations__ = {}
 |
 |  __orig_bases__ = (typing.Tuple[anyio.streams.memory.MemoryObjectSe...t...
 |
 |  __parameters__ = (~T_Item,)
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from builtins.tuple:
 |
 |  __add__(self, value, /)
 |      Return self+value.
 |
 |  __contains__(self, key, /)
 |      Return bool(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__(...)
 |      See PEP 585
 |
 |  ----------------------------------------------------------------------
 |  Class methods inherited from typing.Generic:
 |
 |  __init_subclass__(...)
 |      Function to initialize subclasses.
anyio.create_task_group
Python Library Documentation: function create_task_group in module anyio

create_task_group() -> 'TaskGroup'
    Create a task group.

    :return: a task group
anyio.create_tcp_listener
Python Library Documentation: function create_tcp_listener in module anyio

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 list of listener objects
anyio.create_udp_socket
Python Library Documentation: function create_udp_socket in module anyio

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
anyio.create_unix_datagram_socket
Python Library Documentation: function create_unix_datagram_socket in module anyio

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
anyio.create_unix_listener
Python Library Documentation: function create_unix_listener in module anyio

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.
anyio.current_effective_deadline
Python Library Documentation: function current_effective_deadline in module anyio

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
anyio.current_time
Python Library Documentation: function current_time in module anyio

current_time() -> 'float'
    Return the current value of the event loop's internal clock.

    :return: the clock value (seconds)
anyio.fail_after
Python Library Documentation: function fail_after in module anyio

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`\]
anyio.get_all_backends
Python Library Documentation: function get_all_backends in module anyio

get_all_backends() -> 'tuple[str, ...]'
    Return a tuple of the names of all built-in backends.
anyio.get_cancelled_exc_class
Python Library Documentation: function get_cancelled_exc_class in module anyio

get_cancelled_exc_class() -> 'type[BaseException]'
    Return the current async library's cancellation exception class.
anyio.get_current_task
Python Library Documentation: function get_current_task in module anyio

get_current_task() -> 'TaskInfo'
    Return the current task.

    :return: a representation of the current task
anyio.get_running_tasks
Python Library Documentation: function get_running_tasks in module anyio

get_running_tasks() -> 'list[TaskInfo]'
    Return a list of running tasks in the current event loop.

    :return: a list of task info objects
anyio.getaddrinfo
Python Library Documentation: function getaddrinfo in module anyio

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`
anyio.getnameinfo
Python Library Documentation: function getnameinfo in module anyio

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)

    .. seealso:: :func:`socket.getnameinfo`
anyio.key
Error rendering doc: No Python documentation found for 'typed_attribute'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.
anyio.move_on_after
Python Library Documentation: function move_on_after in module anyio

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
anyio.open_file
Python Library Documentation: function open_file in module anyio

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) -> 'AsyncFile[Any]'
    Open a file asynchronously.

    The arguments are exactly the same as for the builtin :func:`open`.

    :return: an asynchronous file object
anyio.open_process
Python Library Documentation: function open_process in module anyio

async open_process(command: 'str | bytes | Sequence[str | bytes]', *, stdin: 'int | IO[Any] | None' = -1, stdout: 'int | IO[Any] | None' = -1, stderr: 'int | IO[Any] | None' = -1, cwd: 'str | bytes | PathLike[str] | None' = None, env: 'Mapping[str, str] | None' = None, start_new_session: 'bool' = False) -> '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 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)
    :return: an asynchronous process object
anyio.open_signal_receiver
Python Library Documentation: function open_signal_receiver in module anyio

open_signal_receiver(*signals: 'Signals') -> 'ContextManager[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

    .. 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`.
anyio.run
Python Library Documentation: function run in module anyio

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
anyio.run_process
Python Library Documentation: function run_process in module anyio

async run_process(command: 'str | bytes | Sequence[str | bytes]', *, input: 'bytes | None' = None, stdout: 'int | IO[Any] | None' = -1, stderr: 'int | IO[Any] | None' = -1, check: 'bool' = True, cwd: 'str | bytes | PathLike[str] | None' = None, env: 'Mapping[str, str] | None' = None, start_new_session: 'bool' = False) -> '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 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 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)
    :return: an object representing the completed process
    :raises ~subprocess.CalledProcessError: if ``check`` is ``True`` and the process
        exits with a nonzero return code
anyio.sleep
Python Library Documentation: function sleep in module anyio

async sleep(delay: 'float') -> 'None'
    Pause the current task for the specified duration.

    :param delay: the duration, in seconds
anyio.sleep_forever
Python Library Documentation: function sleep_forever in module anyio

async sleep_forever() -> 'None'
    Pause the current task until it's cancelled.

    This is a shortcut for ``sleep(math.inf)``.

    .. versionadded:: 3.1
anyio.sleep_until
Python Library Documentation: function sleep_until in module anyio

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
anyio.typed_attribute
Python Library Documentation: function typed_attribute in module anyio

typed_attribute() -> 'Any'
    Return a unique object, used to mark typed attributes.
anyio.value
Python Library Documentation: function typed_attribute in module anyio

typed_attribute() -> 'Any'
    Return a unique object, used to mark typed attributes.
anyio.wait_all_tasks_blocked
Python Library Documentation: function wait_all_tasks_blocked in module anyio

async wait_all_tasks_blocked() -> 'None'
    Wait until all other tasks are waiting for something.
anyio.wait_socket_readable
Python Library Documentation: function wait_socket_readable in module anyio

wait_socket_readable(sock: 'socket.socket') -> 'Awaitable[None]'
    Wait until the given socket has data to be read.

    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 readable
    :raises ~anyio.BusyResourceError: if another task is already waiting for the socket
        to become readable
anyio.wait_socket_writable
Python Library Documentation: function wait_socket_writable in module anyio

wait_socket_writable(sock: 'socket.socket') -> 'Awaitable[None]'
    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
anyio.wrap_file
Python Library Documentation: function wrap_file in module anyio

wrap_file(file: 'IO[AnyStr]') -> 'AsyncFile[AnyStr]'
    Wrap an existing file as an asynchronous file.

    :param file: an existing file-like object
    :return: an asynchronous file object
anyio.to_thread.Callable
Python Library Documentation: class Callable in module collections.abc

class Callable(builtins.object)
 |  Methods defined here:
 |
 |  __call__(self, *args, **kwds)
 |      Call self as a function.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __class_getitem__ = _CallableGenericAlias(args)
 |      Represent `Callable[argtypes, resulttype]`.
 |
 |      This sets ``__args__`` to a tuple containing the flattened ``argtypes``
 |      followed by ``resulttype``.
 |
 |      Example: ``Callable[[int, str], float]`` sets ``__args__`` to
 |      ``(int, str, float)``.
 |
 |  __subclasshook__(C)
 |      Abstract classes can override this to customize issubclass().
 |
 |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
 |      It should return True, False or NotImplemented.  If it returns
 |      NotImplemented, the normal algorithm is used.  Otherwise, it
 |      overrides the normal algorithm (and the outcome is cached).
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset({'__call__'})
anyio.to_thread.CapacityLimiter
Python Library Documentation: class CapacityLimiter in module anyio

class CapacityLimiter(builtins.object)
 |  CapacityLimiter(total_tokens: 'float') -> 'CapacityLimiter'
 |
 |  Methods defined here:
 |
 |  async __aenter__(self) -> 'None' from anyio._core._synchronization.CapacityLimiter
 |
 |  async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'bool | None' from anyio._core._synchronization.CapacityLimiter
 |
 |  async acquire(self) -> 'None' from anyio._core._synchronization.CapacityLimiter
 |      Acquire a token for the current task, waiting if necessary for one to become
 |      available.
 |
 |  acquire_nowait(self) -> 'None' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      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' from anyio._core._synchronization.CapacityLimiter
 |      Release the token held by the given borrower.
 |
 |      :raises RuntimeError: if the borrower has not borrowed a token from this
 |          limiter.
 |
 |  statistics(self) -> 'CapacityLimiterStatistics' from anyio._core._synchronization.CapacityLimiter
 |      Return statistics about the current state of this limiter.
 |
 |      .. versionadded:: 3.0
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(cls, total_tokens: 'float') -> 'CapacityLimiter' from anyio._core._synchronization.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:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  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.
anyio.to_thread.PosArgsT
Python Library Documentation: TypeVarTuple in module anyio.to_thread object

PosArgsT = class TypeVarTuple(builtins.object)
 |  Type variable tuple. A specialized form of type variable that enables
 |  variadic generics.
 |
 |  The preferred way to construct a type variable tuple is via the
 |  dedicated syntax for generic functions, classes, and type aliases,
 |  where a single '*' indicates a type variable tuple::
 |
 |      def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, T]:
 |          return (*tup[1:], tup[0])
 |
 |  For compatibility with Python 3.11 and earlier, TypeVarTuple objects
 |  can also be created as follows::
 |
 |      Ts = TypeVarTuple('Ts')  # Can be given any name
 |
 |  Just as a TypeVar (type variable) is a placeholder for a single type,
 |  a TypeVarTuple is a placeholder for an *arbitrary* number of types. For
 |  example, if we define a generic class using a TypeVarTuple::
 |
 |      class C[*Ts]: ...
 |
 |  Then we can parameterize that class with an arbitrary number of type
 |  arguments::
 |
 |      C[int]       # Fine
 |      C[int, str]  # Also fine
 |      C[()]        # Even this is fine
 |
 |  For more details, see PEP 646.
 |
 |  Note that only TypeVarTuples defined in the global scope can be
 |  pickled.
 |
 |  Methods defined here:
 |
 |  __iter__(self, /)
 |      Implement iter(self).
 |
 |  __mro_entries__(...)
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __typing_prepare_subst__(self, /, alias, args)
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
anyio.to_thread.T_Retval
Python Library Documentation: TypeVar in module anyio.to_thread object

T_Retval = class TypeVar(builtins.object)
 |  Type variable.
 |
 |  The preferred way to construct a type variable is via the dedicated
 |  syntax for generic functions, classes, and type aliases::
 |
 |      class Sequence[T]:  # T is a TypeVar
 |          ...
 |
 |  This syntax can also be used to create bound and constrained type
 |  variables::
 |
 |      # S is a TypeVar bound to str
 |      class StrSequence[S: str]:
 |          ...
 |
 |      # A is a TypeVar constrained to str or bytes
 |      class StrOrBytesSequence[A: (str, bytes)]:
 |          ...
 |
 |  However, if desired, reusable type variables can also be constructed
 |  manually, like so::
 |
 |     T = TypeVar('T')  # Can be anything
 |     S = TypeVar('S', bound=str)  # Can be any subtype of str
 |     A = TypeVar('A', str, bytes)  # Must be exactly str or bytes
 |
 |  Type variables exist primarily for the benefit of static type
 |  checkers.  They serve as the parameters for generic types as well
 |  as for generic function and type alias definitions.
 |
 |  The variance of type variables is inferred by type checkers when they
 |  are created through the type parameter syntax and when
 |  ``infer_variance=True`` is passed. Manually created type variables may
 |  be explicitly marked covariant or contravariant by passing
 |  ``covariant=True`` or ``contravariant=True``. By default, manually
 |  created type variables are invariant. See PEP 484 and PEP 695 for more
 |  details.
 |
 |  Methods defined here:
 |
 |  __mro_entries__(...)
 |
 |  __or__(self, value, /)
 |      Return self|value.
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __ror__(self, value, /)
 |      Return value|self.
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __bound__
 |
 |  __constraints__
 |
 |  __contravariant__
 |
 |  __covariant__
 |
 |  __infer_variance__
anyio.to_thread.TypeVar
Python Library Documentation: class TypeVar in module typing

class TypeVar(builtins.object)
 |  Type variable.
 |
 |  The preferred way to construct a type variable is via the dedicated
 |  syntax for generic functions, classes, and type aliases::
 |
 |      class Sequence[T]:  # T is a TypeVar
 |          ...
 |
 |  This syntax can also be used to create bound and constrained type
 |  variables::
 |
 |      # S is a TypeVar bound to str
 |      class StrSequence[S: str]:
 |          ...
 |
 |      # A is a TypeVar constrained to str or bytes
 |      class StrOrBytesSequence[A: (str, bytes)]:
 |          ...
 |
 |  However, if desired, reusable type variables can also be constructed
 |  manually, like so::
 |
 |     T = TypeVar('T')  # Can be anything
 |     S = TypeVar('S', bound=str)  # Can be any subtype of str
 |     A = TypeVar('A', str, bytes)  # Must be exactly str or bytes
 |
 |  Type variables exist primarily for the benefit of static type
 |  checkers.  They serve as the parameters for generic types as well
 |  as for generic function and type alias definitions.
 |
 |  The variance of type variables is inferred by type checkers when they
 |  are created through the type parameter syntax and when
 |  ``infer_variance=True`` is passed. Manually created type variables may
 |  be explicitly marked covariant or contravariant by passing
 |  ``covariant=True`` or ``contravariant=True``. By default, manually
 |  created type variables are invariant. See PEP 484 and PEP 695 for more
 |  details.
 |
 |  Methods defined here:
 |
 |  __mro_entries__(...)
 |
 |  __or__(self, value, /)
 |      Return self|value.
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __ror__(self, value, /)
 |      Return value|self.
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __bound__
 |
 |  __constraints__
 |
 |  __contravariant__
 |
 |  __covariant__
 |
 |  __infer_variance__
anyio.to_thread.TypeVarTuple
Python Library Documentation: class TypeVarTuple in module typing

class TypeVarTuple(builtins.object)
 |  Type variable tuple. A specialized form of type variable that enables
 |  variadic generics.
 |
 |  The preferred way to construct a type variable tuple is via the
 |  dedicated syntax for generic functions, classes, and type aliases,
 |  where a single '*' indicates a type variable tuple::
 |
 |      def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, T]:
 |          return (*tup[1:], tup[0])
 |
 |  For compatibility with Python 3.11 and earlier, TypeVarTuple objects
 |  can also be created as follows::
 |
 |      Ts = TypeVarTuple('Ts')  # Can be given any name
 |
 |  Just as a TypeVar (type variable) is a placeholder for a single type,
 |  a TypeVarTuple is a placeholder for an *arbitrary* number of types. For
 |  example, if we define a generic class using a TypeVarTuple::
 |
 |      class C[*Ts]: ...
 |
 |  Then we can parameterize that class with an arbitrary number of type
 |  arguments::
 |
 |      C[int]       # Fine
 |      C[int, str]  # Also fine
 |      C[()]        # Even this is fine
 |
 |  For more details, see PEP 646.
 |
 |  Note that only TypeVarTuples defined in the global scope can be
 |  pickled.
 |
 |  Methods defined here:
 |
 |  __iter__(self, /)
 |      Implement iter(self).
 |
 |  __mro_entries__(...)
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __typing_prepare_subst__(self, /, alias, args)
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
anyio.to_thread.Unpack
Python Library Documentation: _SpecialForm in module typing

Unpack = typing.Unpack
    Type unpack operator.

    The type unpack operator takes the child types from some container type,
    such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'.

    For example::

        # For some generic class `Foo`:
        Foo[Unpack[tuple[int, str]]]  # Equivalent to Foo[int, str]

        Ts = TypeVarTuple('Ts')
        # Specifies that `Bar` is generic in an arbitrary number of types.
        # (Think of `Ts` as a tuple of an arbitrary number of individual
        #  `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
        #  `Generic[]`.)
        class Bar(Generic[Unpack[Ts]]): ...
        Bar[int]  # Valid
        Bar[int, str]  # Also valid

    From Python 3.11, this can also be done using the `*` operator::

        Foo[*tuple[int, str]]
        class Bar(Generic[*Ts]): ...

    And from Python 3.12, it can be done using built-in syntax for generics::

        Foo[*tuple[int, str]]
        class Bar[*Ts]: ...

    The operator can also be used along with a `TypedDict` to annotate
    `**kwargs` in a function signature::

        class Movie(TypedDict):
            name: str
            year: int

        # This function expects two keyword arguments - *name* of type `str` and
        # *year* of type `int`.
        def foo(**kwargs: Unpack[Movie]): ...

    Note that there is only some runtime checking of this operator. Not
    everything the runtime allows may be accepted by static type checkers.

    For more information, see PEPs 646 and 692.
anyio.to_thread.annotations
Python Library Documentation: _Feature in module __future__ object

class _Feature(builtins.object)
 |  _Feature(optionalRelease, mandatoryRelease, compiler_flag)
 |
 |  Methods defined here:
 |
 |  __init__(self, optionalRelease, mandatoryRelease, compiler_flag)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  getMandatoryRelease(self)
 |      Return release in which this feature will become mandatory.
 |
 |      This is a 5-tuple, of the same form as sys.version_info, or, if
 |      the feature was dropped, or the release date is undetermined, is None.
 |
 |  getOptionalRelease(self)
 |      Return first release in which this feature was recognized.
 |
 |      This is a 5-tuple, of the same form as sys.version_info.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.to_thread.current_default_thread_limiter
Python Library Documentation: function current_default_thread_limiter in module anyio.to_thread

current_default_thread_limiter() -> 'CapacityLimiter'
    Return the capacity limiter that is used by default to limit the number of
    concurrent threads.

    :return: a capacity limiter object
anyio.to_thread.get_async_backend
Python Library Documentation: function get_async_backend in module anyio._core._eventloop

get_async_backend(asynclib_name: 'str | None' = None) -> 'type[AsyncBackend]'
anyio.to_thread.run_sync
Python Library Documentation: function run_sync in module anyio.to_thread

async run_sync(func: 'Callable[[Unpack[PosArgsT]], T_Retval]', *args: 'Unpack[PosArgsT]', abandon_on_cancel: 'bool' = False, cancellable: 'bool | None' = None, limiter: 'CapacityLimiter | None' = None) -> 'T_Retval'
    Call the given function with the given arguments in a worker thread.

    If the ``cancellable`` option is enabled and the task waiting for its completion is
    cancelled, the thread will still run its course but its return value (or any raised
    exception) will be ignored.

    :param func: a callable
    :param args: positional arguments for the callable
    :param abandon_on_cancel: ``True`` to abandon the thread (leaving it to run
        unchecked on own) if the host task is cancelled, ``False`` to ignore
        cancellations in the host task until the operation has completed in the worker
        thread
    :param cancellable: deprecated alias of ``abandon_on_cancel``; will override
        ``abandon_on_cancel`` if both parameters are passed
    :param limiter: capacity limiter to use to limit the total amount of threads running
        (if omitted, the default limiter is used)
    :return: an awaitable that yields the return value of the function.
anyio.to_thread.warn
Python Library Documentation: built-in function warn in module _warnings

warn(...)
    Issue a warning, or maybe ignore it or raise an exception.

    message
      Text of the warning message.
    category
      The Warning category subclass. Defaults to UserWarning.
    stacklevel
      How far up the call stack to make this warning appear. A value of 2 for
      example attributes the warning to the caller of the code calling warn().
    source
      If supplied, the destroyed object which emitted a ResourceWarning
    skip_file_prefixes
      An optional tuple of module filename prefixes indicating frames to skip
      during stacklevel computations for stack frame attribution.
anyio.from_thread.AbstractContextManager
Python Library Documentation: class AbstractContextManager in module contextlib

class AbstractContextManager(abc.ABC)
 |  An abstract base class for context managers.
 |
 |  Method resolution order:
 |      AbstractContextManager
 |      abc.ABC
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __enter__(self)
 |      Return `self` upon entering the runtime context.
 |
 |  __exit__(self, exc_type, exc_value, traceback)
 |      Raise any exception triggered within the runtime context.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __class_getitem__ = GenericAlias(...)
 |      Represent a PEP 585 generic type
 |
 |      E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
 |
 |  __subclasshook__(C)
 |      Abstract classes can override this to customize issubclass().
 |
 |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
 |      It should return True, False or NotImplemented.  If it returns
 |      NotImplemented, the normal algorithm is used.  Otherwise, it
 |      overrides the normal algorithm (and the outcome is cached).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset({'__exit__'})
anyio.from_thread.Any
Python Library Documentation: class Any in module typing

class Any(builtins.object)
 |  Any(*args, **kwargs)
 |
 |  Special type indicating an unconstrained type.
 |
 |  - Any is compatible with every type.
 |  - Any assumed to have all methods.
 |  - All values assumed to be instances of Any.
 |
 |  Note that all the above statements are true from the point of view of
 |  static type checkers. At runtime, Any should not be used with instance
 |  checks.
 |
 |  Static methods defined here:
 |
 |  __new__(cls, *args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.from_thread.AsyncBackend
Python Library Documentation: class AsyncBackend in module anyio.abc

class AsyncBackend(builtins.object)
 |  Class methods defined here:
 |
 |  async cancel_shielded_checkpoint() -> 'None' from anyio.abc._eventloop.AsyncBackend
 |      Allow the rescheduling of other tasks.
 |
 |      This will give other tasks the opportunity to run, but without checking if the
 |      current task group has been cancelled, unlike with :meth:`checkpoint`.
 |
 |  cancelled_exception_class() -> 'type[BaseException]' from anyio.abc._eventloop.AsyncBackend
 |      Return the exception class that is raised in a task if it's cancelled.
 |
 |  check_cancelled() -> 'None' from anyio.abc._eventloop.AsyncBackend
 |
 |  async checkpoint() -> 'None' from anyio.abc._eventloop.AsyncBackend
 |      Check if the task has been cancelled, and allow rescheduling of other tasks.
 |
 |      This is effectively the same as running :meth:`checkpoint_if_cancelled` and then
 |      :meth:`cancel_shielded_checkpoint`.
 |
 |  async checkpoint_if_cancelled() -> 'None' from anyio.abc._eventloop.AsyncBackend
 |      Check if the current task group has been cancelled.
 |
 |      This will check if the task has been cancelled, but will not allow other tasks
 |      to be scheduled if not.
 |
 |  async connect_tcp(host: 'str', port: 'int', local_address: 'IPSockAddrType | None' = None) -> 'SocketStream' from anyio.abc._eventloop.AsyncBackend
 |
 |  async connect_unix(path: 'str | bytes') -> 'UNIXSocketStream' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_blocking_portal() -> 'BlockingPortal' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_cancel_scope(*, deadline: 'float' = inf, shield: 'bool' = False) -> 'CancelScope' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_capacity_limiter(total_tokens: 'float') -> 'CapacityLimiter' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_event() -> 'Event' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_task_group() -> 'TaskGroup' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_tcp_listener(sock: 'socket') -> 'SocketListener' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_test_runner(options: 'dict[str, Any]') -> 'TestRunner' from anyio.abc._eventloop.AsyncBackend
 |
 |  async create_udp_socket(family: 'AddressFamily', local_address: 'IPSockAddrType | None', remote_address: 'IPSockAddrType | None', reuse_port: 'bool') -> 'UDPSocket | ConnectedUDPSocket' from anyio.abc._eventloop.AsyncBackend
 |
 |  async create_unix_datagram_socket(raw_socket: 'socket', remote_path: 'str | bytes | None') -> 'UNIXDatagramSocket | ConnectedUNIXDatagramSocket' from anyio.abc._eventloop.AsyncBackend
 |
 |  create_unix_listener(sock: 'socket') -> 'SocketListener' from anyio.abc._eventloop.AsyncBackend
 |
 |  current_default_thread_limiter() -> 'CapacityLimiter' from anyio.abc._eventloop.AsyncBackend
 |
 |  current_effective_deadline() -> 'float' from anyio.abc._eventloop.AsyncBackend
 |      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
 |          - ``inf`` if there is no deadline in effect
 |          - ``-inf`` if the current scope has been cancelled
 |      :rtype: float
 |
 |  current_time() -> 'float' from anyio.abc._eventloop.AsyncBackend
 |      Return the current value of the event loop's internal clock.
 |
 |      :return: the clock value (seconds)
 |
 |  current_token() -> 'object' from anyio.abc._eventloop.AsyncBackend
 |      :return:
 |
 |  get_current_task() -> 'TaskInfo' from anyio.abc._eventloop.AsyncBackend
 |
 |  get_running_tasks() -> 'Sequence[TaskInfo]' from anyio.abc._eventloop.AsyncBackend
 |
 |  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] | tuple[str, int, int, int]]]' from anyio.abc._eventloop.AsyncBackend
 |
 |  async getnameinfo(sockaddr: 'IPSockAddrType', flags: 'int' = 0) -> 'tuple[str, str]' from anyio.abc._eventloop.AsyncBackend
 |
 |  async open_process(command: 'str | bytes | Sequence[str | bytes]', *, shell: 'bool', stdin: 'int | IO[Any] | None', stdout: 'int | IO[Any] | None', stderr: 'int | IO[Any] | None', cwd: 'str | bytes | PathLike[str] | None' = None, env: 'Mapping[str, str] | None' = None, start_new_session: 'bool' = False) -> 'Process' from anyio.abc._eventloop.AsyncBackend
 |
 |  open_signal_receiver(*signals: 'Signals') -> 'ContextManager[AsyncIterator[Signals]]' from anyio.abc._eventloop.AsyncBackend
 |
 |  run(func: 'Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]', args: 'tuple[Unpack[PosArgsT]]', kwargs: 'dict[str, Any]', options: 'dict[str, Any]') -> 'T_Retval' from anyio.abc._eventloop.AsyncBackend
 |      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 kwargs: positional arguments to ``func``
 |      :param options: keyword arguments to call the backend ``run()`` implementation
 |          with
 |      :return: the return value of the coroutine function
 |
 |  run_async_from_thread(func: 'Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]', args: 'tuple[Unpack[PosArgsT]]', token: 'object') -> 'T_Retval' from anyio.abc._eventloop.AsyncBackend
 |
 |  run_sync_from_thread(func: 'Callable[[Unpack[PosArgsT]], T_Retval]', args: 'tuple[Unpack[PosArgsT]]', token: 'object') -> 'T_Retval' from anyio.abc._eventloop.AsyncBackend
 |
 |  async run_sync_in_worker_thread(func: 'Callable[[Unpack[PosArgsT]], T_Retval]', args: 'tuple[Unpack[PosArgsT]]', abandon_on_cancel: 'bool' = False, limiter: 'CapacityLimiter | None' = None) -> 'T_Retval' from anyio.abc._eventloop.AsyncBackend
 |
 |  setup_process_pool_exit_at_shutdown(workers: 'set[Process]') -> 'None' from anyio.abc._eventloop.AsyncBackend
 |
 |  async sleep(delay: 'float') -> 'None' from anyio.abc._eventloop.AsyncBackend
 |      Pause the current task for the specified duration.
 |
 |      :param delay: the duration, in seconds
 |
 |  async wait_all_tasks_blocked() -> 'None' from anyio.abc._eventloop.AsyncBackend
 |
 |  async wait_socket_readable(sock: 'socket') -> 'None' from anyio.abc._eventloop.AsyncBackend
 |
 |  async wait_socket_writable(sock: 'socket') -> 'None' from anyio.abc._eventloop.AsyncBackend
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset({'cancelled_exception_class', 'check_c...
anyio.from_thread.AsyncContextManager
Python Library Documentation: _SpecialGenericAlias in module typing

AsyncContextManager = typing.AsyncContextManager
    A generic version of contextlib.AbstractAsyncContextManager.
anyio.from_thread.Awaitable
Python Library Documentation: class Awaitable in module collections.abc

class Awaitable(builtins.object)
 |  Methods defined here:
 |
 |  __await__(self)
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __class_getitem__ = GenericAlias(...)
 |      Represent a PEP 585 generic type
 |
 |      E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
 |
 |  __subclasshook__(C)
 |      Abstract classes can override this to customize issubclass().
 |
 |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
 |      It should return True, False or NotImplemented.  If it returns
 |      NotImplemented, the normal algorithm is used.  Otherwise, it
 |      overrides the normal algorithm (and the outcome is cached).
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset({'__await__'})
anyio.from_thread.BlockingPortal
Python Library Documentation: class BlockingPortal in module anyio.from_thread

class BlockingPortal(builtins.object)
 |  BlockingPortal() -> 'BlockingPortal'
 |
 |  An object that lets external threads run code in an asynchronous event loop.
 |
 |  Methods defined here:
 |
 |  async __aenter__(self) -> 'BlockingPortal'
 |
 |  async __aexit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'bool | None'
 |
 |  __init__(self) -> 'None'
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  call(self, func: 'Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval]', *args: 'Unpack[PosArgsT]') -> 'T_Retval'
 |      Call the given function in the event loop thread.
 |
 |      If the callable returns a coroutine object, it is awaited on.
 |
 |      :param func: any callable
 |      :raises RuntimeError: if the portal is not running or if this method is called
 |          from within the event loop thread
 |
 |  async sleep_until_stopped(self) -> 'None'
 |      Sleep until :meth:`stop` is called.
 |
 |  start_task(self, func: 'Callable[..., Awaitable[T_Retval]]', *args: 'object', name: 'object' = None) -> 'tuple[Future[T_Retval], Any]'
 |      Start a task in the portal's task group and wait until it signals for readiness.
 |
 |      This method works the same way as :meth:`.abc.TaskGroup.start`.
 |
 |      :param func: the target function
 |      :param args: positional arguments passed to ``func``
 |      :param name: name of the task (will be coerced to a string if not ``None``)
 |      :return: a tuple of (future, task_status_value) where the ``task_status_value``
 |          is the value passed to ``task_status.started()`` from within the target
 |          function
 |      :rtype: tuple[concurrent.futures.Future[T_Retval], Any]
 |
 |      .. versionadded:: 3.0
 |
 |  start_task_soon(self, func: 'Callable[[Unpack[PosArgsT]], Awaitable[T_Retval] | T_Retval]', *args: 'Unpack[PosArgsT]', name: 'object' = None) -> 'Future[T_Retval]'
 |      Start a task in the portal's task group.
 |
 |      The task will be run inside a cancel scope which can be cancelled by cancelling
 |      the returned future.
 |
 |      :param func: the target function
 |      :param args: positional arguments passed to ``func``
 |      :param name: name of the task (will be coerced to a string if not ``None``)
 |      :return: a future that resolves with the return value of the callable if the
 |          task completes successfully, or with the exception raised in the task
 |      :raises RuntimeError: if the portal is not running or if this method is called
 |          from within the event loop thread
 |      :rtype: concurrent.futures.Future[T_Retval]
 |
 |      .. versionadded:: 3.0
 |
 |  async stop(self, cancel_remaining: 'bool' = False) -> 'None'
 |      Signal the portal to shut down.
 |
 |      This marks the portal as no longer accepting new calls and exits from
 |      :meth:`sleep_until_stopped`.
 |
 |      :param cancel_remaining: ``True`` to cancel all the remaining tasks, ``False``
 |          to let them finish before returning
 |
 |  wrap_async_context_manager(self, cm: 'AsyncContextManager[T_co]') -> 'ContextManager[T_co]'
 |      Wrap an async context manager as a synchronous context manager via this portal.
 |
 |      Spawns a task that will call both ``__aenter__()`` and ``__aexit__()``, stopping
 |      in the middle until the synchronous context manager exits.
 |
 |      :param cm: an asynchronous context manager
 |      :return: a synchronous context manager
 |
 |      .. versionadded:: 2.1
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(cls) -> 'BlockingPortal'
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.from_thread.BlockingPortalProvider
Python Library Documentation: class BlockingPortalProvider in module anyio.from_thread

class BlockingPortalProvider(builtins.object)
 |  BlockingPortalProvider(backend: 'str' = 'asyncio', backend_options: 'dict[str, Any] | None' = None) -> None
 |
 |  A manager for a blocking portal. Used as a context manager. The first thread to
 |  enter this context manager causes a blocking portal to be started with the specific
 |  parameters, and the last thread to exit causes the portal to be shut down. Thus,
 |  there will be exactly one blocking portal running in this context as long as at
 |  least one thread has entered this context manager.
 |
 |  The parameters are the same as for :func:`~anyio.run`.
 |
 |  :param backend: name of the backend
 |  :param backend_options: backend options
 |
 |  .. versionadded:: 4.4
 |
 |  Methods defined here:
 |
 |  __enter__(self) -> 'BlockingPortal'
 |
 |  __eq__(self, other)
 |      Return self==value.
 |
 |  __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'None'
 |
 |  __init__(self, backend: 'str' = 'asyncio', backend_options: 'dict[str, Any] | None' = None) -> None
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __annotations__ = {'_leases': 'int', '_lock': 'threading.Lock', '_port...
 |
 |  __dataclass_fields__ = {'_leases': Field(name='_leases',type='int',def...
 |
 |  __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,or...
 |
 |  __hash__ = None
 |
 |  __match_args__ = ('backend', 'backend_options')
 |
 |  backend = 'asyncio'
 |
 |  backend_options = None
anyio.from_thread.Callable
Python Library Documentation: class Callable in module collections.abc

class Callable(builtins.object)
 |  Methods defined here:
 |
 |  __call__(self, *args, **kwds)
 |      Call self as a function.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __class_getitem__ = _CallableGenericAlias(args)
 |      Represent `Callable[argtypes, resulttype]`.
 |
 |      This sets ``__args__`` to a tuple containing the flattened ``argtypes``
 |      followed by ``resulttype``.
 |
 |      Example: ``Callable[[int, str], float]`` sets ``__args__`` to
 |      ``(int, str, float)``.
 |
 |  __subclasshook__(C)
 |      Abstract classes can override this to customize issubclass().
 |
 |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
 |      It should return True, False or NotImplemented.  If it returns
 |      NotImplemented, the normal algorithm is used.  Otherwise, it
 |      overrides the normal algorithm (and the outcome is cached).
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset({'__call__'})
anyio.from_thread.CancelScope
Python Library Documentation: class CancelScope in module anyio

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
 |
 |  Methods defined here:
 |
 |  __enter__(self) -> 'CancelScope' from anyio._core._tasks.CancelScope
 |
 |  __exit__(self, exc_type: 'type[BaseException] | None', exc_val: 'BaseException | None', exc_tb: 'TracebackType | None') -> 'bool | None' from anyio._core._tasks.CancelScope
 |
 |  cancel(self) -> 'None' from anyio._core._tasks.CancelScope
 |      Cancel this scope immediately.
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(cls, *, deadline: 'float' = inf, shield: 'bool' = False) -> 'CancelScope' from anyio._core._tasks.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:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  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.
anyio.from_thread.ContextManager
Python Library Documentation: _SpecialGenericAlias in module typing

ContextManager = typing.ContextManager
    A generic version of contextlib.AbstractContextManager.
anyio.from_thread.Event
Python Library Documentation: class Event in module anyio

class Event(builtins.object)
 |  Event() -> 'Event'
 |
 |  Methods defined here:
 |
 |  is_set(self) -> 'bool' from anyio._core._synchronization.Event
 |      Return ``True`` if the flag is set, ``False`` if not.
 |
 |  set(self) -> 'None' from anyio._core._synchronization.Event
 |      Set the flag, notifying all listeners.
 |
 |  statistics(self) -> 'EventStatistics' from anyio._core._synchronization.Event
 |      Return statistics about the current state of this event.
 |
 |  async wait(self) -> 'None' from anyio._core._synchronization.Event
 |      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' from anyio._core._synchronization.Event
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.from_thread.FIRST_COMPLETED
Error rendering doc: No Python documentation found for 'FIRST_COMPLETED'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.
anyio.from_thread.Future
Python Library Documentation: class Future in module concurrent.futures._base

class Future(builtins.object)
 |  Represents the result of an asynchronous computation.
 |
 |  Methods defined here:
 |
 |  __init__(self)
 |      Initializes the future. Should not be called by clients.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  add_done_callback(self, fn)
 |      Attaches a callable that will be called when the future finishes.
 |
 |      Args:
 |          fn: A callable that will be called with this future as its only
 |              argument when the future completes or is cancelled. The callable
 |              will always be called by a thread in the same process in which
 |              it was added. If the future has already completed or been
 |              cancelled then the callable will be called immediately. These
 |              callables are called in the order that they were added.
 |
 |  cancel(self)
 |      Cancel the future if possible.
 |
 |      Returns True if the future was cancelled, False otherwise. A future
 |      cannot be cancelled if it is running or has already completed.
 |
 |  cancelled(self)
 |      Return True if the future was cancelled.
 |
 |  done(self)
 |      Return True if the future was cancelled or finished executing.
 |
 |  exception(self, timeout=None)
 |      Return the exception raised by the call that the future represents.
 |
 |      Args:
 |          timeout: The number of seconds to wait for the exception if the
 |              future isn't done. If None, then there is no limit on the wait
 |              time.
 |
 |      Returns:
 |          The exception raised by the call that the future represents or None
 |          if the call completed without raising.
 |
 |      Raises:
 |          CancelledError: If the future was cancelled.
 |          TimeoutError: If the future didn't finish executing before the given
 |              timeout.
 |
 |  result(self, timeout=None)
 |      Return the result of the call that the future represents.
 |
 |      Args:
 |          timeout: The number of seconds to wait for the result if the future
 |              isn't done. If None, then there is no limit on the wait time.
 |
 |      Returns:
 |          The result of the call that the future represents.
 |
 |      Raises:
 |          CancelledError: If the future was cancelled.
 |          TimeoutError: If the future didn't finish executing before the given
 |              timeout.
 |          Exception: If the call raised then that exception will be raised.
 |
 |  running(self)
 |      Return True if the future is currently executing.
 |
 |  set_exception(self, exception)
 |      Sets the result of the future as being the given exception.
 |
 |      Should only be used by Executor implementations and unit tests.
 |
 |  set_result(self, result)
 |      Sets the return value of work associated with the future.
 |
 |      Should only be used by Executor implementations and unit tests.
 |
 |  set_running_or_notify_cancel(self)
 |      Mark the future as running or process any cancel notifications.
 |
 |      Should only be used by Executor implementations and unit tests.
 |
 |      If the future has been cancelled (cancel() was called and returned
 |      True) then any threads waiting on the future completing (though calls
 |      to as_completed() or wait()) are notified and False is returned.
 |
 |      If the future was not cancelled then it is put in the running state
 |      (future calls to running() will return True) and True is returned.
 |
 |      This method should be called by Executor implementations before
 |      executing the work associated with this future. If this method returns
 |      False then the work should not be executed.
 |
 |      Returns:
 |          False if the Future was cancelled, True otherwise.
 |
 |      Raises:
 |          RuntimeError: if this method was already called or if set_result()
 |              or set_exception() was called.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __class_getitem__ = GenericAlias(...)
 |      Represent a PEP 585 generic type
 |
 |      E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.from_thread.Generator
Python Library Documentation: class Generator in module collections.abc

class Generator(Iterator)
 |  Method resolution order:
 |      Generator
 |      Iterator
 |      Iterable
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __next__(self)
 |      Return the next item from the generator.
 |      When exhausted, raise StopIteration.
 |
 |  close(self)
 |      Raise GeneratorExit inside generator.
 |
 |  send(self, value)
 |      Send a value into the generator.
 |      Return next yielded value or raise StopIteration.
 |
 |  throw(self, typ, val=None, tb=None)
 |      Raise an exception in the generator.
 |      Return next yielded value or raise StopIteration.
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __subclasshook__(C)
 |      Abstract classes can override this to customize issubclass().
 |
 |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
 |      It should return True, False or NotImplemented.  If it returns
 |      NotImplemented, the normal algorithm is used.  Otherwise, it
 |      overrides the normal algorithm (and the outcome is cached).
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset({'send', 'throw'})
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from Iterator:
 |
 |  __iter__(self)
 |
 |  ----------------------------------------------------------------------
 |  Class methods inherited from Iterable:
 |
 |  __class_getitem__ = GenericAlias(...)
 |      Represent a PEP 585 generic type
 |
 |      E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).
anyio.from_thread.Generic
Python Library Documentation: class Generic in module typing

class Generic(builtins.object)
 |  Abstract base class for generic types.
 |
 |  On Python 3.12 and newer, generic classes implicitly inherit from
 |  Generic when they declare a parameter list after the class's name::
 |
 |      class Mapping[KT, VT]:
 |          def __getitem__(self, key: KT) -> VT:
 |              ...
 |          # Etc.
 |
 |  On older versions of Python, however, generic classes have to
 |  explicitly inherit from Generic.
 |
 |  After a class has been declared to be generic, it can then be used as
 |  follows::
 |
 |      def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
 |          try:
 |              return mapping[key]
 |          except KeyError:
 |              return default
 |
 |  Class methods defined here:
 |
 |  __class_getitem__(...)
 |      Parameterizes a generic class.
 |
 |      At least, parameterizing a generic class is the *main* thing this
 |      method does. For example, for some generic class `Foo`, this is called
 |      when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
 |
 |      However, note that this method is also called when defining generic
 |      classes in the first place with `class Foo[T]: ...`.
 |
 |  __init_subclass__(...)
 |      Function to initialize subclasses.
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __annotations__ = {}
anyio.from_thread.Iterable
Python Library Documentation: _SpecialGenericAlias in module typing

Iterable = typing.Iterable
    A generic version of collections.abc.Iterable.
anyio.from_thread.PosArgsT
Python Library Documentation: TypeVarTuple in module anyio.from_thread object

PosArgsT = class TypeVarTuple(builtins.object)
 |  Type variable tuple. A specialized form of type variable that enables
 |  variadic generics.
 |
 |  The preferred way to construct a type variable tuple is via the
 |  dedicated syntax for generic functions, classes, and type aliases,
 |  where a single '*' indicates a type variable tuple::
 |
 |      def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, T]:
 |          return (*tup[1:], tup[0])
 |
 |  For compatibility with Python 3.11 and earlier, TypeVarTuple objects
 |  can also be created as follows::
 |
 |      Ts = TypeVarTuple('Ts')  # Can be given any name
 |
 |  Just as a TypeVar (type variable) is a placeholder for a single type,
 |  a TypeVarTuple is a placeholder for an *arbitrary* number of types. For
 |  example, if we define a generic class using a TypeVarTuple::
 |
 |      class C[*Ts]: ...
 |
 |  Then we can parameterize that class with an arbitrary number of type
 |  arguments::
 |
 |      C[int]       # Fine
 |      C[int, str]  # Also fine
 |      C[()]        # Even this is fine
 |
 |  For more details, see PEP 646.
 |
 |  Note that only TypeVarTuples defined in the global scope can be
 |  pickled.
 |
 |  Methods defined here:
 |
 |  __iter__(self, /)
 |      Implement iter(self).
 |
 |  __mro_entries__(...)
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __typing_prepare_subst__(self, /, alias, args)
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
anyio.from_thread.T_Retval
Python Library Documentation: TypeVar in module anyio.from_thread object

T_Retval = class TypeVar(builtins.object)
 |  Type variable.
 |
 |  The preferred way to construct a type variable is via the dedicated
 |  syntax for generic functions, classes, and type aliases::
 |
 |      class Sequence[T]:  # T is a TypeVar
 |          ...
 |
 |  This syntax can also be used to create bound and constrained type
 |  variables::
 |
 |      # S is a TypeVar bound to str
 |      class StrSequence[S: str]:
 |          ...
 |
 |      # A is a TypeVar constrained to str or bytes
 |      class StrOrBytesSequence[A: (str, bytes)]:
 |          ...
 |
 |  However, if desired, reusable type variables can also be constructed
 |  manually, like so::
 |
 |     T = TypeVar('T')  # Can be anything
 |     S = TypeVar('S', bound=str)  # Can be any subtype of str
 |     A = TypeVar('A', str, bytes)  # Must be exactly str or bytes
 |
 |  Type variables exist primarily for the benefit of static type
 |  checkers.  They serve as the parameters for generic types as well
 |  as for generic function and type alias definitions.
 |
 |  The variance of type variables is inferred by type checkers when they
 |  are created through the type parameter syntax and when
 |  ``infer_variance=True`` is passed. Manually created type variables may
 |  be explicitly marked covariant or contravariant by passing
 |  ``covariant=True`` or ``contravariant=True``. By default, manually
 |  created type variables are invariant. See PEP 484 and PEP 695 for more
 |  details.
 |
 |  Methods defined here:
 |
 |  __mro_entries__(...)
 |
 |  __or__(self, value, /)
 |      Return self|value.
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __ror__(self, value, /)
 |      Return value|self.
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __bound__
 |
 |  __constraints__
 |
 |  __contravariant__
 |
 |  __covariant__
 |
 |  __infer_variance__
anyio.from_thread.T_co
Python Library Documentation: TypeVar in module anyio.from_thread object

T_co = class TypeVar(builtins.object)
 |  Type variable.
 |
 |  The preferred way to construct a type variable is via the dedicated
 |  syntax for generic functions, classes, and type aliases::
 |
 |      class Sequence[T]:  # T is a TypeVar
 |          ...
 |
 |  This syntax can also be used to create bound and constrained type
 |  variables::
 |
 |      # S is a TypeVar bound to str
 |      class StrSequence[S: str]:
 |          ...
 |
 |      # A is a TypeVar constrained to str or bytes
 |      class StrOrBytesSequence[A: (str, bytes)]:
 |          ...
 |
 |  However, if desired, reusable type variables can also be constructed
 |  manually, like so::
 |
 |     T = TypeVar('T')  # Can be anything
 |     S = TypeVar('S', bound=str)  # Can be any subtype of str
 |     A = TypeVar('A', str, bytes)  # Must be exactly str or bytes
 |
 |  Type variables exist primarily for the benefit of static type
 |  checkers.  They serve as the parameters for generic types as well
 |  as for generic function and type alias definitions.
 |
 |  The variance of type variables is inferred by type checkers when they
 |  are created through the type parameter syntax and when
 |  ``infer_variance=True`` is passed. Manually created type variables may
 |  be explicitly marked covariant or contravariant by passing
 |  ``covariant=True`` or ``contravariant=True``. By default, manually
 |  created type variables are invariant. See PEP 484 and PEP 695 for more
 |  details.
 |
 |  Methods defined here:
 |
 |  __mro_entries__(...)
 |
 |  __or__(self, value, /)
 |      Return self|value.
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __ror__(self, value, /)
 |      Return value|self.
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __bound__
 |
 |  __constraints__
 |
 |  __contravariant__
 |
 |  __covariant__
 |
 |  __infer_variance__
anyio.from_thread.TaskStatus
Python Library Documentation: class TaskStatus in module anyio.abc

class TaskStatus(typing.Protocol)
 |  TaskStatus(*args, **kwargs)
 |
 |  Method resolution order:
 |      TaskStatus
 |      typing.Protocol
 |      typing.Generic
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __init__ = _no_init_or_replace_init(self, *args, **kwargs) from typing
 |
 |  started(self, value: 'T_contra | None' = None) -> 'None' from anyio.abc._tasks.TaskStatus
 |      Signal that the task has started.
 |
 |      :param value: object passed back to the starter of the task
 |
 |  ----------------------------------------------------------------------
 |  Class methods defined here:
 |
 |  __subclasshook__ = _proto_hook(other) from typing
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
 |
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |
 |  __abstractmethods__ = frozenset()
 |
 |  __annotations__ = {}
 |
 |  __orig_bases__ = (typing.Protocol[-T_contra],)
 |
 |  __parameters__ = (-T_contra,)
 |
 |  __protocol_attrs__ = {'started'}
 |
 |  ----------------------------------------------------------------------
 |  Class methods inherited from typing.Protocol:
 |
 |  __init_subclass__(*args, **kwargs)
 |      Function to initialize subclasses.
 |
 |  ----------------------------------------------------------------------
 |  Class methods inherited from typing.Generic:
 |
 |  __class_getitem__(...)
 |      Parameterizes a generic class.
 |
 |      At least, parameterizing a generic class is the *main* thing this
 |      method does. For example, for some generic class `Foo`, this is called
 |      when we do `Foo[int]` - there, with `cls=Foo` and `params=int`.
 |
 |      However, note that this method is also called when defining generic
 |      classes in the first place with `class Foo[T]: ...`.
anyio.from_thread.ThreadPoolExecutor
Python Library Documentation: class ThreadPoolExecutor in module concurrent.futures.thread

class ThreadPoolExecutor(concurrent.futures._base.Executor)
 |  ThreadPoolExecutor(max_workers=None, thread_name_prefix='', initializer=None, initargs=())
 |
 |  Method resolution order:
 |      ThreadPoolExecutor
 |      concurrent.futures._base.Executor
 |      builtins.object
 |
 |  Methods defined here:
 |
 |  __init__(self, max_workers=None, thread_name_prefix='', initializer=None, initargs=())
 |      Initializes a new ThreadPoolExecutor instance.
 |
 |      Args:
 |          max_workers: The maximum number of threads that can be used to
 |              execute the given calls.
 |          thread_name_prefix: An optional name prefix to give our threads.
 |          initializer: A callable used to initialize worker threads.
 |          initargs: A tuple of arguments to pass to the initializer.
 |
 |  shutdown(self, wait=True, *, cancel_futures=False)
 |      Clean-up the resources associated with the Executor.
 |
 |      It is safe to call this method several times. Otherwise, no other
 |      methods can be called after this one.
 |
 |      Args:
 |          wait: If True then shutdown will not return until all running
 |              futures have finished executing and the resources used by the
 |              executor have been reclaimed.
 |          cancel_futures: If True then shutdown will cancel all pending
 |              futures. Futures that are completed or running will not be
 |              cancelled.
 |
 |  submit(self, fn, /, *args, **kwargs)
 |      Submits a callable to be executed with the given arguments.
 |
 |      Schedules the callable to be executed as fn(*args, **kwargs) and returns
 |      a Future instance representing the execution of the callable.
 |
 |      Returns:
 |          A Future representing the given call.
 |
 |  ----------------------------------------------------------------------
 |  Methods inherited from concurrent.futures._base.Executor:
 |
 |  __enter__(self)
 |
 |  __exit__(self, exc_type, exc_val, exc_tb)
 |
 |  map(self, fn, *iterables, timeout=None, chunksize=1)
 |      Returns an iterator equivalent to map(fn, iter).
 |
 |      Args:
 |          fn: A callable that will take as many arguments as there are
 |              passed iterables.
 |          timeout: The maximum number of seconds to wait. If None, then there
 |              is no limit on the wait time.
 |          chunksize: The size of the chunks the iterable will be broken into
 |              before being passed to a child process. This argument is only
 |              used by ProcessPoolExecutor; it is ignored by
 |              ThreadPoolExecutor.
 |
 |      Returns:
 |          An iterator equivalent to: map(func, *iterables) but the calls may
 |          be evaluated out-of-order.
 |
 |      Raises:
 |          TimeoutError: If the entire result iterator could not be generated
 |              before the given timeout.
 |          Exception: If fn(*args) raises for any values.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors inherited from concurrent.futures._base.Executor:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.from_thread.TracebackType
Python Library Documentation: class traceback in module builtins

class traceback(object)
 |  TracebackType(tb_next, tb_frame, tb_lasti, tb_lineno)
 |  --
 |
 |  Create a new traceback object.
 |
 |  Methods defined here:
 |
 |  __dir__(...)
 |      Default dir() implementation.
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  tb_frame
 |
 |  tb_lasti
 |
 |  tb_lineno
 |
 |  tb_next
anyio.from_thread.TypeVar
Python Library Documentation: class TypeVar in module typing

class TypeVar(builtins.object)
 |  Type variable.
 |
 |  The preferred way to construct a type variable is via the dedicated
 |  syntax for generic functions, classes, and type aliases::
 |
 |      class Sequence[T]:  # T is a TypeVar
 |          ...
 |
 |  This syntax can also be used to create bound and constrained type
 |  variables::
 |
 |      # S is a TypeVar bound to str
 |      class StrSequence[S: str]:
 |          ...
 |
 |      # A is a TypeVar constrained to str or bytes
 |      class StrOrBytesSequence[A: (str, bytes)]:
 |          ...
 |
 |  However, if desired, reusable type variables can also be constructed
 |  manually, like so::
 |
 |     T = TypeVar('T')  # Can be anything
 |     S = TypeVar('S', bound=str)  # Can be any subtype of str
 |     A = TypeVar('A', str, bytes)  # Must be exactly str or bytes
 |
 |  Type variables exist primarily for the benefit of static type
 |  checkers.  They serve as the parameters for generic types as well
 |  as for generic function and type alias definitions.
 |
 |  The variance of type variables is inferred by type checkers when they
 |  are created through the type parameter syntax and when
 |  ``infer_variance=True`` is passed. Manually created type variables may
 |  be explicitly marked covariant or contravariant by passing
 |  ``covariant=True`` or ``contravariant=True``. By default, manually
 |  created type variables are invariant. See PEP 484 and PEP 695 for more
 |  details.
 |
 |  Methods defined here:
 |
 |  __mro_entries__(...)
 |
 |  __or__(self, value, /)
 |      Return self|value.
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __ror__(self, value, /)
 |      Return value|self.
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __bound__
 |
 |  __constraints__
 |
 |  __contravariant__
 |
 |  __covariant__
 |
 |  __infer_variance__
anyio.from_thread.TypeVarTuple
Python Library Documentation: class TypeVarTuple in module typing

class TypeVarTuple(builtins.object)
 |  Type variable tuple. A specialized form of type variable that enables
 |  variadic generics.
 |
 |  The preferred way to construct a type variable tuple is via the
 |  dedicated syntax for generic functions, classes, and type aliases,
 |  where a single '*' indicates a type variable tuple::
 |
 |      def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, T]:
 |          return (*tup[1:], tup[0])
 |
 |  For compatibility with Python 3.11 and earlier, TypeVarTuple objects
 |  can also be created as follows::
 |
 |      Ts = TypeVarTuple('Ts')  # Can be given any name
 |
 |  Just as a TypeVar (type variable) is a placeholder for a single type,
 |  a TypeVarTuple is a placeholder for an *arbitrary* number of types. For
 |  example, if we define a generic class using a TypeVarTuple::
 |
 |      class C[*Ts]: ...
 |
 |  Then we can parameterize that class with an arbitrary number of type
 |  arguments::
 |
 |      C[int]       # Fine
 |      C[int, str]  # Also fine
 |      C[()]        # Even this is fine
 |
 |  For more details, see PEP 646.
 |
 |  Note that only TypeVarTuples defined in the global scope can be
 |  pickled.
 |
 |  Methods defined here:
 |
 |  __iter__(self, /)
 |      Implement iter(self).
 |
 |  __mro_entries__(...)
 |
 |  __reduce__(self, /)
 |      Helper for pickle.
 |
 |  __repr__(self, /)
 |      Return repr(self).
 |
 |  __typing_prepare_subst__(self, /, alias, args)
 |
 |  __typing_subst__(self, /, arg)
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
anyio.from_thread.Unpack
Python Library Documentation: _SpecialForm in module typing

Unpack = typing.Unpack
    Type unpack operator.

    The type unpack operator takes the child types from some container type,
    such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'.

    For example::

        # For some generic class `Foo`:
        Foo[Unpack[tuple[int, str]]]  # Equivalent to Foo[int, str]

        Ts = TypeVarTuple('Ts')
        # Specifies that `Bar` is generic in an arbitrary number of types.
        # (Think of `Ts` as a tuple of an arbitrary number of individual
        #  `TypeVar`s, which the `Unpack` is 'pulling out' directly into the
        #  `Generic[]`.)
        class Bar(Generic[Unpack[Ts]]): ...
        Bar[int]  # Valid
        Bar[int, str]  # Also valid

    From Python 3.11, this can also be done using the `*` operator::

        Foo[*tuple[int, str]]
        class Bar(Generic[*Ts]): ...

    And from Python 3.12, it can be done using built-in syntax for generics::

        Foo[*tuple[int, str]]
        class Bar[*Ts]: ...

    The operator can also be used along with a `TypedDict` to annotate
    `**kwargs` in a function signature::

        class Movie(TypedDict):
            name: str
            year: int

        # This function expects two keyword arguments - *name* of type `str` and
        # *year* of type `int`.
        def foo(**kwargs: Unpack[Movie]): ...

    Note that there is only some runtime checking of this operator. Not
    everything the runtime allows may be accepted by static type checkers.

    For more information, see PEPs 646 and 692.
anyio.from_thread.annotations
Python Library Documentation: _Feature in module __future__ object

class _Feature(builtins.object)
 |  _Feature(optionalRelease, mandatoryRelease, compiler_flag)
 |
 |  Methods defined here:
 |
 |  __init__(self, optionalRelease, mandatoryRelease, compiler_flag)
 |      Initialize self.  See help(type(self)) for accurate signature.
 |
 |  __repr__(self)
 |      Return repr(self).
 |
 |  getMandatoryRelease(self)
 |      Return release in which this feature will become mandatory.
 |
 |      This is a 5-tuple, of the same form as sys.version_info, or, if
 |      the feature was dropped, or the release date is undetermined, is None.
 |
 |  getOptionalRelease(self)
 |      Return first release in which this feature was recognized.
 |
 |      This is a 5-tuple, of the same form as sys.version_info.
 |
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |
 |  __dict__
 |      dictionary for instance variables
 |
 |  __weakref__
 |      list of weak references to the object
anyio.from_thread.cast
Python Library Documentation: function cast in module typing

cast(typ, val)
    Cast a value to a type.

    This returns the value unchanged.  To the type checker this
    signals that the return value has the designated type, but at
    runtime we intentionally don't check anything (we want this
    to be as fast as possible).
anyio.from_thread.check_cancelled
Python Library Documentation: function check_cancelled in module anyio.from_thread

check_cancelled() -> 'None'
    Check if the cancel scope of the host task's running the current worker thread has
    been cancelled.

    If the host task's current cancel scope has indeed been cancelled, the
    backend-specific cancellation exception will be raised.

    :raises RuntimeError: if the current thread was not spawned by
        :func:`.to_thread.run_sync`
anyio.from_thread.contextmanager
Python Library Documentation: function contextmanager in module contextlib

contextmanager(func)
    @contextmanager decorator.

    Typical usage:

        @contextmanager
        def some_generator(<arguments>):
            <setup>
            try:
                yield <value>
            finally:
                <cleanup>

    This makes this:

        with some_generator(<arguments>) as <variable>:
            <body>

    equivalent to this:

        <setup>
        try:
            <variable> = <value>
            <body>
        finally:
            <cleanup>
anyio.from_thread.create_task_group
Python Library Documentation: function create_task_group in module anyio

create_task_group() -> 'TaskGroup'
    Create a task group.

    :return: a task group
anyio.from_thread.dataclass
Python Library Documentation: function dataclass in module dataclasses

dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False, weakref_slot=False)
    Add dunder methods based on the fields defined in the class.

    Examines PEP 526 __annotations__ to determine fields.

    If init is true, an __init__() method is added to the class. If repr
    is true, a __repr__() method is added. If order is true, rich
    comparison dunder methods are added. If unsafe_hash is true, a
    __hash__() method is added. If frozen is true, fields may not be
    assigned to after instance creation. If match_args is true, the
    __match_args__ tuple is added. If kw_only is true, then by default
    all fields are keyword-only. If slots is true, a new class with a
    __slots__ attribute is returned.
anyio.from_thread.field
Python Library Documentation: function field in module dataclasses

field(*, default=<dataclasses._MISSING_TYPE object at 0x000001D979D468A0>, default_factory=<dataclasses._MISSING_TYPE object at 0x000001D979D468A0>, init=True, repr=True, hash=None, compare=True, metadata=None, kw_only=<dataclasses._MISSING_TYPE object at 0x000001D979D468A0>)
    Return an object to identify dataclass fields.

    default is the default value of the field.  default_factory is a
    0-argument function called to initialize a field's value.  If init
    is true, the field will be a parameter to the class's __init__()
    function.  If repr is true, the field will be included in the
    object's repr().  If hash is true, the field will be included in the
    object's hash().  If compare is true, the field will be used in
    comparison functions.  metadata, if specified, must be a mapping
    which is stored but not otherwise examined by dataclass.  If kw_only
    is true, the field will become a keyword-only parameter to
    __init__().

    It is an error to specify both default and default_factory.
anyio.from_thread.get_async_backend
Python Library Documentation: function get_async_backend in module anyio._core._eventloop

get_async_backend(asynclib_name: 'str | None' = None) -> 'type[AsyncBackend]'
anyio.from_thread.get_cancelled_exc_class
Python Library Documentation: function get_cancelled_exc_class in module anyio

get_cancelled_exc_class() -> 'type[BaseException]'
    Return the current async library's cancellation exception class.
anyio.from_thread.isawaitable
Python Library Documentation: function isawaitable in module inspect

isawaitable(object)
    Return true if object can be passed to an ``await`` expression.
anyio.from_thread.overload
Python Library Documentation: function overload in module typing

overload(func)
    Decorator for overloaded functions/methods.

    In a stub file, place two or more stub definitions for the same
    function in a row, each decorated with @overload.

    For example::

        @overload
        def utf8(value: None) -> None: ...
        @overload
        def utf8(value: bytes) -> bytes: ...
        @overload
        def utf8(value: str) -> bytes: ...

    In a non-stub file (i.e. a regular .py file), do the same but
    follow it with an implementation.  The implementation should *not*
    be decorated with @overload::

        @overload
        def utf8(value: None) -> None: ...
        @overload
        def utf8(value: bytes) -> bytes: ...
        @overload
        def utf8(value: str) -> bytes: ...
        def utf8(value):
            ...  # implementation goes here

    The overloads for a function can be retrieved at runtime using the
    get_overloads() function.
anyio.from_thread.run
Python Library Documentation: function run in module anyio.from_thread

run(func: 'Callable[[Unpack[PosArgsT]], Awaitable[T_Retval]]', *args: 'Unpack[PosArgsT]') -> 'T_Retval'
    Call a coroutine function from a worker thread.

    :param func: a coroutine function
    :param args: positional arguments for the callable
    :return: the return value of the coroutine function
anyio.from_thread.run_sync
Python Library Documentation: function run_sync in module anyio.from_thread

run_sync(func: 'Callable[[Unpack[PosArgsT]], T_Retval]', *args: 'Unpack[PosArgsT]') -> 'T_Retval'
    Call a function in the event loop thread from a worker thread.

    :param func: a callable
    :param args: positional arguments for the callable
    :return: the return value of the callable
anyio.from_thread.start_blocking_portal
Python Library Documentation: function start_blocking_portal in module anyio.from_thread

start_blocking_portal(backend: 'str' = 'asyncio', backend_options: 'dict[str, Any] | None' = None) -> 'Generator[BlockingPortal, Any, None]'
    Start a new event loop in a new thread and run a blocking portal in its main task.

    The parameters are the same as for :func:`~anyio.run`.

    :param backend: name of the backend
    :param backend_options: backend options
    :return: a context manager that yields a blocking portal

    .. versionchanged:: 3.0
        Usage as a context manager is now required.
anyio.from_thread.threadlocals
Python Library Documentation: _local in module _thread object

class _local(builtins.object)
 |  Thread-local data
 |
 |  Methods defined here:
 |
 |  __delattr__(self, name, /)
 |      Implement delattr(self, name).
 |
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |
 |  __setattr__(self, name, value, /)
 |      Implement setattr(self, name, value).
 |
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |
 |  __new__(*args, **kwargs)
 |      Create and return a new object.  See help(type) for accurate signature.
anyio.from_thread.wait
Python Library Documentation: function wait in module concurrent.futures._base

wait(fs, timeout=None, return_when='ALL_COMPLETED')
    Wait for the futures in the given sequence to complete.

    Args:
        fs: The sequence of Futures (possibly created by different Executors) to
            wait upon.
        timeout: The maximum number of seconds to wait. If None, then there
            is no limit on the wait time.
        return_when: Indicates when this function should return. The options
            are:

            FIRST_COMPLETED - Return when any future finishes or is
                              cancelled.
            FIRST_EXCEPTION - Return when any future finishes by raising an
                              exception. If no future raises an exception
                              then it is equivalent to ALL_COMPLETED.
            ALL_COMPLETED -   Return when all futures finish or are cancelled.

    Returns:
        A named 2-tuple of sets. The first set, named 'done', contains the
        futures that completed (is finished or cancelled) before the wait
        completed. The second set, named 'not_done', contains uncompleted
        futures. Duplicate futures given to *fs* are removed and will be
        returned only once.