{ "info": { "author": "Gram Orsinium", "author_email": "master_fess@mail.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "\nVAA\n===\n\nVAlidators Adapter makes validation by any existing validator with the same interface.\n\nSupported validators:\n\n.. list-table::\n :header-rows: 1\n\n * - validator\n - adapter\n * - `Cerberus `_\n - ``va.cerberus``\n * - `Django Forms `_\n - ``va.django``\n * - `Marshmallow `_\n - ``va.marshmallow``\n * - `PySchemes `_\n - ``va.pyschemes``\n * - `Django REST Framework `_\n - ``va.restframework``\n * - `WTForms `_\n - ``va.wtforms``\n\n\n.. code-block:: bash\n\n python3 -m pip install --user vaa\n\nExample\n-------\n\n.. code-block:: python\n\n import marshmallow\n import vaa\n\n\n @vaa.marshmallow\n class Scheme(marshmallow.Schema):\n id = marshmallow.fields.Int(required=True)\n name = marshmallow.fields.Str(required=True)\n\nValidating data\n---------------\n\nAll schemes adopted by va has the same interface:\n\n.. code-block:: python\n\n validator = Scheme({'id': '1', 'name': 'Oleg'})\n validator.is_valid() # True\n validator.cleaned_data\n # {'name': 'Oleg', 'id': 1}\n\n validator = Scheme({'id': 'no', 'name': 'Oleg'})\n validator.is_valid() # False\n validator.errors\n # {'id': ['Not a valid integer.']}\n\nIf error isn't for specific field, iw will be in ``__all__`` key.\n\nSimple scheme\n-------------\n\nIf you want to do validation with simple function, you can use ``va.simple`` adapter. For example, you want to check that in dict ``{'a': ..., 'b': ...}`` both values are positive. There are many ways to do so.\n\nIt can return ``bool``\\ :\n\n.. code-block:: python\n\n @vaa.simple\n def validate(a, b) -> bool:\n return a > 0 and b > 0\n\nOr return message for error:\n\n.. code-block:: python\n\n @vaa.simple\n def validate(a, b) -> bool:\n if a > 0 and b > 0:\n return True\n return 'should be positive'\n\nOr return errors dict:\n\n.. code-block:: python\n\n @vaa.simple\n def validate(a, b) -> bool:\n if a <= 0:\n return {'a': 'should be positive'}\n if b <= 0:\n return {'b': 'should be positive'}\n return True\n\nOr raise ``va.ValidationError`` with error message or dict:\n\n.. code-block:: python\n\n @vaa.simple\n def validate(a, b) -> bool:\n if a > 0 and b > 0:\n return True\n raise vaa.ValidationError('should be positive')\n\nAlso, if you want to get the original dict without unpacking it into keyword arguments, do a function that accepts only one ``_`` argument:\n\n.. code-block:: python\n\n @vaa.simple\n def validate(_):\n return _['a'] > 0 and _['b'] > 0\n\nIn that dict keys can be accessed as attributes:\n\n.. code-block:: python\n\n @vaa.simple\n def validate(_):\n return _.a > 0 and _.b > 0\n\nChoose the best way and follow it. Avoid mixing them in one project.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/life4/vaa", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "vaa", "package_url": "https://pypi.org/project/vaa/", "platform": "", "project_url": "https://pypi.org/project/vaa/", "project_urls": { "Homepage": "https://github.com/life4/vaa" }, "release_url": "https://pypi.org/project/vaa/0.1.4/", "requires_dist": [ "cerberus; extra == \"validators\"", "django; extra == \"validators\"", "djangorestframework; extra == \"validators\"", "marshmallow>=3.0.1; extra == \"validators\"", "pyschemes; extra == \"validators\"", "pytest; extra == \"tests\"", "wtforms; extra == \"validators\"" ], "requires_python": "", "summary": "Validators Adapter. The common interface for all validators.", "version": "0.1.4" }, "last_serial": 5917051, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "959271db4fd7d3122db2544f3ca79876", "sha256": "77bc8d90d6f411ed62d890de572c541ef89442f60207cb0d51d22ee7a68123dd" }, "downloads": -1, "filename": "vaa-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "959271db4fd7d3122db2544f3ca79876", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4082, "upload_time": "2019-10-01T14:10:44", "url": "https://files.pythonhosted.org/packages/73/9f/e6e8812eda67e9b2be32f2c959c400b58a6a76aaecb841271509de56689a/vaa-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d6391d9c35ae3109e852a1f0f88f573b", "sha256": "3483516ef271f2c1b4e137b8200b08f3ed9ad98355532a1a709280896731221e" }, "downloads": -1, "filename": "vaa-0.1.0.tar.gz", "has_sig": false, "md5_digest": "d6391d9c35ae3109e852a1f0f88f573b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2418, "upload_time": "2019-10-01T14:10:48", "url": "https://files.pythonhosted.org/packages/ad/65/05dd7519628af43ace3ea571536bf33392942b8073db0da5b7ae6f61c728/vaa-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "71a1710ef84f4ede217357f8e000d982", "sha256": "65e3d40be28daa3fc2f27126609d716ebc88616b23c4d8918bd0bcd28a4ac8f6" }, "downloads": -1, "filename": "vaa-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "71a1710ef84f4ede217357f8e000d982", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 4081, "upload_time": "2019-10-01T14:11:36", "url": "https://files.pythonhosted.org/packages/ff/90/b545ad4ec5068c8751c56550d5d85ce1bb47016fb3d5a0c8d97e14321ebb/vaa-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "19a061c8f8580afe63f755928075dd2d", "sha256": "d5f5c9d25937c2fa76f27c87684c80a206d414c58965689c1dfcc8e2e8b13f07" }, "downloads": -1, "filename": "vaa-0.1.1.tar.gz", "has_sig": false, "md5_digest": "19a061c8f8580afe63f755928075dd2d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2417, "upload_time": "2019-10-01T14:11:38", "url": "https://files.pythonhosted.org/packages/5f/b0/2987ade6f03caeec0b56f775f8a7a4494942740e0b53f0b58b7d0a3cc7c8/vaa-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "dd74251421c8e7c156d9631579cdc693", "sha256": "1c1136c43d2aa6c0073d97afef367f0b1f13f7a88851458a7e7def445de16d9d" }, "downloads": -1, "filename": "vaa-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "dd74251421c8e7c156d9631579cdc693", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6028, "upload_time": "2019-10-01T14:18:27", "url": "https://files.pythonhosted.org/packages/1f/59/fab946270c1f1f0c005db62da21ad1a2a8e9c81eb5918a173048f524ce13/vaa-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ed9b01ad0a56393165ffdf238bcd9aa6", "sha256": "7102c656090208d68e460bce03abed5c5e973637afb1f7c375f9a9b2df8c07d6" }, "downloads": -1, "filename": "vaa-0.1.2.tar.gz", "has_sig": false, "md5_digest": "ed9b01ad0a56393165ffdf238bcd9aa6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4851, "upload_time": "2019-10-01T14:18:29", "url": "https://files.pythonhosted.org/packages/d9/8a/12eb1c54fc9302d2fc1a81ff742bce0b41c293ba7e69f7734e813808758a/vaa-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "e20e8bc8717cdd18864e5d29a2146de2", "sha256": "260c853653b0b2eeb0bde6e1f7402f7500f36d3fdea41d2699bdf31fa57142f9" }, "downloads": -1, "filename": "vaa-0.1.3-py3-none-any.whl", "has_sig": false, "md5_digest": "e20e8bc8717cdd18864e5d29a2146de2", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6088, "upload_time": "2019-10-01T15:49:08", "url": "https://files.pythonhosted.org/packages/c2/4f/2f250019ad95464eb83825519013a160ec946991077fcdd28fe4c96509cd/vaa-0.1.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "52c2c3f41c3a433eba280cfdf9e662db", "sha256": "2c19dcf7b75c5b815c9cb02340db2b38e0e9b3a80e8a29a1524161d4173be7fc" }, "downloads": -1, "filename": "vaa-0.1.3.tar.gz", "has_sig": false, "md5_digest": "52c2c3f41c3a433eba280cfdf9e662db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4899, "upload_time": "2019-10-01T15:49:10", "url": "https://files.pythonhosted.org/packages/fc/1c/2698aaa2daf8fbdba5b0817f003d816a0b583c4925f8c5085c6aa9ae0ce1/vaa-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "2efc0439d069ef1421afe9fe96ae5a94", "sha256": "2fc051e15968012498bb79ef10c667c293a6c71edb0ada2793f5d8ea55a6fae3" }, "downloads": -1, "filename": "vaa-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "2efc0439d069ef1421afe9fe96ae5a94", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6147, "upload_time": "2019-10-02T10:08:09", "url": "https://files.pythonhosted.org/packages/eb/64/5e4a8443e4e4610d1b3fc539e7ca5df149f97e3358e40c8651a98725fd86/vaa-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "09700f00915e9fe8fb70f59947465491", "sha256": "578f2ece43ddf9f5e1adb906737736ddd2db16bdfde7c1b65e1a750fa502c8c0" }, "downloads": -1, "filename": "vaa-0.1.4.tar.gz", "has_sig": false, "md5_digest": "09700f00915e9fe8fb70f59947465491", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11427, "upload_time": "2019-10-02T10:08:10", "url": "https://files.pythonhosted.org/packages/4d/31/e4a7fea6cb674e3461b9a7fd68b72d752fe9203b20d67ae2a96bc529602c/vaa-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2efc0439d069ef1421afe9fe96ae5a94", "sha256": "2fc051e15968012498bb79ef10c667c293a6c71edb0ada2793f5d8ea55a6fae3" }, "downloads": -1, "filename": "vaa-0.1.4-py3-none-any.whl", "has_sig": false, "md5_digest": "2efc0439d069ef1421afe9fe96ae5a94", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6147, "upload_time": "2019-10-02T10:08:09", "url": "https://files.pythonhosted.org/packages/eb/64/5e4a8443e4e4610d1b3fc539e7ca5df149f97e3358e40c8651a98725fd86/vaa-0.1.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "09700f00915e9fe8fb70f59947465491", "sha256": "578f2ece43ddf9f5e1adb906737736ddd2db16bdfde7c1b65e1a750fa502c8c0" }, "downloads": -1, "filename": "vaa-0.1.4.tar.gz", "has_sig": false, "md5_digest": "09700f00915e9fe8fb70f59947465491", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11427, "upload_time": "2019-10-02T10:08:10", "url": "https://files.pythonhosted.org/packages/4d/31/e4a7fea6cb674e3461b9a7fd68b72d752fe9203b20d67ae2a96bc529602c/vaa-0.1.4.tar.gz" } ] }