{ "info": { "author": "Jeremy Lowery", "author_email": "jeremy@bitrel.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Systems Administration", "Topic :: Text Processing" ], "description": "Encode and Decode Textual Data into Rich Python Data Structures\n===============================================================\n\nstypes is a text parsing, conversion and formatting library written to\nefficiently handle large fixed-width text record data files. Convert text\nstreams into dictionaries, lists, tuples, named tuples, ordered dictionaries\nand more using text layout specifications. Nested data structures and\nrepeating elements are also supported.\n\nOne of the main design goals of the library was to handle legacy text-based\nrecord data that is commonly found in COBOL system. Of course, the library\ncan be used to handle any fixed layout textual data.\n\nA simple example of turning some text into a Named Tuple:\n\n::\nfrom decimal import Decimal\nfrom stypes import NamedTuple, Integer, Numeric\nspec = NamedTuple([\n\t('name', 10),\n\t('age', Integer(3)),\n\t('weight', Numeric('999V99'))])\ntext = \"Johnson 2109750\"\nrec = spec.unpack(text)\nassert rec.name == 'Johnson'\nassert rec.age == 21\nassert rec.weight == Decimal(\"97.5\")\n\n\n\nAnd a more interesting example using nested data structures of a list of\nrecords and actually updating a record.\n\n::\nfrom stypes import Array, Dict, Integer, Numeric\nitem = Dict([('line_no', Integer(2)),\n\t('item_no', Integer(5)),\n\t('total', Numeric(\"999.99\"))])\ninvoice = Dict([\n ('invoice_no', Integer(4)),\n ('total', Numeric(\"999.99\")),\n ('items', Array(3, item))])\ntext = \"0001200.450100004002.000200006198.50\"\nrec = invoice.unpack(inv)\n# rec is now\n {'invoice_no': 1,\n 'items': [{'item_no': 4, 'line_no': 1, 'total': Decimal('2.00')},\n\t {'item_no': 6, 'line_no': 2, 'total': Decimal('198.50')},\n\t {'item_no': None, 'line_no': None, 'total': None}],\n 'total': Decimal('200.45')}\n\n# Set the last invoice item\nrec['items'][-1] = {\n 'line_no': 3,\n 'item_no': 10,\n 'total': Decimal(\"20\")}\n\n# Update the invoice total\nrec['total'] = sum(i['total'] for i in rec['items'])\nprint rec.pack()\n# '0001220.500100004002.000200006198.500300010020.00'\n\n\n\n\nSee the included tests.py file for more examples.\n\nErrors in Data\n------------------------------------\nstypes takes the approach that errors in the textual data are not exceptions.\nData errors are to be expected and should be handled in the normal flow of the\nprogram.\n\nstypes includes the notion of an UnconvertedValue. When parsing text that cannot be\ndeserialized into the destination format, an UnconvertedValue instance is placed in\nit's place. All container objects have a has_unconverted() method which allows\nclient code to easily detect if there was an error.\n\n::\nfmt = List([Numeric('99V9'), Integer(4)])\nrec = fmt.unpack(\"44X001A\")\nprint rec\n[,\n ]\n\nassert rec.has_unconverted() == True\n\nprint rec[0].reason\n \"Expected 1 digits. Found 'X'\"\n\nprint rec[1].reason\n 'expecting all digits for integer'\n\n\n\nInstallation\n------------------------\n\nYou can install stypes using pip\n::\npip install stypes\n\n\n\nor download from PyPI at https://pypi.python.org/pypi/stypes/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jeremylowery/stypes", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "stypes", "package_url": "https://pypi.org/project/stypes/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/stypes/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/jeremylowery/stypes" }, "release_url": "https://pypi.org/project/stypes/0.1.44/", "requires_dist": null, "requires_python": null, "summary": "Encode and Decode Textual Data into Rich Python Data Structures", "version": "0.1.44" }, "last_serial": 2985337, "releases": { "0.1.1a1": [ { "comment_text": "", "digests": { "md5": "37a41632018775592cdf59edabc1c0b6", "sha256": "55422dfaf5bb72afb55b853e2f166bc3fc91e39d80014aee4d1149c3952c273f" }, "downloads": -1, "filename": "stypes-0.1.1a1.tar.gz", "has_sig": false, "md5_digest": "37a41632018775592cdf59edabc1c0b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17841, "upload_time": "2013-09-13T21:08:13", "url": "https://files.pythonhosted.org/packages/d0/b9/66935628976233882143029bb452526600efcd2636e2cd8610c47104d2df/stypes-0.1.1a1.tar.gz" } ], "0.1.1a2": [ { "comment_text": "", "digests": { "md5": "7766ddc6cd6775c8352c4f2d0eba64aa", "sha256": "291abffe655f5700f45df3b4c837f31d1f32fc011dfa076513f2f30994771f71" }, "downloads": -1, "filename": "stypes-0.1.1a2.tar.gz", "has_sig": false, "md5_digest": "7766ddc6cd6775c8352c4f2d0eba64aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17839, "upload_time": "2013-09-13T21:11:54", "url": "https://files.pythonhosted.org/packages/4d/0a/3d6d0223f6e08dfb9cb243ee0476eca3c5b02ae0fec80dbaf8f6237a2eb6/stypes-0.1.1a2.tar.gz" } ], "0.1.1a3": [ { "comment_text": "", "digests": { "md5": "3573281f90ab11d1c622c2ed20e18659", "sha256": "dc5cad3af6e1fb90d7648af03cb6fe85477a8558258835b9797dc231fb7dba6c" }, "downloads": -1, "filename": "stypes-0.1.1a3.tar.gz", "has_sig": false, "md5_digest": "3573281f90ab11d1c622c2ed20e18659", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18109, "upload_time": "2014-05-14T12:14:16", "url": "https://files.pythonhosted.org/packages/6f/6f/8be6ac60d7663ca4329290c09fefe8b9e77b3a0450589f0e9bfa02744b78/stypes-0.1.1a3.tar.gz" } ], "0.1.2b1": [ { "comment_text": "", "digests": { "md5": "d6463a686dd49cd96eab021486145238", "sha256": "22c886eca877bb279b115a648de6f06c57074776fa979d9545171c7d96a357ed" }, "downloads": -1, "filename": "stypes-0.1.2b1.tar.gz", "has_sig": false, "md5_digest": "d6463a686dd49cd96eab021486145238", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17962, "upload_time": "2014-10-04T20:56:16", "url": "https://files.pythonhosted.org/packages/16/b8/fbd8a22b1ff2fbf11a37513963a71b8aa34d520c045b8210fcc4eb39e8a4/stypes-0.1.2b1.tar.gz" } ], "0.1.41": [ { "comment_text": "", "digests": { "md5": "d3a9adbb15b2d571fbaa81dafa15e0af", "sha256": "d13492b37ba2c63d4cd5e735062f7edee8fd14288b573798f9838c66ae26b08c" }, "downloads": -1, "filename": "stypes-0.1.41.tar.gz", "has_sig": false, "md5_digest": "d3a9adbb15b2d571fbaa81dafa15e0af", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19437, "upload_time": "2017-01-09T17:24:45", "url": "https://files.pythonhosted.org/packages/de/36/f4148067f1118fa9fddc9014af83aa76225e84459dd27c4e6ebf4caa58c5/stypes-0.1.41.tar.gz" } ], "0.1.42": [ { "comment_text": "", "digests": { "md5": "af5e6c3662a638cc7936afa946652d09", "sha256": "36494f4e39fbf947de1ad5a0949c9280ef0c0b3c23cf4c0cb5c88fdbf19e482b" }, "downloads": -1, "filename": "stypes-0.1.42.tar.gz", "has_sig": false, "md5_digest": "af5e6c3662a638cc7936afa946652d09", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19457, "upload_time": "2017-01-09T17:36:33", "url": "https://files.pythonhosted.org/packages/78/c4/22e6221c032cccfa6464be9715354df754a94eaabe5e5966e289fda2bddc/stypes-0.1.42.tar.gz" } ], "0.1.43": [ { "comment_text": "", "digests": { "md5": "82fc56753d513c92552ae15a6e7538e2", "sha256": "90f882b206425aa89e89f6581f28c367788767ff08bf6997374fb75b42a70d16" }, "downloads": -1, "filename": "stypes-0.1.43.tar.gz", "has_sig": false, "md5_digest": "82fc56753d513c92552ae15a6e7538e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20011, "upload_time": "2017-06-27T20:20:01", "url": "https://files.pythonhosted.org/packages/31/d9/277022691ce20cd1b2118f8be215eef17f262618ef84dc9a22861fc3a421/stypes-0.1.43.tar.gz" } ], "0.1.44": [ { "comment_text": "", "digests": { "md5": "543eeeb276a34a0b7362a5a99537aaa3", "sha256": "dc7013c0087d0f531251d36fc9b6b0234110b9cd0443928a2e18f90c6e9d959c" }, "downloads": -1, "filename": "stypes-0.1.44.tar.gz", "has_sig": false, "md5_digest": "543eeeb276a34a0b7362a5a99537aaa3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20036, "upload_time": "2017-06-28T16:22:26", "url": "https://files.pythonhosted.org/packages/ec/fc/d885bb74ba31988399cf4fe644aba8191549eb96f3945a865e698bc4f23e/stypes-0.1.44.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "543eeeb276a34a0b7362a5a99537aaa3", "sha256": "dc7013c0087d0f531251d36fc9b6b0234110b9cd0443928a2e18f90c6e9d959c" }, "downloads": -1, "filename": "stypes-0.1.44.tar.gz", "has_sig": false, "md5_digest": "543eeeb276a34a0b7362a5a99537aaa3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20036, "upload_time": "2017-06-28T16:22:26", "url": "https://files.pythonhosted.org/packages/ec/fc/d885bb74ba31988399cf4fe644aba8191549eb96f3945a865e698bc4f23e/stypes-0.1.44.tar.gz" } ] }