Skip to main content

travis-master coverall-master

dirty-validators

Agnostic validators for python 3

Freely based on WTF-Forms validators.

Features

Installation

$ pip install dirty-validators

Basic usage

from dirty_validators.basic import EqualTo, Length, Regexp, Email
from dirty_validators.complex import Optional, ModelValidate

validator = Optional(validators=[EqualTo(comp_value="test")])

assert validator.is_valid("test") is True

# Chained validation
validator_chain = Chain(validators=[Length(min=14, max=16), Regexp(regex='^abc'), Email()])

assert validator_chain.is_valid('abcdefg@test.com')

# Model validation

class MyModelValidator(ModelValidate):
    fieldName1 = Optional(validators=[Length(min=4, max=6)])
    fieldName2 = Optional(validators=[Length(min=1, max=2)])
    fieldName3 = Required(validators=[Length(min=7, max=8)])

validator_model = MyModelValidator()

data = {
    "fieldName1": "1234",
    "fieldName1": "12",
    "fieldName3": "123456qw"
 }

assert validator_model.is_valid(FakeModel(data)) is True

Metadata

Release files for dirty-validators 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dirty-validators 0.4.0
File Size Uploaded Provenance Actions
dirty-validators-0.4.0.tar.gz 9.4 kB Without provenance Details for dirty-validators-0.4.0.tar.gz

Release files / dirty-validators-0.4.0.tar.gz

Download URL dirty-validators-0.4.0.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
adae2dc1e68c6cb7da3090598afee60a190433a0cd6ed66488bbbac5eb9ed3ca
BLAKE2b-256 checksum
How to use checksums
17df715faa406218feedb4c273571dd94090345fd1aee557c92093146394b5b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for dirty-validators 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page