argclz.validator.IntValidatorBuilder#

class argclz.validator.IntValidatorBuilder[source]#

Bases: AbstractTypeValidatorBuilder[int]

a int validator

__init__()[source]#

Methods Summary

__init__()

freeze(*args, **kwargs)

(internal use) return a copy of itself.

in_range(a, b, /)

Enforce a numeric range for int values

negative([include_zero])

Check if an int value is negative or non-positive.

optional()

positive([include_zero])

Check if an int value is positive or non-negative

__call__(value)

Details

in_range(a, b, /)[source]#

Enforce a numeric range for int values

Parameters:
  • a (int | None)

  • b (int | None)

Return type:

IntValidatorBuilder

positive(include_zero=True)[source]#

Check if an int value is positive or non-negative

negative(include_zero=True)[source]#

Check if an int value is negative or non-positive.

__call__(value)#
Parameters:

value (Any) – type-casted value.

Returns:

True if value pass the validation.

Raises:

ValueError – when value does not pass the validation.

Return type:

bool

freeze(*args, **kwargs)#

(internal use) return a copy of itself.

Return type:

Self

optional()#
Return type:

Self