<commit_before>.. image:: https://img.shields.io/travis/numberoverzero/accordian/master.svg?style=flat-square
    :target: https://travis-ci.org/numberoverzero/accordian
.. image:: https://img.shields.io/coveralls/numberoverzero/accordian/master.svg?style=flat-square
    :target: https://coveralls.io/github/numberoverzero/accordian

Downloads https://pypi.python.org/pypi/accordian

Source https://github.com/numberoverzero/accordian

Event dispatch in Python 3.5 using asyncio

Installation
------------

``pip install accordian``

Getting Started
---------------
::

    import asyncio
    import accordian
    import random

    loop = asyncio.new_event_loop()

    dispatch = accordian.Dispatch(loop=loop)
    dispatch.register("my_event", ["id", "value"])


    @dispatch.on("my_event")
    async def handle(id, value):
        sleep = 5.0 * random.random()
        print("Handling `my_event(id={})` in {} seconds.".format(id, sleep))
        await asyncio.sleep(sleep, loop=loop)
        print("`Completed my_event(id={})`!".format(id))


    ids = range(4)
    values = [random.random() for _ in ids]
    for id, value in zip(ids, values):
        params = {"id": id, "value": value}
        dispatch.trigger("my_event", params)

    loop.create_task(dispatch.start())
    loop.run_until_complete(asyncio.sleep(0.01, loop=loop))
    loop.run_until_complete(dispatch.stop())


Contributing
------------

Contributions welcome!  Please make sure `tox` passes (including flake8) before submitting a PR.

Development
-----------

accordian uses `tox`, `pytest` and `flake8`.  To get everything set up::

    # RECOMMENDED: create a virtualenv with:
    #     mkvirtualenv accordian
    git clone https://github.com/numberoverzero/accordian.git
    pip install tox
    tox
<commit_msg>Move README downloads, source to badges<commit_after>.. image:: https://img.shields.io/travis/numberoverzero/accordian/master.svg?style=flat-square
    :target: https://travis-ci.org/numberoverzero/accordian
.. image:: https://img.shields.io/coveralls/numberoverzero/accordian/master.svg?style=flat-square
    :target: https://coveralls.io/github/numberoverzero/accordian
.. image:: https://img.shields.io/pypi/v/accordian.svg?style=flat-square
    :target: https://pypi.python.org/pypi/accordian
.. image:: https://img.shields.io/github/issues-raw/numberoverzero/accordian.svg?style=flat-square
    :target: https://github.com/numberoverzero/accordian/issues


Event dispatch in Python 3.5 using asyncio

Installation
------------

``pip install accordian``

Getting Started
---------------
::

    import asyncio
    import accordian
    import random

    loop = asyncio.new_event_loop()

    dispatch = accordian.Dispatch(loop=loop)
    dispatch.register("my_event", ["id", "value"])


    @dispatch.on("my_event")
    async def handle(id, value):
        sleep = 5.0 * random.random()
        print("Handling `my_event(id={})` in {} seconds.".format(id, sleep))
        await asyncio.sleep(sleep, loop=loop)
        print("`Completed my_event(id={})`!".format(id))


    ids = range(4)
    values = [random.random() for _ in ids]
    for id, value in zip(ids, values):
        params = {"id": id, "value": value}
        dispatch.trigger("my_event", params)

    loop.create_task(dispatch.start())
    loop.run_until_complete(asyncio.sleep(0.01, loop=loop))
    loop.run_until_complete(dispatch.stop())


Contributing
------------

Contributions welcome!  Please make sure `tox` passes (including flake8) before submitting a PR.

Development
-----------

accordian uses `tox`, `pytest` and `flake8`.  To get everything set up::

    # RECOMMENDED: create a virtualenv with:
    #     mkvirtualenv accordian
    git clone https://github.com/numberoverzero/accordian.git
    pip install tox
    tox

{'fraction_non_alphanumeric': 0.15774202057504616, 'fraction_numerical': 0.005275652862041678, 'mean_word_length': 3.2799097065462752, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 16, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1289842', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1184, 'n_words': 251}