{ "info": { "author": "Etienne Tissieres", "author_email": "etienne.tissieres@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved", "Natural Language :: French", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "PyEventEmitter\n==============\n\nPython events library, heavily inspired by Node.js' EventEmitter.\n\nInstallation\n============\n\n::\n\n $ pip install PyEventEmitter\n\nHow to use\n==========\n\nThe library provides an EventEmitter class. This class let you bind\nlisteners to events and trigger events.\n\n.. code:: python\n\n import event_emitter as events\n\n em = events.EventEmitter()\n\n def hello(who):\n print('Hello {}'.format(who))\n\n em.on('hello', hello)\n em.emit('hello', who='World') # prints Hello World\n\nYou can also use ``on`` decorator :\n\n.. code:: python\n\n import event_emitter as events\n\n em = events.EventEmitter()\n\n @events.on(emitter=em, event='hello')\n def hello(who):\n print('Hello {}'.format(who))\n\n em.emit('hello', who='World') # prints Hello World\n\nUsing ``once`` instead of ``on`` may be usefull if you want your\nlistener to be called once :\n\n.. code:: python\n\n import event_emitter as events\n\n em = events.EventEmitter()\n\n def hello(who):\n print('Hello {}'.format(who))\n\n em.once('hello', hello)\n em.emit('hello', who='World') # prints Hello World\n em.emit('hello', who='World') # nothing happens\n\nOf course, there is also a decorator for this :\n\n.. code:: python\n\n import event_emitter as events\n\n em = events.EventEmitter()\n\n @events.once(emitter=em, event='hello')\n def hello(who):\n print('Hello {}'.format(who))\n\n em.emit('hello', who='World') # prints Hello World\n\nYou can remove a listener bound to an event :\n\n.. code:: python\n\n import event_emitter as events\n\n em = events.EventEmitter()\n\n def hello(who):\n print('Hello {}'.format(who))\n\n em.on('hello', hello)\n em.remove('hello', hello)\n em.emit('hello', who='World') # nothing happens\n\nPlease note that this method will remove at moste one listener from the list.\nIf the same listener was bound multiple times to the event, this method has to\nbe invoked multiple times to remove all the occurences.\n\nYou can also remove all listeners bound to an event thanks to\n``remove_all``.\n\nThe ``count`` method returns the number of listeners bound to an event :\n\n.. code:: python\n\n import event_emitter as events\n\n em = events.EventEmitter()\n\n def hello(who):\n print('Hello {}'.format(who))\n\n em.on('hello', hello)\n print(em.count('hello')) # prints 1", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/etissieres/PyEventEmitter", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "PyEventEmitter", "package_url": "https://pypi.org/project/PyEventEmitter/", "platform": "", "project_url": "https://pypi.org/project/PyEventEmitter/", "project_urls": { "Homepage": "https://github.com/etissieres/PyEventEmitter" }, "release_url": "https://pypi.org/project/PyEventEmitter/1.0.5/", "requires_dist": null, "requires_python": "", "summary": "Simple python events library", "version": "1.0.5" }, "last_serial": 4273413, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "04e876dc34fa7cae7085a51768b5d378", "sha256": "e1db85d02f70cc5cfd1c0bc455fff265386e0273ca336357fd2ef2bfb20447bb" }, "downloads": -1, "filename": "PyEventEmitter-0.1.3.tar.gz", "has_sig": false, "md5_digest": "04e876dc34fa7cae7085a51768b5d378", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1856, "upload_time": "2014-02-27T19:35:15", "url": "https://files.pythonhosted.org/packages/66/4a/5f514f4c7cb13f61e36d7115a4158c7cccdcfa3083c3fee2f65144a5da8e/PyEventEmitter-0.1.3.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "22e1eda07201d72f93b7b8d16d105ca4", "sha256": "93c32f02fde70c5ae72959bec8719f4f0dc49e2de9fb33fa2259811c00dd5ba8" }, "downloads": -1, "filename": "PyEventEmitter-1.0.0.tar.gz", "has_sig": false, "md5_digest": "22e1eda07201d72f93b7b8d16d105ca4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1846, "upload_time": "2014-09-12T18:31:24", "url": "https://files.pythonhosted.org/packages/19/79/b26a5466e79c44f0f6f7c03056b53c2de3cf497d114605981c2365fbba29/PyEventEmitter-1.0.0.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "35afd0ef0ea30c32416a2c412b77f17a", "sha256": "aeef2557184e9db285e06660055ab2eaa13288b97018db8ea57a55a705659a23" }, "downloads": -1, "filename": "PyEventEmitter-1.0.2.tar.gz", "has_sig": false, "md5_digest": "35afd0ef0ea30c32416a2c412b77f17a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1905, "upload_time": "2014-09-21T11:11:52", "url": "https://files.pythonhosted.org/packages/c8/69/c31e465560321ce4856878249b78a4bff0dfd4d174e26b83be43967e7b2a/PyEventEmitter-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "ad4640607e321f1d71201e40b96628fa", "sha256": "5f19623346c028b1a24bba85a97194de2d946bd7399a921ede5815891e033810" }, "downloads": -1, "filename": "PyEventEmitter-1.0.3.tar.gz", "has_sig": false, "md5_digest": "ad4640607e321f1d71201e40b96628fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1891, "upload_time": "2016-02-26T14:04:30", "url": "https://files.pythonhosted.org/packages/5e/69/01af8b0a54a900641698809938f08a04724de43b33b339b7b088eac8cb1e/PyEventEmitter-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "f652090bdae283c47d4e6640fc2db206", "sha256": "c1a6f19290523959fa9e118ff57bfc6217656233b5cc825ee703aecb7bf9eab5" }, "downloads": -1, "filename": "PyEventEmitter-1.0.4.tar.gz", "has_sig": false, "md5_digest": "f652090bdae283c47d4e6640fc2db206", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1931, "upload_time": "2017-06-04T22:27:38", "url": "https://files.pythonhosted.org/packages/fa/de/4511ed3a6c8685a14d0dc14ad7fcfe1e4ab01917e5b27f63a7563d0acb78/PyEventEmitter-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "7ebd55edc52d78ffa1f6dac29b9b09b5", "sha256": "4a7639ab46d0c14c3f35e020bcbd55a71faeee32295a9fb4e06865e904695d2d" }, "downloads": -1, "filename": "PyEventEmitter-1.0.5.tar.gz", "has_sig": false, "md5_digest": "7ebd55edc52d78ffa1f6dac29b9b09b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2170, "upload_time": "2018-09-14T19:17:59", "url": "https://files.pythonhosted.org/packages/71/c4/c9cc29d18de18d97269ee5794e0d212d1f981e4a95e06df93d7c2bab102e/PyEventEmitter-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7ebd55edc52d78ffa1f6dac29b9b09b5", "sha256": "4a7639ab46d0c14c3f35e020bcbd55a71faeee32295a9fb4e06865e904695d2d" }, "downloads": -1, "filename": "PyEventEmitter-1.0.5.tar.gz", "has_sig": false, "md5_digest": "7ebd55edc52d78ffa1f6dac29b9b09b5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2170, "upload_time": "2018-09-14T19:17:59", "url": "https://files.pythonhosted.org/packages/71/c4/c9cc29d18de18d97269ee5794e0d212d1f981e4a95e06df93d7c2bab102e/PyEventEmitter-1.0.5.tar.gz" } ] }