asyncutils._internal.helpers¶
Miscellaneous helper routines for asyncutils submodules that are not meant to be called by the user.
Classes¶
A thin dictionary subclass that supports attribute access, setting and deleting. |
|
The base class for |
Functions¶
|
Check if two objects are equal without calling the |
|
Re-implement |
Return the callable itself if the argument is callable, and return its type otherwise. |
|
|
Copy the given object, clear it, and return the copy. |
|
Return an |
|
Yield items in the positional arguments not identical to the sentinel |
|
Return the fully-qualified name of the given object, including its module, optionally removing the |
|
Return the running event loop. If there is none, create and set one first. |
|
Whether the given object is a module, or an |
|
Return a coroutine wrapping the given awaitable. Use |
|
Add a |
Module Contents¶
- class asyncutils._internal.helpers.Bag[T][source]¶
-
A thin dictionary subclass that supports attribute access, setting and deleting.
Initialize self. See help(type(self)) for accurate signature.
- class asyncutils._internal.helpers.LoopMixinBase[source]¶
The base class for
LoopContextMixin.- make[T](aw: collections.abc.Awaitable[T], /) asyncio.Task[T][source]¶
Create a
Taskfor the given awaitable that runs in the underlying loop.
- make_fut() asyncio.Future[Any][source]¶
Create a
Futureattached to the underlying loop.
- make_multiple[T](aws: collections.abc.Iterable[collections.abc.Awaitable[T]], /) types.GeneratorType[asyncio.Task[T]][source]¶
Return an iterator over instances of
Taskcreated for each coroutine in C, in that order.
- property loop: asyncio.AbstractEventLoop¶
The underlying event loop.
- asyncutils._internal.helpers.check(candidate: object, against: object, /) bool[source]¶
Check if two objects are equal without calling the
__eq__()method of the candidate, such that it cannot falsely claim equality.
- asyncutils._internal.helpers.check_methods(obj: object, /, *meth: str) bool[source]¶
Re-implement
collections.abc._check_methods().
- asyncutils._internal.helpers.coerce_callable[T: collections.abc.Callable[Ellipsis, Any]](f: T, /) T[source]¶
- asyncutils._internal.helpers.coerce_callable(o: T, /) type[T]
Return the callable itself if the argument is callable, and return its type otherwise.
- asyncutils._internal.helpers.copy_and_clear[T: asyncutils._internal.prots.CanClearAndCopy[Any]](l: T) T[source]¶
Copy the given object, clear it, and return the copy.
- asyncutils._internal.helpers.create_executor(obj: object, /, save: bool = ...) asyncutils.config.Executor[source]¶
Return an
Executorinstance for the given object, creating one if necessary, and saving it on the object as theexecutorattribute ifsave=Falsewas not passed.
- asyncutils._internal.helpers.filter_out(*a: object, s: object = ...) types.GeneratorType[Any][source]¶
Yield items in the positional arguments not identical to the sentinel
s, orNoneby default.
- asyncutils._internal.helpers.fullname(f: object, /, remove_prefix: bool = ...) str[source]¶
Return the fully-qualified name of the given object, including its module, optionally removing the
'asyncutils'prefix.
- asyncutils._internal.helpers.get_loop_and_set() asyncio.AbstractEventLoop[source]¶
Return the running event loop. If there is none, create and set one first.
- asyncutils._internal.helpers.ismodule(o: object, /) TypeIs[types.ModuleType][source]¶
Whether the given object is a module, or an
asyncutils-internal submodule object.
- async asyncutils._internal.helpers.simple_wrap[T](aw: collections.abc.Awaitable[T], /) T[source]¶
Return a coroutine wrapping the given awaitable. Use
wrap_in_coro()instead for better error handling.
- asyncutils._internal.helpers.subscriptable[T](cls: type[T], /) asyncutils._internal.prots.Subscriptable[T][source]¶
Add a
__class_getitem__()method to the given class, raisingTypeErrorif it is already present.