Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

asyncio.Queue with history

Project Description

========
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.

Release History

This version
History Node

0.2.0

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
hqueue-0.2.0-py3-none-any.whl
(5.3 kB) Copy SHA256 Hash SHA256
Wheel py3 Jul 1, 2016
hqueue-0.2.0.tar.gz
(12.4 kB) Copy SHA256 Hash SHA256
Source None Jul 1, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting