{ "info": { "author": "Mike Lenzen", "author_email": "lenzenmi@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries" ], "description": "README\r\n======\r\n.. image:: https://travis-ci.org/lenzenmi/asyncio_dispatch.svg?branch=master\r\n :target: https://travis-ci.org/lenzenmi/asyncio_dispatch\r\n\r\n.. image:: https://readthedocs.org/projects/asyncio-dispatch/badge/?version=latest\r\n :target: http://asyncio-dispatch.readthedocs.org/en/latest/?badge=latest\r\n :alt: Documentation Status\r\n\r\n.. image:: https://coveralls.io/repos/lenzenmi/asyncio_dispatch/badge.svg?branch=master&service=github \r\n :target: https://coveralls.io/github/lenzenmi/asyncio_dispatch?branch=master \r\n\r\n\r\n\r\n``asyncio_dispatch`` is a is a signal dispatcher for the ``asyncio`` event loop found in Python versions 3.4 and up.\r\n\r\nCheck out the `official documentation `_\r\n\r\nSynopsis\r\n--------\r\n\r\nMany callbacks can be connected to a Signal. When the Signal is triggered using its ``send()`` method, all connected callbacks will be scheduled for asynchronous execution.\r\n\r\nConnections can optionally be made with two types of filters, ``senders`` and ``keys``. If filters are used, the callback is only scheduled for execution if the Signal is sent with at least one matching ``sender`` or ``key``. A ``sender`` can be any object, while a ``key`` is more likely to be a ``string``. Under the hood, they use ``id()`` and ``hash()`` respectively.\r\n\r\nCallbacks are invoked with keyword arguments that allow the callback to determine which Signal is calling it and which ``senders`` and ``keys`` were specified. Additional keyword arguments can be added to the Signal when it is instantiated, and their default values can be replaced when the Signal is sent.\r\n\r\nExample\r\n-------\r\n\r\n.. code:: python\r\n\r\n import asyncio\r\n from asyncio_dispatch import Signal\r\n \r\n \r\n @asyncio.coroutine\r\n def callback(**kwargs):\r\n print('callback was called!')\r\n \r\n \r\n loop = asyncio.get_event_loop()\r\n \r\n # create the signal\r\n signal = Signal(loop=loop)\r\n \r\n # connect the callback to the Signal - This is a coroutine!\r\n loop.run_until_complete(loop.create_task(signal.connect(callback)))\r\n \r\n # send the signal - This is also a coroutine!\r\n print('sending the signal.')\r\n loop.run_until_complete(loop.create_task(signal.send()))\r\n \r\n \r\nThe above example will print the following:\r\n\r\n.. code:: bash\r\n\r\n sending the signal.\r\n callback was called!\r\n \r\nFeatures\r\n--------\r\n\r\n* Supports the new async/await syntax found in python 3.5 and up\r\n* Callbacks can be a function, asyncio.coroutine, async def, class method, @staticmethod, or @classmethod\r\n* Multiple callbacks can be connected to the same signal\r\n* Callbacks can be called with additional keyword arguments containing references to arbitrary objects\r\n* Callbacks can be disconnected from a signal\r\n* Signals can hold weak or strong references to callbacks, allowing for automatic disconnection if a reference to a callback is not maintained, or conversely to persist one-off ``lambda`` expressions without needing to maintain a reference\r\n* Callbacks receive the ``Signal`` object that was used to schedule it, so multiple signals can be attached to the same callback and handled differently\r\n* Callbacks can be connected with ``senders`` or ``keys`` which cause the Signal to ignore the callback unless the signal is sent with a matching *Object* or *str* \r\n\r\nLicense\r\n-------\r\n\r\nReleased under the MIT license.\r\n\r\nInstallation\r\n------------\r\n.. code:: bash\r\n \r\n pip install asyncio_dispatch", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lenzenmi/asyncio_dispatch/", "keywords": "asyncio_dispatch asyncio dispatch signal event", "license": "UNKNOWN", "maintainer": "", "maintainer_email": "", "name": "asyncio_dispatch", "package_url": "https://pypi.org/project/asyncio_dispatch/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/asyncio_dispatch/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/lenzenmi/asyncio_dispatch/" }, "release_url": "https://pypi.org/project/asyncio_dispatch/1.1.0/", "requires_dist": null, "requires_python": null, "summary": "asyncio_dispatch is a is a signal dispatcher for the asyncio event loop found in Python versions 3.4 and up.", "version": "1.1.0" }, "last_serial": 1812854, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "958f3cb511ef154716e1b193c7ee3d01", "sha256": "7e3860ad2efed6af4fd185ab0153485b4a239c15bfd053316e0586e4812a3f66" }, "downloads": -1, "filename": "asyncio_dispatch-1.0.0.tar.gz", "has_sig": false, "md5_digest": "958f3cb511ef154716e1b193c7ee3d01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5273, "upload_time": "2015-10-03T07:11:07", "url": "https://files.pythonhosted.org/packages/4b/90/939fea7de2a683054676954fc46bf66ef7a86c2a7e1899c5705e7db8c58f/asyncio_dispatch-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "4a20d776ea3728d74f896b8f390ca813", "sha256": "49c49fd0140d7bc83d1b4f831e4f4473e70126ec55952c85f6d3b9428816e7ca" }, "downloads": -1, "filename": "asyncio_dispatch-1.0.1.tar.gz", "has_sig": false, "md5_digest": "4a20d776ea3728d74f896b8f390ca813", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5290, "upload_time": "2015-10-04T11:19:04", "url": "https://files.pythonhosted.org/packages/df/49/04fde4496ed239ad47e9430e23be36620550975358a7f64b58e940ac76c9/asyncio_dispatch-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "fb8188b7170d61830101db1a1138b04c", "sha256": "997519deb233a2986aad2d151814e3ea53634845f682589dfdbb612462c75c36" }, "downloads": -1, "filename": "asyncio_dispatch-1.1.0.tar.gz", "has_sig": false, "md5_digest": "fb8188b7170d61830101db1a1138b04c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5754, "upload_time": "2015-10-05T13:06:04", "url": "https://files.pythonhosted.org/packages/42/ab/231c8ac5f58b400ebdcf1684499777bf928ebbf5aeaaf69eaf7a6043f643/asyncio_dispatch-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fb8188b7170d61830101db1a1138b04c", "sha256": "997519deb233a2986aad2d151814e3ea53634845f682589dfdbb612462c75c36" }, "downloads": -1, "filename": "asyncio_dispatch-1.1.0.tar.gz", "has_sig": false, "md5_digest": "fb8188b7170d61830101db1a1138b04c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5754, "upload_time": "2015-10-05T13:06:04", "url": "https://files.pythonhosted.org/packages/42/ab/231c8ac5f58b400ebdcf1684499777bf928ebbf5aeaaf69eaf7a6043f643/asyncio_dispatch-1.1.0.tar.gz" } ] }