========
Overview
========
``asyncio.Queue`` with history::
Objects put on a ``HistoryQueue`` are gathered in tuples,
with the first element being the next item on the queue,
followed by items add previously.
``HistoryQueue`` can also be thought of as as asynchronous ``collections.deque``,
with ``put`` analogous to ``deque.appendleft``
and ``get`` returning the entire deque (as a tuple).
>>> from hqueue import HistoryQueue
>>> hq = HistoryQueue(history_size=2)
>>> hq.put_nowait(0)
>>> hq.put_nowait(1)
>>> hq.get_nowait()
(0,)
>>> hq.get_nowait()
(1, 0)
>>> hq.put_nowait(2)
>>> hq.put_nowait(3)
>>> hq.put_nowait(4)
>>> hq.get_nowait()
(2, 1, 0)
>>> hq.get_nowait()
(3, 2, 1)
For ease of illustration, in the above examples we use ``put_nowait`` and ``get_nowait``,
the synchronous counterparts of ``put`` and ``wait``, respectively.
In a coroutine, ``await put()`` could be used to block until the queue is not full,
and ``await get()`` to block until there is an item in the queue.
See Also
--------
``asyncio.Queue``
``collections.deque``
Changelog
=========
0.1.0 (2016-06-28)
------------------
* First prototype.
0.2.0 (2016-07-01)
------------------
* First release on PyPI.
Overview
========
``asyncio.Queue`` with history::
Objects put on a ``HistoryQueue`` are gathered in tuples,
with the first element being the next item on the queue,
followed by items add previously.
``HistoryQueue`` can also be thought of as as asynchronous ``collections.deque``,
with ``put`` analogous to ``deque.appendleft``
and ``get`` returning the entire deque (as a tuple).
>>> from hqueue import HistoryQueue
>>> hq = HistoryQueue(history_size=2)
>>> hq.put_nowait(0)
>>> hq.put_nowait(1)
>>> hq.get_nowait()
(0,)
>>> hq.get_nowait()
(1, 0)
>>> hq.put_nowait(2)
>>> hq.put_nowait(3)
>>> hq.put_nowait(4)
>>> hq.get_nowait()
(2, 1, 0)
>>> hq.get_nowait()
(3, 2, 1)
For ease of illustration, in the above examples we use ``put_nowait`` and ``get_nowait``,
the synchronous counterparts of ``put`` and ``wait``, respectively.
In a coroutine, ``await put()`` could be used to block until the queue is not full,
and ``await get()`` to block until there is an item in the queue.
See Also
--------
``asyncio.Queue``
``collections.deque``
Changelog
=========
0.1.0 (2016-06-28)
------------------
* First prototype.
0.2.0 (2016-07-01)
------------------
* First release on PyPI.
Metadata
Release files for hqueue 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hqueue-0.2.0.tar.gz | 12.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hqueue-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.7 kB
Release files / hqueue-0.2.0.tar.gz
| Download URL | hqueue-0.2.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39e7cb66d39672b0c1fb2f306d89badeba656f99f81efaad50dac0a31ea4efc9
|
|
BLAKE2b-256 checksum How to use checksums |
5bde9ae69d544e51e932eecf9b36ac3a15ecdd9f428b03b5d48d8560ee9f5278
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / hqueue-0.2.0-py3-none-any.whl
| Download URL | hqueue-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06004af167c5b66e6684330fcf65f74d56be43f71099df85ef80199a2ce8cca1
|
|
BLAKE2b-256 checksum How to use checksums |
95308c8fa3669624275273ea491ff06cf7e4aa161e6cc48c60b9cad0e369579f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |