U
    š´V(  ã                   @   s.   d dl mZmZ d dlmZ eddd„ƒZdS )é   )ÚMaxÚMin)Ú	validatorNc                 C   sv   |dkr|dkrt dƒ‚|dkr$t}|dkr0t}z||k}W n tk
rX   ||k }Y nX |rft dƒ‚|| kot|| kS )aù  
    Validate that a number is between minimum and/or maximum value.

    This will work with any comparable type, such as floats, decimals and dates
    not just integers.

    This validator is originally based on `WTForms NumberRange validator`_.

    .. _WTForms NumberRange validator:
       https://github.com/wtforms/wtforms/blob/master/wtforms/validators.py

    Examples::

        >>> from datetime import datetime

        >>> between(5, min=2)
        True

        >>> between(13.2, min=13, max=14)
        True

        >>> between(500, max=400)
        ValidationFailure(func=between, args=...)

        >>> between(
        ...     datetime(2000, 11, 11),
        ...     min=datetime(1999, 11, 11)
        ... )
        True

    :param min:
        The minimum required value of the number. If not provided, minimum
        value will not be checked.
    :param max:
        The maximum value of the number. If not provided, maximum value
        will not be checked.

    .. versionadded:: 0.2
    Nz1At least one of `min` or `max` must be specified.z `min` cannot be more than `max`.)ÚAssertionErrorr   r   Ú	TypeError)ÚvalueÚminÚmaxZ
min_gt_max© r
   ú]/var/www/html/media_planning/my_env_project/lib/python3.8/site-packages/validators/between.pyÚbetween   s    )ÿr   )NN)Zextremesr   r   Úutilsr   r   r
   r
   r
   r   Ú<module>   s   