aval


Nameaval JSON
Version 0.0b1 PyPI version JSON
download
home_pagehttps://github.com/hmxustin/aval
SummaryAVal is a class capable of applying a list of validation strategies and an exception handler to an object to be validated. It can be used by calling the validation method as well as a decorator
upload_time2024-07-01 12:37:13
maintainerNone
docs_urlNone
authorMaxim Ustin
requires_python>=3.6
licenseNone
keywords validator validation data validation abstract validator validation strategy validation method validation decorator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aval

## Abstract

**Abstract Validator** (``AVal``) is a class implemented in Python, capable 
of taking a list of specific validation strategies (with parameters), as well 
as a method for handling exceptional situations, and applying these methods to 
the validation object. The **Abstract Validator** can be used by calling the 
validation **method** on an instance of a class, as well as a **decorator**.

## Installation

Use:

``pip install aval``

## Basic usage
```
def _is_string(obj: v.VObj, params: v.VParams) -> None:
    t = type(obj)
    if t != str:
        raise v.ValidationError('Some description')


def _correct_length(obj: v.VObj, params: v.VParams) -> None:
    mn = params.get('min_length', 1)
    mx = params.get('max_length', 32)
    ln = len(obj)
    if not mn <= ln <= mx:
        raise v.ValidationError('Some description'
        )


vld = v.Validator([_is_string, _correct_length])
vld.validate('Any message')
```

## Details

More detailed documentation (in Russian) can be found at
https://docs.mxustin.ru/micro/validator/manual/intro

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hmxustin/aval",
    "name": "aval",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "validator, validation, data validation, abstract validator, validation strategy, validation method, validation decorator",
    "author": "Maxim Ustin",
    "author_email": "mxustin@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c8/62/fd27820a2fbdab6457dd91245df68fa9a76607ae73f43c6899234cfc9c5e/aval-0.0b1.tar.gz",
    "platform": null,
    "description": "# aval\r\n\r\n## Abstract\r\n\r\n**Abstract Validator** (``AVal``) is a class implemented in Python, capable \r\nof taking a list of specific validation strategies (with parameters), as well \r\nas a method for handling exceptional situations, and applying these methods to \r\nthe validation object. The **Abstract Validator** can be used by calling the \r\nvalidation **method** on an instance of a class, as well as a **decorator**.\r\n\r\n## Installation\r\n\r\nUse:\r\n\r\n``pip install aval``\r\n\r\n## Basic usage\r\n```\r\ndef _is_string(obj: v.VObj, params: v.VParams) -> None:\r\n    t = type(obj)\r\n    if t != str:\r\n        raise v.ValidationError('Some description')\r\n\r\n\r\ndef _correct_length(obj: v.VObj, params: v.VParams) -> None:\r\n    mn = params.get('min_length', 1)\r\n    mx = params.get('max_length', 32)\r\n    ln = len(obj)\r\n    if not mn <= ln <= mx:\r\n        raise v.ValidationError('Some description'\r\n        )\r\n\r\n\r\nvld = v.Validator([_is_string, _correct_length])\r\nvld.validate('Any message')\r\n```\r\n\r\n## Details\r\n\r\nMore detailed documentation (in Russian) can be found at\r\nhttps://docs.mxustin.ru/micro/validator/manual/intro\r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "AVal is a class capable of applying a list of validation strategies and an exception handler to an object to be validated. It can be used by calling the validation method as well as a decorator",
    "version": "0.0b1",
    "project_urls": {
        "Download": "https://github.com/hmxustin/aval/archive/refs/heads/main.zip",
        "GitHub": "https://github.com/hmxustin/aval",
        "Homepage": "https://github.com/hmxustin/aval",
        "Manual (RU)": "https://docs.mxustin.ru/micro/validator/manual/intro",
        "ZIP": "https://github.com/hmxustin/aval/archive/refs/heads/main.zip"
    },
    "split_keywords": [
        "validator",
        " validation",
        " data validation",
        " abstract validator",
        " validation strategy",
        " validation method",
        " validation decorator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6ce37d64526f2b39f267ccea9b1184272ccd7780e187a4f984dbbc17d9dd226d",
                "md5": "b9eb516bfe520f4ea48f2c5cc66963ce",
                "sha256": "f9bf9433e88c1b3ddb9360863dbc2d38b9b54b66ef7d2fa3808fb0dc59c5f081"
            },
            "downloads": -1,
            "filename": "aval-0.0b1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9eb516bfe520f4ea48f2c5cc66963ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7004,
            "upload_time": "2024-07-01T12:37:12",
            "upload_time_iso_8601": "2024-07-01T12:37:12.346124Z",
            "url": "https://files.pythonhosted.org/packages/6c/e3/7d64526f2b39f267ccea9b1184272ccd7780e187a4f984dbbc17d9dd226d/aval-0.0b1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c862fd27820a2fbdab6457dd91245df68fa9a76607ae73f43c6899234cfc9c5e",
                "md5": "18d5e77fcd0cbf93ffaaf8eb8b9e5002",
                "sha256": "31430763773ea391a29b36d83d29fe07132dea7567d2eaeb90a7f856406bdff9"
            },
            "downloads": -1,
            "filename": "aval-0.0b1.tar.gz",
            "has_sig": false,
            "md5_digest": "18d5e77fcd0cbf93ffaaf8eb8b9e5002",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5995,
            "upload_time": "2024-07-01T12:37:13",
            "upload_time_iso_8601": "2024-07-01T12:37:13.667053Z",
            "url": "https://files.pythonhosted.org/packages/c8/62/fd27820a2fbdab6457dd91245df68fa9a76607ae73f43c6899234cfc9c5e/aval-0.0b1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-01 12:37:13",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hmxustin",
    "github_project": "aval",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "aval"
}
        
Elapsed time: 0.27781s