asyncutils.properties#
Asynchronous descriptors, mimicking property and optionally applying a lock.
Classes#
A property with asynchronous getters, setters and deleters running synchronously via event loop scheduling. |
|
A property with asynchronous getters, setters and deleters running synchronously via event loop scheduling. |
|
Interpret any callable as a regular function in a class body so that access on instance returns something like a bound method. |
Module Contents#
- class asyncutils.properties.AsyncLockProperty[T, R: _collections_abc.Hashable][source]#
Bases:
AsyncProperty[T,R]A property with asynchronous getters, setters and deleters running synchronously via event loop scheduling.
- static _new_lock[L: asyncutils._internal.types.AsyncLockLike[Any]](_: R, *, lock_impl: type[L]) L[source]#
- static _new_lock(_: R) asyncio.locks.Lock
Default way to create a new lock for the given object. The implementation should not cache the locks for each instance, since that is done by this class already.
- get_lock(obj: R) asyncutils._internal.types.AsyncLockLike[Any][source]#
Get the lock for the given object, applying a cache that unfortunately requires the object to be hashable and weakly referencable.
- class asyncutils.properties.AsyncProperty[T, R][source]#
A property with asynchronous getters, setters and deleters running synchronously via event loop scheduling.
- __get__(instance: R, owner: type[R] | None = ..., /) Self | T[source]#
- __get__(instance: None, owner: type, /) Self
- deleter(fdel: _collections_abc.Callable[[R], _collections_abc.Awaitable[None]], /) Self[source]#
Return another async property with the given function as the deleter.
- getter(fget: _collections_abc.Callable[[R], _collections_abc.Awaitable[T]], /) Self[source]#
Return another async property with the given function as the getter.
- setter(fset: _collections_abc.Callable[[R, T], _collections_abc.Awaitable[None]], /) Self[source]#
Return another async property with the given function as the setter.
- property fdel: _collections_abc.Callable[[R], _collections_abc.Awaitable[None]] | None#
The deleter function for this property, or
Noneif it doesn’t exist.
- class asyncutils.properties.coercedmethod[T, R, **P](func: _collections_abc.Callable[Concatenate[R, P], T], /)[source]#
Interpret any callable as a regular function in a class body so that access on instance returns something like a bound method.