Pubsub system for aio framework
Project description
aio.signals
===========
Pubsub system for the aio_ asyncio framework
.. _aio: https://github.com/phlax/aio
----
Build status
------------
.. image:: https://travis-ci.org/phlax/aio.signals.svg?branch=master
:target: https://travis-ci.org/phlax/aio.signals
----
Installation
------------
Install with:
.. code:: bash
pip install aio.signals
----
Code example
------------
.. code:: python
The callback listener takes 2 arguments, the name of the signal, and the argument that was emitted
The listen function is called synchronously, but the callback listener should be a coroutine or future
The emit function is a coroutine
.. code:: python
import asyncio
from aio.signals import Signals
@asyncio.coroutine
def listener(signal, message):
print(message)
signals = Signals()
signals.listen("my-signal", listener)
loop = asyncio.get_event_loop()
loop.run_until_complete(
signals.emit("my-signal", 'BOOM!'))
===========
Pubsub system for the aio_ asyncio framework
.. _aio: https://github.com/phlax/aio
----
Build status
------------
.. image:: https://travis-ci.org/phlax/aio.signals.svg?branch=master
:target: https://travis-ci.org/phlax/aio.signals
----
Installation
------------
Install with:
.. code:: bash
pip install aio.signals
----
Code example
------------
.. code:: python
The callback listener takes 2 arguments, the name of the signal, and the argument that was emitted
The listen function is called synchronously, but the callback listener should be a coroutine or future
The emit function is a coroutine
.. code:: python
import asyncio
from aio.signals import Signals
@asyncio.coroutine
def listener(signal, message):
print(message)
signals = Signals()
signals.listen("my-signal", listener)
loop = asyncio.get_event_loop()
loop.run_until_complete(
signals.emit("my-signal", 'BOOM!'))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aio.signals-0.0.1.tar.gz
(2.9 kB
view details)
File details
Details for the file aio.signals-0.0.1.tar.gz
.
File metadata
- Download URL: aio.signals-0.0.1.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68c47d00bd04dc6de9a3204800bbfab9f7a98ce9859e3e72ef3e241ff2868d38 |
|
MD5 | bfaa9265e192eaca677d2821fd8d6138 |
|
BLAKE2b-256 | 559bf7c15a853fb4f358cce3afdcf207013357cd7a6f184d20a1787db63e4dc8 |