def validate_maximum(value, maximum, is_exclusive, **kwargs):
    """
    Validator function for validating that a value does not violate it's
    maximum allowed value.  This validation can be inclusive, or exclusive of
    the maximum depending on the value of `is_exclusive`.
    """
    if is_exclusive:
        comparison_text = "less than"
        compare_fn = operator.lt
    else:
        comparison_text = "less than or equal to"
        compare_fn = operator.le

    if not compare_fn(value, maximum):
        raise ValidationError(
            MESSAGES['maximum']['invalid'].format(value, comparison_text, maximum),
        )
def validate_maximum ( value , maximum , is_exclusive , ** kwargs ) : if is_exclusive : comparison_text = "less than" compare_fn = operator . lt else : comparison_text = "less than or equal to" compare_fn = operator . le if not compare_fn ( value , maximum ) : raise ValidationError ( MESSAGES [ 'maximum' ] [ 'invalid' ] . format ( value , comparison_text , maximum ) , )
Validator function for validating that a value does not violate it's
    maximum allowed value.  This validation can be inclusive, or exclusive of
    the maximum depending on the value of `is_exclusive`.