{ "info": { "author": "Josh Burnett", "author_email": "josh_github@burnettsonline.org", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# multitimer\n\nA pure-python auto-repeating timer that can be stopped and restarted multiple times. \n\n`multitimer.MultiTimer` is similar to\n[`threading.Timer`](https://docs.python.org/3/library/threading.html#timer-objects),\nbut allows the timer to repeat multiple times. Additionally, `MultiTimer` can be started and\nstopped multiple times (unlike `threading.Timer`).\n\n## Overview\n\n`multitimer.MultiTimer(interval, function, args=None, kwargs=None, count=-1, runonstart=True)`\n\nCreates a timer that will run _function_ with arguments _args_ and keyword\narguments _kwargs_, after _interval_ seconds have passed, a total of _count_ times.\n\nIf _runonstart_==True, then _function_ will be called immediately when `.start()` is called.\n\nIf _args_ is None (the default) then an empty list will be used. If _kwargs_ is None (the\ndefault) then an empty dict will be used.\n\nIf _count_ == -1 (the default), the timer will repeat indefinitely, or until `.stop()`\nis called.\n\nStart this timer by calling `.start()`. Once started, calling `.stop()` will terminate the\ntimer's loop and not produce any further calls to _function_. Note that if _function_ is\ncurrently in the middle of running, it will finish the current iteration and not be interrupted.\n\n_ontimeout_ and _params_ are deprecated in 0.2, and replaced by _function_, _args_\nand _kwargs_, to match the `threading.Timer` API.\n\nSince the underlying mechanism is purely based on python threads & events, the overall processor\nload & memory usage are minimal. Note that the timing accuracy is typically to within about 10 ms,\ndepending on the platform.\n\n\n## Installation & usage\n\n```bash\n$ pip install multitimer\n```\n\n```python\nimport multitimer\nimport time\n\ndef job():\n\tprint(\"I'm working...\")\n\n# This timer will run job() five times, one second apart\ntimer = multitimer.MultiTimer(interval=1, function=job, count=5)\n\n# Pauses for one interval before starting job() five times\ntimer = multitimer.MultiTimer(interval=1, function=job, count=5, runonstart=False)\n\n\n# You can specify input parameters for the _function_ function\ndef job2(foo):\n\tprint(foo)\n\ntimer = multitimer.MultiTimer(interval=1, function=job2, kwargs={'foo':\"I'm still working...\"})\n\n# Also, this timer would run indefinitely...\ntimer.start()\n\n# ...unless it gets stopped\ntime.sleep(5)\ntimer.stop()\n\n\n# If a mutable object is used to specify input parameters, it can be changed after starting the timer\noutput = {'foo':\"Doin' my job again.\"}\ntimer = multitimer.MultiTimer(interval=1, function=job2, kwargs=output, count=5)\ntimer.start()\n\ntime.sleep(3.5)\noutput['foo'] = \"I'd like to be done now.\"\n\n# And a MultiTimer can be re-started by just calling start() again\ntime.sleep(2)\noutput['foo'] = 'Please just let me be...'\ntimer.start()\ntime.sleep(4.5)\ntimer.stop()\n```\n\nReleases\n--------\n\n### 0.1, 2018-02-15\n\n* Initial release\n\n### 0.2, 2019-01-17\n\n* Replace time.clock() calls with time.perf_counter(), as [time.clock is deprecated since python 3.3](https://docs.python.org/3/library/time.html#time.clock) and doesn't provide consistent behavior across different platforms.\n* Replace _ontimeout_ with _function_, and _params_ with _args_ and _kwargs_, to match the `threading.Timer` API.\n_ontimeout_ and _params_ are deprecated and will be removed in v0.3.\n* Added lots of code comments to better explain how the module works. \n\nMeta\n----\n\nJosh Burnett - josh_github@burnettsonline.org\n\nDistributed under the MIT license. See `LICENSE.txt` for more information.\n\n\n\nHope you find this useful!\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "timer", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "multitimer", "package_url": "https://pypi.org/project/multitimer/", "platform": "", "project_url": "https://pypi.org/project/multitimer/", "project_urls": null, "release_url": "https://pypi.org/project/multitimer/0.2/", "requires_dist": null, "requires_python": "", "summary": "A pure-python periodic timer that can be started multiple times", "version": "0.2" }, "last_serial": 4708992, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "6c0a66904b8026ef412e2b6defde60eb", "sha256": "e83ed640a61db7dc3feaa34e8b13742461ac3e4762845b0806ddca13d6424fe7" }, "downloads": -1, "filename": "multitimer-0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6c0a66904b8026ef412e2b6defde60eb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4284, "upload_time": "2018-02-15T11:05:43", "url": "https://files.pythonhosted.org/packages/93/f6/4a5f3f1bfcf41d6ab284fabdbf74cee9edf7de235f46be7d8725c8e7ec64/multitimer-0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d0f2711e9bb4ac1c5cc70aaabb67a029", "sha256": "66b7576c42a7e28e88b671f3ab46448d0545f203bb218aab853ddff684b0f168" }, "downloads": -1, "filename": "multitimer-0.1.tar.gz", "has_sig": false, "md5_digest": "d0f2711e9bb4ac1c5cc70aaabb67a029", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4556, "upload_time": "2018-02-15T11:05:45", "url": "https://files.pythonhosted.org/packages/0b/c0/de9aa647aac4466fb3a97c255721742411ef1de3069c7af175593ce7af07/multitimer-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "20f12d2894e3b89c2a47dbb8002f254d", "sha256": "c1d1142d12f525aa44c76ab0c07a34ab3fc09c8827e116bf532da67294b3de35" }, "downloads": -1, "filename": "multitimer-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "20f12d2894e3b89c2a47dbb8002f254d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5088, "upload_time": "2019-01-17T17:17:22", "url": "https://files.pythonhosted.org/packages/36/c9/207cf989b83eda72424a86b06bb077fca8771490c2b1a5ecd490233be7f4/multitimer-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "86ae682b7f0cad007c1c3604ee33cf4b", "sha256": "deac99a922061cd9625255ce52f1924d386a8b73de657d8b1d03f349e34d5328" }, "downloads": -1, "filename": "multitimer-0.2.zip", "has_sig": false, "md5_digest": "86ae682b7f0cad007c1c3604ee33cf4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12569, "upload_time": "2019-01-17T17:17:24", "url": "https://files.pythonhosted.org/packages/5c/e7/c4a2772a874df75afc6aa00646bafdcfa2fe9f20a1bce56add58df5adad7/multitimer-0.2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "20f12d2894e3b89c2a47dbb8002f254d", "sha256": "c1d1142d12f525aa44c76ab0c07a34ab3fc09c8827e116bf532da67294b3de35" }, "downloads": -1, "filename": "multitimer-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "20f12d2894e3b89c2a47dbb8002f254d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5088, "upload_time": "2019-01-17T17:17:22", "url": "https://files.pythonhosted.org/packages/36/c9/207cf989b83eda72424a86b06bb077fca8771490c2b1a5ecd490233be7f4/multitimer-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "86ae682b7f0cad007c1c3604ee33cf4b", "sha256": "deac99a922061cd9625255ce52f1924d386a8b73de657d8b1d03f349e34d5328" }, "downloads": -1, "filename": "multitimer-0.2.zip", "has_sig": false, "md5_digest": "86ae682b7f0cad007c1c3604ee33cf4b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12569, "upload_time": "2019-01-17T17:17:24", "url": "https://files.pythonhosted.org/packages/5c/e7/c4a2772a874df75afc6aa00646bafdcfa2fe9f20a1bce56add58df5adad7/multitimer-0.2.zip" } ] }