{ "info": { "author": "EcmaXp", "author_email": "module-threadio@ecmaxp.pe.kr", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "ThreadIO, is good for capture stdout at multi-thread environment.\n\n\n>>> # standard capture\n>>> from threadio import print_to_file\n>>> with print_to_file(TextIO()) as fp:\n... print(\"hello world\")\n...\n>>> fp.getvalue()\n'hello world\\n'\n\n>>> # standard capture (but not stdout, stderr)\n>>> from threadio import ThreadIO\n>>> fp = ThreadIO(TextIO())\n>>> with fp.capture(TextIO()) as fp2:\n... print(\"hello world\", file=fp)\n... with fp.capture(TextIO()) as fp3:\n... print(\"hello world3\", file=fp)\n... # not captured fp3, stored fp2\n... print(\"fail captured\", file=fp2)\n...\n>>> fp.getvalue()\n''\n>>> fp2.getvalue()\n'hello world\\nfail captured\\n'\n>>> fp3.getvalue()\n'hello world3\\n'\n\n>>> # thread example\n>>> from threading import Thread\n>>> from threadio import print_to_file\n>>> th = Thread(target=print, args=(\"hello world!\",))\n>>> with print_to_file(TextIO()) as fp:\n... th.start()\n... th.join()\n... print(\"HAYO!\")\n... \nhello world!\n>>> fp.getvalue() # not capture other thread's print\n'HAYO!\\n'\n\n\n>>> # note. print_to_xxx function change everything. \n>>> a = sys.stdout\n>>> with print_to_file(TextIO()): pass\n>>> b = sys.stdout\n>>> a is b\nFalse", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "threadio", "package_url": "https://pypi.org/project/threadio/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/threadio/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/threadio/0.1/", "requires_dist": null, "requires_python": null, "summary": "ThreadIO, is good for capture stdout at multi-thread environment.", "version": "0.1" }, "last_serial": 800571, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "575ce52cd7933121ec0424e90d49624e", "sha256": "150ddac53b229611684956d5dd2e4893f220bea622e40b2a4c9a70e98102301c" }, "downloads": -1, "filename": "threadio-0.1.tar.gz", "has_sig": false, "md5_digest": "575ce52cd7933121ec0424e90d49624e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2207, "upload_time": "2012-12-14T08:26:08", "url": "https://files.pythonhosted.org/packages/cd/e2/10e6d20761e127de0531331fccccd04a4e6c49e3bd3e03858ad76aee1fdf/threadio-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "575ce52cd7933121ec0424e90d49624e", "sha256": "150ddac53b229611684956d5dd2e4893f220bea622e40b2a4c9a70e98102301c" }, "downloads": -1, "filename": "threadio-0.1.tar.gz", "has_sig": false, "md5_digest": "575ce52cd7933121ec0424e90d49624e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2207, "upload_time": "2012-12-14T08:26:08", "url": "https://files.pythonhosted.org/packages/cd/e2/10e6d20761e127de0531331fccccd04a4e6c49e3bd3e03858ad76aee1fdf/threadio-0.1.tar.gz" } ] }