{ "info": { "author": "Alexander Shpilkin", "author_email": "ashpilkin@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "``simplejsonseq`` is a simple encoder and decoder for `RFC 7464`_ JSON\ntext sequences with an API mirroring that of json and simplejson. A\nJSON text sequence is a collection of JSON items in a text file, with\neach item preceded by an ASCII record separator (^^, U+1E) and usually\nfollowed by a line feed (^J, U+0A).\n\n.. The following examples will not pass doctest in Python < 3.5 (wrong\n StringIO in < 3, no JSONDecodeError in < 3.5).\n\nTo convert a file to an iterable or to write out an iterable into a file,\nuse the ``dump()`` and ``load()`` functions, similar to the json module:\n\n>>> import io, simplejsonseq # In Python < 3, use cStringIO not io\n>>> s = io.StringIO()\n>>> simplejsonseq.dump(['hello', 'world'], s, buffered=False)\n>>> s.getvalue()\n'\\x1e\"hello\"\\n\\x1e\"world\"\\n'\n>>> for e in simplejsonseq.load(io.StringIO('\\x1e\"hello\"\\n\\x1e\"world\"\\n')):\n... print(e)\n...\nhello\nworld\n\nThe ``buffered=False`` setting flushes every item to storage as soon as\nit is written instead of doing it only once at the end of ``dump()``.\n\nBy default, the reader accepts unparseable items and wraps them into\n``InvalidJSON`` objects, but the writer refuses to write these. Use the\n``strict`` argument of either ``load`` and ``dump`` or ``JSONSeqReader``\nand ``JSONSeqWriter`` to tune this behaviour, but bear in mind that the\nRFC recommends recovering from invalid input items:\n\n>>> import sys; sys.stderr = sys.stdout # placate doctest\n>>> import io, simplejsonseq # In Python < 3, use cStringIO not io\n>>> value = '\\x1e{\"parrot\":\\n'\n>>> items = list(simplejsonseq.load(value)) # doctest: +ELLIPSIS\n/...: InvalidJSONWarning: Read invalid JSON: '{\"parrot\":\\n'\n ...\n>>> items\n[InvalidJSON('{\"parrot\":\\n', JSONDecodeError('Expecting value: line 2 column 1 (char 11)'))]\n>>> list(simplejsonseq.load(value, strict=True))\nTraceback (most recent call last):\n ...\njson.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 11)\n>>> s = io.StringIO()\n>>> simplejsonseq.dump(items, s)\nTraceback (most recent call last):\n ...\nTypeError: Object of type InvalidJSON is not JSON serializable\n>>> s = io.StringIO()\n>>> simplejsonseq.dump(items, s, strict=False) # doctest:+ELLIPSIS\n/...: InvalidJSONWarning: Wrote invalid JSON: '{\"parrot\":\\n'\n ...\n>>> s.getvalue() == value\nTrue\n\nFor more sophisticated processing, use ``JSONSeqReader`` and\n``JSONSeqWriter``. These can also function as context managers to close\nthe underlying file, if necessary:\n\n>>> from simplejsonseq import JSONSeqReader, JSONSeqWriter\n>>> test = ['hello', 'world']\n>>> with JSONSeqWriter(open(\"/tmp/test.jsonseq\", 'w'),\n... buffered=False) as w:\n... w.write(test[0])\n... w.write(test[1])\n...\n>>> with JSONSeqReader(open(\"/tmp/test.jsonseq\", 'r')) as r:\n... print(list(r) == test)\n...\nTrue\n\nIn addition to passing ``buffered=False`` to the constructor of\n``JSONSeqWriter``, it is also possible to flush unwritten data\nexplicitly using the ``flush()`` method, or to pass ``flush=True`` to an\nindividual ``write()`` call to flush all data at the end of the call.\nIt's pointless to do either with a writer constructed with\n``buffered=False``, of course, as it flushes after every entry anyway.\n\nBoth the functions and the class constructors pass all extra keyword\narguments to the underlying ``JSONDecoder`` or ``JSONEncoder``. This\ncan be used, for example, to dump the entries in a more readable (but\nstill valid!) format:\n\n>>> import io, simplejsonseq # In Python < 3, use cStringIO not io\n>>> value = [True, {'holy': 'grenade', 'killer': 'bunny'}]\n>>> s = io.StringIO()\n>>> simplejsonseq.dump(value, s, indent=2)\n>>> print(s.getvalue().replace('\\x1e', '!'), end='')\n!true\n!{\n \"holy\": \"grenade\",\n \"killer\": \"bunny\"\n}\n>>> list(simplejsonseq.load(s.getvalue())) == value\nTrue\n\nDetailed documentation is available in the docstrings.\n\n.. _RFC 7464: https://tools.ietf.org/html/rfc7464\n\n\n", "description_content_type": "text/x-rst", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/alexshpilkin/simplejsonseq", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "simplejsonseq", "package_url": "https://pypi.org/project/simplejsonseq/", "platform": "", "project_url": "https://pypi.org/project/simplejsonseq/", "project_urls": { "Homepage": "https://github.com/alexshpilkin/simplejsonseq" }, "release_url": "https://pypi.org/project/simplejsonseq/0.2.1/", "requires_dist": null, "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "summary": "Encoder and decoder for JSON text sequences", "version": "0.2.1" }, "last_serial": 4792639, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "10ee3df9a314b40bfd9406ba211146e7", "sha256": "9d72977220b31fdcca4b7cf75a1597e1c71672ceb18b087df44205c060e6fc9a" }, "downloads": -1, "filename": "simplejsonseq-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "10ee3df9a314b40bfd9406ba211146e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 2406, "upload_time": "2018-09-22T23:51:28", "url": "https://files.pythonhosted.org/packages/76/f7/9e0b21c7125d68178960c3c25751ee5d3928e744e0f8a43f4a86bcc5319a/simplejsonseq-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60fe4ccf23dc620699b66143d6342057", "sha256": "af2be03609f9872a3f50b6ede8b576151bc1b6a4ba876e8ba8ff7e8895c245c6" }, "downloads": -1, "filename": "simplejsonseq-0.1.0.tar.gz", "has_sig": false, "md5_digest": "60fe4ccf23dc620699b66143d6342057", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2057, "upload_time": "2018-09-22T23:51:29", "url": "https://files.pythonhosted.org/packages/9a/55/aa89854a45bad7582512df7c28261eb9fbc36d8114e0584dd903a38f6a3e/simplejsonseq-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "591ca43f488b6b4b5d4789a69f5210c3", "sha256": "ad1791bdcfbff630bde65480c2df4c0542692cf4eaf67648af4433177263f2c9" }, "downloads": -1, "filename": "simplejsonseq-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "591ca43f488b6b4b5d4789a69f5210c3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10379, "upload_time": "2019-02-06T14:42:32", "url": "https://files.pythonhosted.org/packages/8a/1e/26970af96a4ba831ada063fbcef2e1d5aaf01031fd9258a647f797438f07/simplejsonseq-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a6744a246496bf27821d32d3bd06a184", "sha256": "f98476ae73959e8adbcceb0900b60814ac7e5dd2280ec20437dba2ab20049c43" }, "downloads": -1, "filename": "simplejsonseq-0.2.0.tar.gz", "has_sig": false, "md5_digest": "a6744a246496bf27821d32d3bd06a184", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11621, "upload_time": "2019-02-06T14:42:34", "url": "https://files.pythonhosted.org/packages/cf/26/cbcadda10dcec19114e8b5cf1add38f966c2425693bef4e05e70708a3bc8/simplejsonseq-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "fa56ed9bc4d0bc7c8a92e590431bce1d", "sha256": "fb057f1014d74a9f36c400665a06638256f196cf6edbfe05cc3c279f5be72ea3" }, "downloads": -1, "filename": "simplejsonseq-0.2.1-py2-none-any.whl", "has_sig": false, "md5_digest": "fa56ed9bc4d0bc7c8a92e590431bce1d", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 11036, "upload_time": "2019-02-07T19:26:44", "url": "https://files.pythonhosted.org/packages/65/55/0a7f82043dba49555ad87f6f51af662b7590f2948d3288eed4af9e1da1cb/simplejsonseq-0.2.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "234714c373bd24f14e7ae12b1d870d4d", "sha256": "dc0879d7a7ebdcc30561484e3960877c5845e85567fe08929bfa2bd7fbdd9df2" }, "downloads": -1, "filename": "simplejsonseq-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "234714c373bd24f14e7ae12b1d870d4d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 11037, "upload_time": "2019-02-07T19:26:46", "url": "https://files.pythonhosted.org/packages/70/14/c34ca006b2ed8a4693e79ca6888b3bd24272067d59ee8e366115cbd66fcc/simplejsonseq-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0746f70046ee362e9f5905c2289e7924", "sha256": "fbb9da52ec2f6841c4716fd38789dccc91429df8c7ca29952403749d102b5a52" }, "downloads": -1, "filename": "simplejsonseq-0.2.1.tar.gz", "has_sig": false, "md5_digest": "0746f70046ee362e9f5905c2289e7924", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 12656, "upload_time": "2019-02-07T19:26:48", "url": "https://files.pythonhosted.org/packages/96/c9/ef86d520b182db2241674cd4dad738697681567168b35e9ffd44200a2d28/simplejsonseq-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fa56ed9bc4d0bc7c8a92e590431bce1d", "sha256": "fb057f1014d74a9f36c400665a06638256f196cf6edbfe05cc3c279f5be72ea3" }, "downloads": -1, "filename": "simplejsonseq-0.2.1-py2-none-any.whl", "has_sig": false, "md5_digest": "fa56ed9bc4d0bc7c8a92e590431bce1d", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 11036, "upload_time": "2019-02-07T19:26:44", "url": "https://files.pythonhosted.org/packages/65/55/0a7f82043dba49555ad87f6f51af662b7590f2948d3288eed4af9e1da1cb/simplejsonseq-0.2.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "234714c373bd24f14e7ae12b1d870d4d", "sha256": "dc0879d7a7ebdcc30561484e3960877c5845e85567fe08929bfa2bd7fbdd9df2" }, "downloads": -1, "filename": "simplejsonseq-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "234714c373bd24f14e7ae12b1d870d4d", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 11037, "upload_time": "2019-02-07T19:26:46", "url": "https://files.pythonhosted.org/packages/70/14/c34ca006b2ed8a4693e79ca6888b3bd24272067d59ee8e366115cbd66fcc/simplejsonseq-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0746f70046ee362e9f5905c2289e7924", "sha256": "fbb9da52ec2f6841c4716fd38789dccc91429df8c7ca29952403749d102b5a52" }, "downloads": -1, "filename": "simplejsonseq-0.2.1.tar.gz", "has_sig": false, "md5_digest": "0746f70046ee362e9f5905c2289e7924", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", "size": 12656, "upload_time": "2019-02-07T19:26:48", "url": "https://files.pythonhosted.org/packages/96/c9/ef86d520b182db2241674cd4dad738697681567168b35e9ffd44200a2d28/simplejsonseq-0.2.1.tar.gz" } ] }