A python library providing a useful abstraction for recording state transitions, compressing them, and distributing to multiple listeners.
The :class:`Succession` class provides a way to reduce long chains of updates
down to a reduced chain with the same effect.
For example, assume that you only care about the sum of the numbers pushed to a
succession, and that it's fine to replace all of the numbers from before you started
listening with the current total. You can do something like the following:
>>> succession = Succession(compress=lambda items: [sum(items)])
<succession.Succession object at 0x7f5a65a10518>
>>> from_start = succession.iter()
>>> for i in [1, 2, 3, 4, 5]:
>>> from_end = succession.iter()
[1, 2, 3, 4, 5])
Iterators forked earlier will not miss any transitions added from the time they
were created. Compression is only applied to transitions before the fork.
Recommended method is to use the version from `pypi`_
pip install succession
- Source code: https://github.com/bwhmather/succession
- Issue tracker: https://github.com/bwhmather/succession/issues
- Continuous integration: https://travis-ci.org/bwhmather/succession
- PyPI: https://pypi.python.org/pypi/succession
The project is licensed under the BSD license. See `LICENSE`_ for details.
.. |build-status| image:: https://travis-ci.org/bwhmather/succession.png?branch=develop
:alt: Build Status
.. |coverage| image:: https://coveralls.io/repos/bwhmather/succession/badge.png?branch=develop
.. _pypi: https://pypi.python.org/pypi/sucession
.. _LICENSE: ./LICENSE
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.