{ "info": { "author": "Peter Pentchev", "author_email": "roam@ringlet.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: DFSG approved", "License :: Freely Distributable", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# An incremental decoder of bytes into characters and lines\n\n## The DecodeAccumulator class\n\nThe `DecodeAccumulator` class implements an incremental decoder: an object\nthat may be fed bytes (one or several at a time) as they are e.g. read\nfrom a network stream or a subprocess's output, and that adds to a result\nstring as soon as enough bytes have been accumulated to produce a character\nin the specified encoding.\n\nNote that `DecodeAccumulator` objects are immutable value objects:\nthe `add()` method does not modify its invocant, but returns a new\n`DecodeAccumulator` object instead.\n\nSample usage:\n\n while True:\n bb = subprocess.stdout.read(1024)\n if len(bb) == 0:\n break\n acc = acc.add(bb)\n assert(not acc.done)\n if acc.splitter.lines:\n # at least one full line was produced\n (acc, lines) = acc.pop_lines()\n print('\\n'.join(lines)\n\n if acc.buf:\n print('Leftover bytes left in the buffer!', file=sys.stderr)\n\n if acc.splitter.buf:\n print('Incomplete line: ' + acc.splitter.buf)\n\n final = acc.add(None)\n assert(final.splitter.buf == '')\n assert(final.splitter.done)\n assert(final.done)\n if acc.splitter.buf:\n assert(len(final.splitter.lines) == len(acc.splitter.lines) + 1)\n\n## The splitter classes: UniversalNewlines, FixedEOLSplitter, NullSplitter\n\nThe `decode_acc.newlines` module provides three classes that may be used to\nsplit a text string into lines in different ways. The `UniversalNewlines`\nclass does its best to simulate the \"universal newlines\" behavior of `file`\nobjects. The `FixedEOLSplitter` class uses a specified string as a line\nterminator to split on. The `NullSplitter` class does not do any splitting.\n\nSample usage:\n\n spl = newlines.UniversalNewlines()\n for char in input_string:\n spl = spl.add(char)\n spl.add(None)\n\n for (idx, line) in enumerate(spl.lines):\n print('line {idx}: {line}'.format(idx=idx, line=line))\n\n## License and copyright\n\n Copyright (c) 2018 Peter Pentchev \n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions\n are met:\n 1. Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n 2. Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\n THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n SUCH DAMAGE.\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/ppentchev/decode-acc/", "keywords": "", "license": "BSD-2", "maintainer": "", "maintainer_email": "", "name": "decode-acc", "package_url": "https://pypi.org/project/decode-acc/", "platform": "", "project_url": "https://pypi.org/project/decode-acc/", "project_urls": { "Homepage": "https://gitlab.com/ppentchev/decode-acc/" }, "release_url": "https://pypi.org/project/decode-acc/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "Incrementally decode bytes into strings and lines", "version": "1.0.0" }, "last_serial": 4397069, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "2ca0d27594e7c45f72cf01cde983df29", "sha256": "24bd17908aa33eb754d87918eab238a834a2010549ec34944f88ef2036d45a18" }, "downloads": -1, "filename": "decode_acc-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "2ca0d27594e7c45f72cf01cde983df29", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 9519, "upload_time": "2018-09-30T21:04:30", "url": "https://files.pythonhosted.org/packages/19/67/83adb9e4fdb13d90e5e3eb5d62b6a126f8188a2600bfd79375a8040f483d/decode_acc-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5a16a2696f8a60e03af6f4dac253c653", "sha256": "4aad594b6dab1ddf5ed41d3dd22bdb4aa45aac320939a83b32db9cb8f3873b0f" }, "downloads": -1, "filename": "decode_acc-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "5a16a2696f8a60e03af6f4dac253c653", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9519, "upload_time": "2018-09-30T21:09:40", "url": "https://files.pythonhosted.org/packages/1d/28/30393c81a64189bd63bcd5566267b8ec3dca9252fd83336fd707ee7d7b12/decode_acc-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "055474c8bbfa7e026f56aea4728c50c6", "sha256": "a9d1c01bfc5787281c46167b110e2021d10b3c41ae63654c922b5f4f5e3108f5" }, "downloads": -1, "filename": "decode-acc-0.1.0.tar.gz", "has_sig": false, "md5_digest": "055474c8bbfa7e026f56aea4728c50c6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5781, "upload_time": "2018-09-30T21:04:31", "url": "https://files.pythonhosted.org/packages/64/18/7d3c6257f481f6b0fe75672d1371803f5fdcc59817d77e402ae091e2af71/decode-acc-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "375f44751b863a8d897f4e648542e3f4", "sha256": "7bf5ccfb92e385a99478e498ee0f12004166ca2bf521bcdfef9480c8696c14a0" }, "downloads": -1, "filename": "decode_acc-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "375f44751b863a8d897f4e648542e3f4", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 9562, "upload_time": "2018-09-30T21:21:53", "url": "https://files.pythonhosted.org/packages/ea/64/f4a58bc5fdbae125c2ee779760ca8be90be5a13d5f7b5f79d5c88696ec05/decode_acc-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6d223439322f458e3337bf871c782fd5", "sha256": "7c67e1ce8ef07c530c1fe49007ebccabc585a5f257c396a7dc3a650c3f4f5149" }, "downloads": -1, "filename": "decode_acc-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "6d223439322f458e3337bf871c782fd5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9561, "upload_time": "2018-09-30T21:21:54", "url": "https://files.pythonhosted.org/packages/08/21/72ce5be6687f12f0d86630519ff9ae6ac9ad7f699c733ff1226a0b959458/decode_acc-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e38371e209e96870e16a20c6ef6a7ea0", "sha256": "da683536724b2cb1b4daf150d3acde3184a49bb6dbcc07f222c5623fd2299d74" }, "downloads": -1, "filename": "decode-acc-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e38371e209e96870e16a20c6ef6a7ea0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5882, "upload_time": "2018-09-30T21:21:56", "url": "https://files.pythonhosted.org/packages/6d/d9/f41f905035e646362d46123a385297f2471fbaeaae50ca63bc82d3136e6e/decode-acc-0.1.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "86de59350d3afcfd134a59fa44dc52a0", "sha256": "52834deda628340a44e1292e6eaa533abb3850693b2857ccf992538358527b37" }, "downloads": -1, "filename": "decode_acc-1.0.0-py3-none-any.whl", "has_sig": true, "md5_digest": "86de59350d3afcfd134a59fa44dc52a0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14465, "upload_time": "2018-10-20T12:32:25", "url": "https://files.pythonhosted.org/packages/d2/09/46b7dbe7e1f2b117a35d81e214448080f5cdda588f0b0478dd9210803494/decode_acc-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f43893bfce66430674972838b428a45c", "sha256": "47a89e2ba3184f668656de8b25141003375ad7154b1fc8d646b3980745ae1397" }, "downloads": -1, "filename": "decode-acc-1.0.0.tar.gz", "has_sig": true, "md5_digest": "f43893bfce66430674972838b428a45c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8280, "upload_time": "2018-10-20T12:32:28", "url": "https://files.pythonhosted.org/packages/00/41/96269771998196b50e87cd4139f522ec6f01d9fac0a02f36ad3af2e5a9c0/decode-acc-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "86de59350d3afcfd134a59fa44dc52a0", "sha256": "52834deda628340a44e1292e6eaa533abb3850693b2857ccf992538358527b37" }, "downloads": -1, "filename": "decode_acc-1.0.0-py3-none-any.whl", "has_sig": true, "md5_digest": "86de59350d3afcfd134a59fa44dc52a0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 14465, "upload_time": "2018-10-20T12:32:25", "url": "https://files.pythonhosted.org/packages/d2/09/46b7dbe7e1f2b117a35d81e214448080f5cdda588f0b0478dd9210803494/decode_acc-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f43893bfce66430674972838b428a45c", "sha256": "47a89e2ba3184f668656de8b25141003375ad7154b1fc8d646b3980745ae1397" }, "downloads": -1, "filename": "decode-acc-1.0.0.tar.gz", "has_sig": true, "md5_digest": "f43893bfce66430674972838b428a45c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8280, "upload_time": "2018-10-20T12:32:28", "url": "https://files.pythonhosted.org/packages/00/41/96269771998196b50e87cd4139f522ec6f01d9fac0a02f36ad3af2e5a9c0/decode-acc-1.0.0.tar.gz" } ] }