{ "info": { "author": "Benjamin Dauvergne", "author_email": "bdauvergne@entrouvert.com", "bugtrack_url": null, "classifiers": [], "description": "poormanschema\n=============\n\nSimple and effective schema checker::\n\n >>> from poormanschema import *\n >>> check({'first_name': 1}. [{'first_name': str, 'last_name': str}])\n ValueError: {first_name} should be of type \"str\"\n\nIt can also normalize data::\n\n >>> check(' 2016-03-23T12:23:12 ', OR(STRIP, ISO8601))\n '2016-03-23T12:23:12'\n\nOr convert them on entry::\n\n >>> repr(check(['1.3'], [DECIMAL]))\n [Decimal('1.3')]\n\nList of predicates\n==================\n\n* `check(data, schema, path='')` - check `data` agains `schema`, prefix error messages with `path`\n* `OR(*schemas)` - first schema to match is returned\n* `ANY` - can be anything\n* `AND(*schemas)` - all schemas must match\n* `MANDATORY(schema)` - only useful on dict values, indicate the corresponding key is mandatory, all other keys are optional\n* `RE(regexp, repl=None, count=0, flag=0)` - value must be a string matching `regexp`\n* `ISO8601` - value must be a string like `'2016-09-07T12:12:34'`\n* `NORMALIZE(schema, convert)` - apply schema then apply converter to the result\n* `STRIP` - remove starting and ending spaces\n* `LOWER` - lowercase the string\n* `UPPER` - uppercase the string\n* `DECIMAL` - convert a string into a decimal.Decimal object\n\nExemple: SCIM 1.0 Core Schema of an User object\n===============================================\n\n::\n\n schema = {\n 'schemas': MANDATORY([basestring]),\n 'id': MANDATORY(basestring),\n 'externalId': MANDATORY(basestring),\n 'userName': MANDATORY(unicode),\n 'name': MANDATORY({\n 'formatted': MANDATORY(str),\n 'familyName': str,\n 'givenName': str,\n 'middleName': str,\n 'honorificPrefix': str,\n 'honorificSuffix': str,\n }),\n 'urn:ietf:params:scim:schemas:extension:enterprise:2.0:User': MANDATORY({\n 'employeeNumber': OR(STRIP, RE(r'^\\d+$')),\n 'costCenter': OR(STRIP, RE(r'^\\d+$')),\n }),\n 'meta': {\n 'resourceType': 'User',\n 'created': ISO8601,\n 'lastModified': ISO8601,\n 'version': RE(r'^(W\\\\)?\"[^\"]\"$'),\n 'location': str,\n }\n }", "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": "MIT", "maintainer": null, "maintainer_email": null, "name": "poormanschema", "package_url": "https://pypi.org/project/poormanschema/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/poormanschema/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/poormanschema/0.0.0.1/", "requires_dist": null, "requires_python": null, "summary": "Very simple and effective schema checker", "version": "0.0.0.1" }, "last_serial": 2330258, "releases": { "0.0.0.1": [ { "comment_text": "", "digests": { "md5": "94ce4cb132da9cc7227d0a47845ed19c", "sha256": "f13c5c6ac6e29d86adab0e2ab8d9c19978574f9814c8185a830ec002218bc34f" }, "downloads": -1, "filename": "poormanschema-0.0.0.1.tar.gz", "has_sig": false, "md5_digest": "94ce4cb132da9cc7227d0a47845ed19c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3723, "upload_time": "2016-09-07T21:55:27", "url": "https://files.pythonhosted.org/packages/f4/a0/8246b2e981dace63bc43630aee2e2aac04c72e62c1c45aacac1fe3d3a450/poormanschema-0.0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "94ce4cb132da9cc7227d0a47845ed19c", "sha256": "f13c5c6ac6e29d86adab0e2ab8d9c19978574f9814c8185a830ec002218bc34f" }, "downloads": -1, "filename": "poormanschema-0.0.0.1.tar.gz", "has_sig": false, "md5_digest": "94ce4cb132da9cc7227d0a47845ed19c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3723, "upload_time": "2016-09-07T21:55:27", "url": "https://files.pythonhosted.org/packages/f4/a0/8246b2e981dace63bc43630aee2e2aac04c72e62c1c45aacac1fe3d3a450/poormanschema-0.0.0.1.tar.gz" } ] }