
    j              
       z    d Z ddlmZ ddlmZ ddlmZ edddded	eedf         d
eedf         fd            ZdS )zLength.    )Union   )between)	validatorNmin_valmax_valvaluer   r	   c                   ||dk     rt          d          ||dk     rt          d          t          t          t          |           ||                    S )a  Return whether or not the length of given string is within a specified range.

    Examples:
        >>> length('something', min_val=2)
        True
        >>> length('something', min_val=9, max_val=9)
        True
        >>> length('something', max_val=5)
        ValidationError(func=length, args={'value': 'something', 'max_val': 5})

    Args:
        value:
            The string to validate.
        min_val:
            The minimum required length of the string. If not provided,
            minimum length will not be checked.
        max_val:
            The maximum length of the string. If not provided,
            maximum length will not be checked.

    Returns:
        (Literal[True]): If `len(value)` is in between the given conditions.
        (ValidationError): If `len(value)` is not in between the given conditions.

    Raises:
        (ValueError): If either `min_val` or `max_val` is negative.
    Nr   z7Length cannot be negative. `min_val` is less than zero.z7Length cannot be negative. `max_val` is less than zero.r   )
ValueErrorboolr   len)r
   r   r	   s      T/var/www/html/Carbon-Document/venv/lib/python3.11/site-packages/validators/length.pylengthr      sa    : w{{RSSSw{{RSSSE

GWEEEFFF    )	__doc__typingr   r   utilsr   strintr    r   r   <module>r      s                       9=[_ !G !G !G# !GeCI&6 !GcSWiHX !G !G !G !G !G !Gr   