{ "info": { "author": "Svarga Developers", "author_email": "svarga@librelist.com", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "============\n Procrustes\n============\n\nProcrustes is a validation library, suitable for validating user input data,\ni.e. web forms or API calls. With procrustes you can validate any structure.\n\nFor doing this procrustes has three container classes - Tuple, List and Dict.\nTuple come from FP, has fixed count of elements with fixed types.\nList can include any amount of values of one type.\nAnd Dict is a dict.\n\n\nProcrustes consist of validators and forms. You can use validators without\nforms functionality. Forms adds mainly widgets and form data parsing.\n\n\nValidators\n~~~~~~~~~~\n\nMost simple what you can to do with procrustes is build validator and use it:\n\n >>> from procrustes import validators as v\n >>> two_strings_v = v.Tuple(v.String(), v.String())\n >>> auth = two_strings_v(['login', 'password'])\n >>> auth.data\n ('login', 'password')\n >>> auth.errors\n []\n >>> auth = two_strings_v(['login'])\n >>> auth.data\n >>> auth.errors\n ['Must be iterable of length 2']\n\nWe have very powerful `List`:\n\n >>> list_of_pairs_v = v.List(two_strings_v)\n >>> pairs = list_of_pairs_v([(str(x), str(x)) for x in xrange(10)])\n >>> pairs.data\n [('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('6', '6'), ('7', '7'), ('8', '8'), ('9', '9')]\n >>> pairs.errors\n []\n\n`List`, `Tuple` and `Dict` are recursive, so you can build any data structure you want.\n\n`Dict` example:\n\n >>> dict_v = v.Dict({'pair': two_strings_v, 'pairs': list_of_pairs_v})\n >>> data = dict_v({'pair': ['a', 'b'], 'pairs': [['a', 'b'], ['c', 'd']]})\n >>> data.data\n {'pair': ('a', 'b'), 'pairs': [('a', 'b'), ('c', 'd')]}\n >>> data.errors\n []\n\nValidators have `required` keyword argument:\n\n >>> two_strings_v = v.Tuple(v.String(), v.String(), required=False)\n >>> dict_v = v.Dict({'pair': two_strings_v, 'pairs': list_of_pairs_v})\n >>> data = dict_v({'pairs': [['a', 'b'], ['c', 'd']]})\n >>> data.data\n {'pair': None, 'pairs': [('a', 'b'), ('c', 'd')]}\n >>> data.errors\n []\n\nFlat\n~~~~\n\nProcrustes can `flat` data:\n\n >>> list(data.flatten())\n [('pairs__0__0', 'a'), ('pairs__0__1', 'b'), ('pairs__1__0', 'c'), ('pairs__1__1', 'd')]\n\nAnd unflat it back:\n\n >>> dict_v.deepen(dict([('pairs__0__0', 'a'), ('pairs__0__1', 'b'), ('pairs__1__0', 'c'), ('pairs__1__1', 'd')]))\n {'pair': (None, None), 'pairs': [('c', 'd'), ('a', 'b')]}\n\n\nForms\n~~~~~\n\nForms derived from validators and implemented as mixins to them. Every Field\ncan work as form. Your form may consist from one `forms.String()`.\nIn addition to validators forms adds methods `widgets`, `template_widgets`,\n`unflat` and `is_valid`.", "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/Deepwalker/Procrustes/", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "procrustes", "package_url": "https://pypi.org/project/procrustes/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/procrustes/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/Deepwalker/Procrustes/" }, "release_url": "https://pypi.org/project/procrustes/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "validation library", "version": "0.2.1" }, "last_serial": 796718, "releases": { "0.1": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "953a3b1c99d9af8f50096309516e7d44", "sha256": "69ae1ec160cb22a71e96eca509faddb4ec927ce9320412d0947bbd96b0519a9c" }, "downloads": -1, "filename": "procrustes-0.2.0.tar.gz", "has_sig": false, "md5_digest": "953a3b1c99d9af8f50096309516e7d44", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5969, "upload_time": "2011-09-06T14:35:58", "url": "https://files.pythonhosted.org/packages/d5/cd/fcf8f9dd5ea1adb57afefdd2bbe5288d6150489b7e517b592dc902682d63/procrustes-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "d55cc06074d286d298f2621dd74316f5", "sha256": "6c0dd8a0f871d3523a4de0c89ea03054b837ef2a30c91dc05ceab4fc1d282657" }, "downloads": -1, "filename": "procrustes-0.2.1.tar.gz", "has_sig": false, "md5_digest": "d55cc06074d286d298f2621dd74316f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6377, "upload_time": "2011-10-17T18:07:39", "url": "https://files.pythonhosted.org/packages/cc/6a/27c922e36e81616fedfe6f66b77b800639148b26dd18ada15e0b63872731/procrustes-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d55cc06074d286d298f2621dd74316f5", "sha256": "6c0dd8a0f871d3523a4de0c89ea03054b837ef2a30c91dc05ceab4fc1d282657" }, "downloads": -1, "filename": "procrustes-0.2.1.tar.gz", "has_sig": false, "md5_digest": "d55cc06074d286d298f2621dd74316f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6377, "upload_time": "2011-10-17T18:07:39", "url": "https://files.pythonhosted.org/packages/cc/6a/27c922e36e81616fedfe6f66b77b800639148b26dd18ada15e0b63872731/procrustes-0.2.1.tar.gz" } ] }