{ "info": { "author": "Christoffer Hjortlund", "author_email": "hjortlund@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "simple_watchdog_timer\n=====================\n\nRequirements\n-------------\n\n* Python -- one of the following:\n\n - CPython_ : >= 3.3\n - PyPy_ : Latest version\n\n.. _CPython: https://www.python.org/\n.. _PyPy: https://pypy.org/\n\nInstallation\n------------\n\nPackage is uploaded on `PyPI `_.\n\nYou can install it with pip::\n\n $ python3 -m pip install simple_watchdog_timer\n\n\nBackwards compatibility\n-----------------------\n\nBackwards compatibility is only guaranteed between minor versions above the stable version (1.0)\nTherefore it's advised to to pin the module on a version ether the specific version like:\nsimple_watchdog_timer==X.X.X\n\nor get the latest minor version:\nsimple_watchdog_timer~=X.X.X\n\nSee more examples of how to pin version in `PEP-440 `_.\n\n\nDocumentation\n-------------\n\nFor support, please refer to `StackOverflow `_.\n\nExample\n-------\n\nThe following example showcases the usage\n\n.. code:: python\n\n import simple_watchdog_timer as swt\n from random import uniform\n from time import sleep\n\n\n def cb(dog):\n # When the callback gets triggered, it's good practice to pause the WDT to prevent it firing again, while you are handling the action required when it triggers\n dog.pause()\n\n # Do something when the WDT triggers...\n print('WDT Triggered')\n\n # Update / reset the internal WDT timer (dog.reset() does the same), this is important to avoid the time spent in the callback to influence the next triggering\n dog.update()\n\n # Resume the WDT\n dog.resume()\n\n # ...or:\n\n # If you would like to completely stop the WDT\n # dog.stop()\n\n # But you regret and want to start it again\n # dog.start()\n\n # Tip: stop() and start() can also be used instead of the more manual pause, update and resume if that is preferred (more simple, but less in-line expressive)\n\n\n def main():\n wdt = swt.WDT(check_interval_sec=0.01, trigger_delta_sec=0.50, callback=cb)\n\n while True:\n zzz_sec = uniform(0, 0.60)\n print('Sleep for {}'.format(zzz_sec))\n sleep(zzz_sec)\n\n wdt.update()\n\n\n if __name__ == '__main__':\n main()\n\nThis example will print:\n\n.. code:: python\n\n Raw data:\n Sleep for 0.1492276414753453\n Sleep for 0.5913061085397784\n WDT Triggered\n Sleep for 0.17619615161373772\n Sleep for 0.5853218597734956\n WDT Triggered\n Sleep for 0.38154937243934783\n Sleep for 0.5000195244886919\n WDT Triggered\n Sleep for 0.08607711764377268\n Sleep for 0.31192761174090605\n Sleep for 0.02722456895623042\n\nLicense\n-------\n\nTimedDict is released under the MIT License. See LICENSE for more information.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/hjortlund/simple_watchdog_timer", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "simple-watchdog-timer", "package_url": "https://pypi.org/project/simple-watchdog-timer/", "platform": "", "project_url": "https://pypi.org/project/simple-watchdog-timer/", "project_urls": { "Homepage": "https://github.com/hjortlund/simple_watchdog_timer" }, "release_url": "https://pypi.org/project/simple-watchdog-timer/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "A simple WatchDog Timer (WDT) to trigger events if inactivity, of a time dependent task, occur for a specified amount of time.", "version": "0.1.1" }, "last_serial": 4359960, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "1305b5a2fc09cc06a7b9b29cc472bf14", "sha256": "ee43dc8ffb3db75bfde70ad32450ecde3f74d2e103e6edb502245db90c7df8fe" }, "downloads": -1, "filename": "simple_watchdog_timer-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1305b5a2fc09cc06a7b9b29cc472bf14", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3358, "upload_time": "2018-09-28T15:43:59", "url": "https://files.pythonhosted.org/packages/ce/ae/a3fcabf0d13ab2163d258607d862f2a59eb82b6fc2df3614e33864467910/simple_watchdog_timer-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "3ae14963db66c14158414446706321e8", "sha256": "5d5b3e366cfcc1d82146a4f8237e49463a59cc8ccac5542edc1b26cd760310f2" }, "downloads": -1, "filename": "simple_watchdog_timer-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3ae14963db66c14158414446706321e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3530, "upload_time": "2018-10-10T13:23:46", "url": "https://files.pythonhosted.org/packages/1f/89/effec63c05486da013ccace5db25257921c9bdb390c359f0d12ce123d37f/simple_watchdog_timer-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3ae14963db66c14158414446706321e8", "sha256": "5d5b3e366cfcc1d82146a4f8237e49463a59cc8ccac5542edc1b26cd760310f2" }, "downloads": -1, "filename": "simple_watchdog_timer-0.1.1.tar.gz", "has_sig": false, "md5_digest": "3ae14963db66c14158414446706321e8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3530, "upload_time": "2018-10-10T13:23:46", "url": "https://files.pythonhosted.org/packages/1f/89/effec63c05486da013ccace5db25257921c9bdb390c359f0d12ce123d37f/simple_watchdog_timer-0.1.1.tar.gz" } ] }