asyncio_taskpool.queue_context module

Definition of a asyncio.Queue subclass with some small additions.

class asyncio_taskpool.queue_context.Queue(maxsize=0, *, loop=None)

Bases: Queue

Adds a little syntactic sugar to the asyncio.Queue.

Allows being used as an async context manager awaiting get upon entering the context and calling item_processed() upon exiting it.

item_processed() None

Does exactly the same as asyncio.Queue.task_done().

This method exists because task_done is an atrocious name for the method. It communicates the wrong thing, invites confusion, and immensely reduces readability (in the context of this library). And readability counts.