{ "info": { "author": "HushBugger", "author_email": "hushbugger@posteo.net", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: ISC License (ISCL)", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython" ], "description": "`hushbugger` is an alternative to a debugger. Instead of helping you find bugs and remove them, it will do its best to make bugs invisible.\n\n# Example\n\nImagine you have the following code (as featured in the [Hypothesis docs](https://hypothesis.readthedocs.io/en/latest/quickstart.html)):\n\n```py\ndef encode(input_string):\n count = 1\n prev = ''\n lst = []\n for character in input_string:\n if character != prev:\n if prev:\n entry = (prev, count)\n lst.append(entry)\n count = 1\n prev = character\n else:\n count += 1\n else:\n entry = (character, count)\n lst.append(entry)\n return lst\n```\n\nIt has a fatal flaw: it crashes if you give it an empty string:\n\n```\n>>> encode('')\nTraceback (most recent call last):\n ...\nUnboundLocalError: local variable 'character' referenced before assignment\n```\n\nTo hide the bug, simply apply the `hush` decorator:\n\n```py\nfrom hushbugger import hush\n\n@hush\ndef encode(input_string):\n count = 1\n prev = ''\n lst = []\n for character in input_string:\n if character != prev:\n if prev:\n entry = (prev, count)\n lst.append(entry)\n count = 1\n prev = character\n else:\n count += 1\n else:\n entry = (character, count)\n lst.append(entry)\n return lst\n```\n\nNow it works!\n\n```\n>>> encode('')\n[]\n```\n\n# How it works\n\nIf the function raises an exception, its bytecode is disassembled and inspected to look for return statements. If a constant value is returned (e.g. `return True`), that value is used. If a variable is returned (e.g. `return x`), and that variable had a value at the time of the exception, that value is used.\n\nIf no usable return statements are found, a `Dummy` object is returned. It responds to almost any operation you throw at it (calling it, adding it, iterating over it, etcetera), so hopefully it gets discarded before visibly breaking anything. Its `repr` is also disguised, as if it belonged to a random module.\n\n```py\n@hush\ndef double(x):\n return 2 * x\n```\n\n```\n>>> double([1, 2, 3])\n[1, 2, 3, 1, 2, 3]\n>>> ret = double({})\n>>> ret\n\n>>> len(list(ret.invert()))\n51\n```\n\n# Installing\n\n```\npip install hushbugger\n```\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/HushBugger/hushbugger", "keywords": "", "license": "ISC", "maintainer": "", "maintainer_email": "", "name": "hushbugger", "package_url": "https://pypi.org/project/hushbugger/", "platform": "", "project_url": "https://pypi.org/project/hushbugger/", "project_urls": { "Homepage": "https://github.com/HushBugger/hushbugger" }, "release_url": "https://pypi.org/project/hushbugger/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "A silent alternative to debugging", "version": "0.0.1" }, "last_serial": 4550729, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4057af8ee6974d73f468f36149d5c811", "sha256": "130732b6fda7f744ce28583f9a1b33cf335856945d10f52bfcef3c24e77156d3" }, "downloads": -1, "filename": "hushbugger-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4057af8ee6974d73f468f36149d5c811", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5143, "upload_time": "2018-12-01T18:26:19", "url": "https://files.pythonhosted.org/packages/d6/2b/bb30ff6951591c178d81ba262bd197d1da59eeb151edfb25a64069eecc81/hushbugger-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6e072f4d8d936f79f6b90f1f1d3fcf61", "sha256": "998e5027b61945c3bcd7341ab93052dc521aaeb15c7251069f8c077b16d89306" }, "downloads": -1, "filename": "hushbugger-0.0.1.tar.gz", "has_sig": false, "md5_digest": "6e072f4d8d936f79f6b90f1f1d3fcf61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3185, "upload_time": "2018-12-01T18:26:21", "url": "https://files.pythonhosted.org/packages/60/5b/156a8db230ef79ba0c67ad1ac97a55006c71aea954d53afc23878aaa9019/hushbugger-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4057af8ee6974d73f468f36149d5c811", "sha256": "130732b6fda7f744ce28583f9a1b33cf335856945d10f52bfcef3c24e77156d3" }, "downloads": -1, "filename": "hushbugger-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "4057af8ee6974d73f468f36149d5c811", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5143, "upload_time": "2018-12-01T18:26:19", "url": "https://files.pythonhosted.org/packages/d6/2b/bb30ff6951591c178d81ba262bd197d1da59eeb151edfb25a64069eecc81/hushbugger-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6e072f4d8d936f79f6b90f1f1d3fcf61", "sha256": "998e5027b61945c3bcd7341ab93052dc521aaeb15c7251069f8c077b16d89306" }, "downloads": -1, "filename": "hushbugger-0.0.1.tar.gz", "has_sig": false, "md5_digest": "6e072f4d8d936f79f6b90f1f1d3fcf61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3185, "upload_time": "2018-12-01T18:26:21", "url": "https://files.pythonhosted.org/packages/60/5b/156a8db230ef79ba0c67ad1ac97a55006c71aea954d53afc23878aaa9019/hushbugger-0.0.1.tar.gz" } ] }