{ "info": { "author": "Matthew Tardiff", "author_email": "mattrix@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "Abduct |Version| |Build| |Coverage| |Health|\n============================================\n\n|Compatibility| |Implementations| |Format| |Downloads|\n\nCapture stdout/stderr and optionally release when an exception occurs.\n\n.. code:: python\n\n from abduct import captured, out, err\n\n with captured(out()) as stdout:\n ...\n\n with captured(out(), err()) as (stdout, stderr):\n ...\n\n @captured(out(), err())\n ...\n\n\nInstallation:\n\n.. code:: console\n\n $ pip install abduct\n\n\nWhen stdout or stderr is captured, the related ``sys.stdout`` or\n``sys.stderr`` object is replaced with a ``StringIO`` object for the\nlife of the context.\n\n\nExamples\n--------\n\nIt's often useful to capture the output of a block of code. Abduct\nmakes this easy:\n\n.. code:: python\n\n with captured(out()) as stdout:\n print('hello!')\n\n assert stdout.getvalue() == 'hello!'\n\n\nSometimes you may want to hide the output of some code *unless*\nsomething goes wrong. In this case, simply specify\n``release_on_exception=True``:\n\n.. code:: python\n\n with captured(out(release_on_exception=True)):\n print('Really important message!')\n if blow_up:\n raise RuntimeError()\n\n\nIn this case, ``Really important message!`` will be printed on\n``stdout`` if the exception is raised.\n\nIf you'd like to capture the output, but still write through to\n``stdout`` or ``stderr``, use the ``tee=True`` parameter:\n\n.. code:: python\n\n with captured(err(tee=True)) as stderr:\n sys.stderr.write('Error!')\n\n assert stderr.getvalue() == 'Error!'\n\n\nIn this case, ``Error!`` is captured *and* written to ``stderr``\nat the same time.\n\n\nChangelog\n---------\n\n**2.0.1**\n\n- Added tests for the decorator usage.\n\n\n**2.0.0**\n\n- Feature: \"Create a write-through option for output.\"\n- Backwards-incompatible change: ``stdout`` and ``stderr`` methods are now ``out`` and ``err`` respectively.\n\n\n**1.0.4**\n\n- Fixed Travis release criteria.\n\n\n**1.0.3**\n\n- Refactored test runner.\n\n\n**1.0.2**\n\n- Fixed README and description.\n\n\n**1.0.1**\n\n- Travis config now defers to tox.\n- Added examples to README.\n\n\n**1.0.0**\n\n- Actual working code. Yay!\n\n\n**0.0.1**\n\n- Initial release.\n\n\n.. |Build| image:: https://travis-ci.org/themattrix/python-abduct.svg?branch=master\n :target: https://travis-ci.org/themattrix/python-abduct\n.. |Coverage| image:: https://img.shields.io/coveralls/themattrix/python-abduct.svg\n :target: https://coveralls.io/r/themattrix/python-abduct\n.. |Health| image:: https://landscape.io/github/themattrix/python-abduct/master/landscape.svg\n :target: https://landscape.io/github/themattrix/python-abduct/master\n.. |Version| image:: https://pypip.in/version/abduct/badge.svg?text=version\n :target: https://pypi.python.org/pypi/abduct\n.. |Downloads| image:: https://pypip.in/download/abduct/badge.svg\n :target: https://pypi.python.org/pypi/abduct\n.. |Compatibility| image:: https://pypip.in/py_versions/abduct/badge.svg\n :target: https://pypi.python.org/pypi/abduct\n.. |Implementations| image:: https://pypip.in/implementation/abduct/badge.svg\n :target: https://pypi.python.org/pypi/abduct\n.. |Format| image:: https://pypip.in/format/abduct/badge.svg\n :target: https://pypi.python.org/pypi/abduct\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/themattrix/python-abduct", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "abduct", "package_url": "https://pypi.org/project/abduct/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/abduct/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/themattrix/python-abduct" }, "release_url": "https://pypi.org/project/abduct/2.0.1/", "requires_dist": null, "requires_python": null, "summary": "Capture stdout/stderr and optionally release when an exception occurs.", "version": "2.0.1" }, "last_serial": 1549070, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "27e7a2e04d8ae066a7c8e80f86f4c7ff", "sha256": "13db2066b5e549d12e79faa05f214a665feabef664ace80b80236569afee3a9f" }, "downloads": -1, "filename": "abduct-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "27e7a2e04d8ae066a7c8e80f86f4c7ff", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2858, "upload_time": "2015-05-01T00:55:46", "url": "https://files.pythonhosted.org/packages/f6/c0/ada6443bf80c80d39bf2542f461219bc88b261c8a2bebf9f86cd8d3f5a18/abduct-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eb5a4c37511ec3c360b2679a6c344bf4", "sha256": "34cade650ef898d3b3cc3fb771e6795cf13cb2efb618fd216ca8be3d19b4a5a8" }, "downloads": -1, "filename": "abduct-1.0.0.tar.gz", "has_sig": false, "md5_digest": "eb5a4c37511ec3c360b2679a6c344bf4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1946, "upload_time": "2015-05-01T00:55:43", "url": "https://files.pythonhosted.org/packages/b1/43/60b5aa6de0181a086976856a587e017557aeac06e35a5dc57584b960e693/abduct-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "bd06154a96a3576d0e1dcdcdb09adf5c", "sha256": "b30948c779e1bf1e0e1badaed93c926cecbeae5be8aa1933c7c9720b25c704fd" }, "downloads": -1, "filename": "abduct-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bd06154a96a3576d0e1dcdcdb09adf5c", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2868, "upload_time": "2015-05-02T15:24:49", "url": "https://files.pythonhosted.org/packages/72/ca/c1fd7e16594ecddfdefb95d20de588c353222e1e3d29b23d26d1f1bfe808/abduct-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2b12bb611025b9d8540d29f1a9a0090b", "sha256": "205edd437359397312a66047bb1dbea8e46bb58ad00f0bc03b3c341a63346257" }, "downloads": -1, "filename": "abduct-1.0.1.tar.gz", "has_sig": false, "md5_digest": "2b12bb611025b9d8540d29f1a9a0090b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2289, "upload_time": "2015-05-02T15:24:47", "url": "https://files.pythonhosted.org/packages/2d/a4/174b8dd3d883f4ce5b06254bd613e7d9d42ae9528a1eced5bb0f5c33df42/abduct-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "cb65e8e995c8a908a2f18f75e21195e2", "sha256": "c23128cf8a6d5233438bad92a006dca7f796e89b7dcb44578987a3745b063d9f" }, "downloads": -1, "filename": "abduct-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cb65e8e995c8a908a2f18f75e21195e2", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2874, "upload_time": "2015-05-02T17:31:31", "url": "https://files.pythonhosted.org/packages/e1/0b/e18c0e87c7d76d82fa6557c24c6868c32b94f6acb6b7dee74255507d05d0/abduct-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e8b718d8c8e72ff97bbccb6bbc7ffa6d", "sha256": "2511770aac25e38ea296524e818b02a3a3fd229d15a0530c05eb0102e68ec184" }, "downloads": -1, "filename": "abduct-1.0.2.tar.gz", "has_sig": false, "md5_digest": "e8b718d8c8e72ff97bbccb6bbc7ffa6d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2303, "upload_time": "2015-05-02T17:31:28", "url": "https://files.pythonhosted.org/packages/cb/58/57dd7cbb9d0de93627d2fb6db76b575f63d677775cc963608b1ffc3b6079/abduct-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "72c995bd12e5c317e2fd694096ee9905", "sha256": "8bc91a4417bcb0f93f72700d8fa48d4faa7ba4e4de5cc60e03c23e4cc40d8979" }, "downloads": -1, "filename": "abduct-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "72c995bd12e5c317e2fd694096ee9905", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2871, "upload_time": "2015-05-03T14:35:53", "url": "https://files.pythonhosted.org/packages/b8/bd/6d5438a091e80f12b802c88a0f93191d9ad73ae02c5ab9560dfc36703554/abduct-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5754234cc1eed1ad3c815f046f25131b", "sha256": "7b4e4a557ce46e2e255cffcafabbae32f1e0fb6ce375172ace6860edb964e406" }, "downloads": -1, "filename": "abduct-1.0.3.tar.gz", "has_sig": false, "md5_digest": "5754234cc1eed1ad3c815f046f25131b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2330, "upload_time": "2015-05-03T14:35:51", "url": "https://files.pythonhosted.org/packages/23/51/213d36400b6061f6fc79f0bf760e81f54a41a7fbb217de4984a97043e27f/abduct-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "70c090545aadf9e24aea2e9582ead4c0", "sha256": "3ec4ebd894c85626faf0e422a60addefa28ff6570ec92c5fc935d7c63c5b3d89" }, "downloads": -1, "filename": "abduct-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "70c090545aadf9e24aea2e9582ead4c0", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2872, "upload_time": "2015-05-03T15:00:09", "url": "https://files.pythonhosted.org/packages/6b/bf/75033cfdc5c1be5ef63f6d23bd16426023bc2b14e649c8ad84ab1647126a/abduct-1.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d504413aed053ab7f82435b061c369f7", "sha256": "666445e41c0816da920701454d38ba7970950817fd0aefde8b9917d6433b192d" }, "downloads": -1, "filename": "abduct-1.0.4.tar.gz", "has_sig": false, "md5_digest": "d504413aed053ab7f82435b061c369f7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2343, "upload_time": "2015-05-03T15:00:01", "url": "https://files.pythonhosted.org/packages/c7/d8/f0fbb5496de8e69835d6138a20d8f576b203215a69f824716ff285bd4566/abduct-1.0.4.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "bc385b2ee88a2e8ae6715c7ccf4e8a65", "sha256": "da229cc6aab8c5f9dfad00b74d236d8a671d4d1b9535ec37002ecb2a10da4b3d" }, "downloads": -1, "filename": "abduct-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bc385b2ee88a2e8ae6715c7ccf4e8a65", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3376, "upload_time": "2015-05-15T03:40:48", "url": "https://files.pythonhosted.org/packages/33/93/2c8378e6a9db461882d2199a9c6c7e0f7533131dfae24a8d31afc4b7433e/abduct-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3ad9dd8eb7e504cdd953409f283c2993", "sha256": "e859b4920e9dc4d88d5d65e2bb16f213636670e8bc36d83124b6ddd135008936" }, "downloads": -1, "filename": "abduct-2.0.0.tar.gz", "has_sig": false, "md5_digest": "3ad9dd8eb7e504cdd953409f283c2993", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2848, "upload_time": "2015-05-15T03:40:44", "url": "https://files.pythonhosted.org/packages/a3/03/35e5d7ad80ecabf8d061f422296f466ffbb3612819d1cfa4bb4d81179a86/abduct-2.0.0.tar.gz" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "6c67d72b2e1aab6a5a39c9ec7d003bbf", "sha256": "a3d1a3dcc7e544054534a1e10c3443d8ed5cde57c9dc47da8484910c36478a3b" }, "downloads": -1, "filename": "abduct-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6c67d72b2e1aab6a5a39c9ec7d003bbf", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3427, "upload_time": "2015-05-16T02:09:53", "url": "https://files.pythonhosted.org/packages/23/16/5e3393ab3c9c5a4c15feab2e95636409087fac077438a80fa35861c9ac5e/abduct-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8f0ae503bc9bc3cdd37886f8347dec77", "sha256": "7617a853d5feed772863c4cbf51adedd7d06ba025ea1396224a5f0becdb9cf2f" }, "downloads": -1, "filename": "abduct-2.0.1.tar.gz", "has_sig": false, "md5_digest": "8f0ae503bc9bc3cdd37886f8347dec77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2949, "upload_time": "2015-05-16T02:09:50", "url": "https://files.pythonhosted.org/packages/fc/0b/7880d5c7e482cefb58a4049df5ef486639e7c4a44a33a7eed7eba9a1ea7b/abduct-2.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6c67d72b2e1aab6a5a39c9ec7d003bbf", "sha256": "a3d1a3dcc7e544054534a1e10c3443d8ed5cde57c9dc47da8484910c36478a3b" }, "downloads": -1, "filename": "abduct-2.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6c67d72b2e1aab6a5a39c9ec7d003bbf", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 3427, "upload_time": "2015-05-16T02:09:53", "url": "https://files.pythonhosted.org/packages/23/16/5e3393ab3c9c5a4c15feab2e95636409087fac077438a80fa35861c9ac5e/abduct-2.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8f0ae503bc9bc3cdd37886f8347dec77", "sha256": "7617a853d5feed772863c4cbf51adedd7d06ba025ea1396224a5f0becdb9cf2f" }, "downloads": -1, "filename": "abduct-2.0.1.tar.gz", "has_sig": false, "md5_digest": "8f0ae503bc9bc3cdd37886f8347dec77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2949, "upload_time": "2015-05-16T02:09:50", "url": "https://files.pythonhosted.org/packages/fc/0b/7880d5c7e482cefb58a4049df5ef486639e7c4a44a33a7eed7eba9a1ea7b/abduct-2.0.1.tar.gz" } ] }