Did I find the right examples for you? yes no

All Samples(9)  |  Call(0)  |  Derive(0)  |  Import(9)
A decorator that makes given function validator. Whenever the given
function is called and returns False value this decorator returns
ValidationFailure object.

Example:

::


    >>> from validators import validator(more...)

        def validator(func, *args, **kwargs):
    """
    A decorator that makes given function validator. Whenever the given
    function is called and returns False value this decorator returns
    ValidationFailure object.

    Example:

    ::


        >>> from validators import validator


        >>> @validator
        >>> def even(value):
        ...     return not (value % 2)


        >>> even(4)
        True

        >>> even(5)
        ValidationFailure(func=even, args={'value': 5})


    :param func: function to decorate
    :param *args: positional function arguments
    :param **kwargs: key value function arguments
    """
    def wrapper(func, *args, **kwargs):
        value = func(*args, **kwargs)
        if not value:
            return ValidationFailure(
                func, func_args_as_dict(func, args, kwargs)
            )
        return value
    return decorator(wrapper, func)
        


src/v/a/validators-0.5.0/validators/__init__.py   validators(Download)
from .truthy import truthy
from .url import url
from .utils import ValidationFailure, validator
from .uuid import uuid
from .i18n import fi_business_id, fi_ssn

src/v/a/validators-0.5.0/validators/uuid.py   validators(Download)
import re
from .utils import validator
 
 
pattern = re.compile(r'^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$')

src/v/a/validators-0.5.0/validators/url.py   validators(Download)
import re
from .utils import validator
 
 
regex = (

src/v/a/validators-0.5.0/validators/truthy.py   validators(Download)
import six
from .utils import validator
 
 
@validator

src/v/a/validators-0.5.0/validators/mac_address.py   validators(Download)
import re
from .utils import validator
 
 
pattern = re.compile(r'^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$')

src/v/a/validators-0.5.0/validators/length.py   validators(Download)
from .between import between
from .utils import validator
 
 
@validator

src/v/a/validators-0.5.0/validators/ip_address.py   validators(Download)
from .utils import validator
 
 
@validator
def ipv4(value):

src/v/a/validators-0.5.0/validators/email.py   validators(Download)
import re
from .utils import validator
 
 
user_regex = re.compile(

src/v/a/validators-0.5.0/validators/between.py   validators(Download)
from .extremes import Min, Max
from .utils import validator
 
 
@validator