{ "info": { "author": "Bryan Worrell", "author_email": "bworrell@notmyemail.com", "bugtrack_url": null, "classifiers": [], "description": "narcolepsy\r\n==========\r\n\r\nPuts code to sleep.\r\n\r\n|pypi badge| |downloads badge|\r\n\r\n.. |pypi badge| image:: https://img.shields.io/pypi/v/narcolepsy.svg?maxAge=3600\r\n :target: https://pypi.python.org/pypi/narcolepsy/\r\n.. |downloads badge| image:: https://img.shields.io/pypi/dm/narcolepsy.svg?maxAge=3600\r\n :target: https://pypi.python.org/pypi/narcolepsy/\r\n\r\nOverview\r\n--------\r\n\r\nThe ``narcolepsy`` package contains code which alters the behavior of your\r\napplication/api by injecting random sleep calls into decorated functions.\r\n\r\n\r\nUsage\r\n-----\r\n\r\nThe following code is an example of using the ``@narcoleptic`` decorator.\r\n\r\n::\r\n\r\n from narcolepsy import narcoleptic\r\n\r\n @narcoleptic(max=5) # sleep for 5 seconds at max\r\n def foobar():\r\n for x in xrange(1024):\r\n nested_function(x)\r\n\r\nThe ``@narcoleptic`` decorator takes three parameters (all optional):\r\n\r\n* ``min``: The minimum sleep time in seconds.\r\n* ``max``: The maximum sleep time in seconds.\r\n* ``chance``: The maximum number of lines that will be executed before a ``sleep()``\r\n call is injected.\r\n\r\nIf no ``min`` or ``max`` are passed in, the constants defined in\r\n``narcolepsy.constants`` will be used instead.\r\nIf no ``chance`` is passed in, a value will be derived from the number of lines\r\nin the input function.\r\n\r\nInstallation\r\n------------\r\n\r\nThe easiest way to install ``narcolepsy`` is via ``pip``:\r\n\r\n::\r\n\r\n $ pip install narcolepsy\r\n\r\n\r\nKnown Issues\r\n------------\r\nAs mentioned in the `official documentation`_, ``sys.settrace()`` isn't part\r\nof the Python language definition and thus, may not be available to all\r\nPython implementations.\r\n\r\n.. _official documentation: https://docs.python.org/2/library/sys.html#sys.settrace\r\n\r\n\r\nWhy?\r\n----\r\n\r\nIn theory this could help test time-critical code (multi-producer/consumer\r\nconcurrent applications), but I mostly just wanted to play around with line\r\ntracers.\r\n\r\n\r\nDisclaimer\r\n----------\r\n\r\nThis is a proof of concept and probably shouldn't be used in any sort of\r\nreal-world scenario where testing of time-critical code has any measure of\r\nimportance. **USE AT YOUR OWN RISK!**\r\n\r\n\r\nLICENSE\r\n-------\r\n\r\nSee the LICENSE file for details.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bworrell", "keywords": "narcolepsy sleep timing useless", "license": "UNKNOWN", "maintainer": "", "maintainer_email": "", "name": "narcolepsy", "package_url": "https://pypi.org/project/narcolepsy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/narcolepsy/", "project_urls": { "Homepage": "https://github.com/bworrell" }, "release_url": "https://pypi.org/project/narcolepsy/0.0.3/", "requires_dist": null, "requires_python": null, "summary": "", "version": "0.0.3" }, "last_serial": 2294700, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "3a7fd936bf6972ac52f3c3e6f01ad6ee", "sha256": "54d0c7bff5d4d2e11f8b2d047879db1e95c41bf08b5fd8c225675f2bcc3387c3" }, "downloads": -1, "filename": "narcolepsy-0.0.1.tar.gz", "has_sig": false, "md5_digest": "3a7fd936bf6972ac52f3c3e6f01ad6ee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4046, "upload_time": "2016-06-04T01:36:12", "url": "https://files.pythonhosted.org/packages/f0/e8/7d703670be56785e7515e8c736c748cf982cde96630fe88dc617d77e0ef2/narcolepsy-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "d008024b7918f5403553c292c99e03d1", "sha256": "73480e402db138b42292ed9dd276890e6d118e2f23413b1480f023e0bbaf4fa5" }, "downloads": -1, "filename": "narcolepsy-0.0.2.tar.gz", "has_sig": false, "md5_digest": "d008024b7918f5403553c292c99e03d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4076, "upload_time": "2016-08-20T20:01:44", "url": "https://files.pythonhosted.org/packages/6c/20/9a25de845fb899df0602fde4395ebf8f29bfe2494a1439f81d3c44dbdbd9/narcolepsy-0.0.2.tar.gz" }, { "comment_text": "", "digests": { "md5": "aa052f1e3b20f600be907797064b0254", "sha256": "a31124798c490d8779e7664694b80a668e4b897776972f75c6cfb8fd2d7e8342" }, "downloads": -1, "filename": "narcolepsy-0.0.2.zip", "has_sig": false, "md5_digest": "aa052f1e3b20f600be907797064b0254", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8644, "upload_time": "2016-08-20T20:02:00", "url": "https://files.pythonhosted.org/packages/13/a5/63406101782113138e8f0a911e0e69d60c1f04e909afbd8d00956fcca041/narcolepsy-0.0.2.zip" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4bf9a5c5d5eb643898109f26f93bc28f", "sha256": "5fa0f6da90950203980a4295ff4c53c34fdb84683d686001c15fb52e3a7be63b" }, "downloads": -1, "filename": "narcolepsy-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4bf9a5c5d5eb643898109f26f93bc28f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4426, "upload_time": "2016-08-22T02:07:42", "url": "https://files.pythonhosted.org/packages/ff/f9/dbe281ff720ea12ff6f74255c153e8476f92f4ebeb32382c5146ba4a8e11/narcolepsy-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4bf9a5c5d5eb643898109f26f93bc28f", "sha256": "5fa0f6da90950203980a4295ff4c53c34fdb84683d686001c15fb52e3a7be63b" }, "downloads": -1, "filename": "narcolepsy-0.0.3.tar.gz", "has_sig": false, "md5_digest": "4bf9a5c5d5eb643898109f26f93bc28f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4426, "upload_time": "2016-08-22T02:07:42", "url": "https://files.pythonhosted.org/packages/ff/f9/dbe281ff720ea12ff6f74255c153e8476f92f4ebeb32382c5146ba4a8e11/narcolepsy-0.0.3.tar.gz" } ] }