ArgsMinMax Class
- class kwhelp.decorator.ArgsMinMax(min: Optional[int] = 0, max: Optional[int] = None, **kwargs)[source]
Decorartor that sets the min and or max number of args that can be added to a function
See also
- __init__(min: Optional[int] = 0, max: Optional[int] = None, **kwargs)[source]
Constructor
- Parameters
min (int, optional) – Min number of args for a function. Defaults to 0.
max (int, optional) – Max number of args for a function. Defaults to None.
- Keyword Arguments
ftype (DecFuncType, optional) – Type of function that decorator is applied on. Default
DecFuncType.FUNCTION
opt_return (object, optional) – Return value when decorator is invalid. By default an error is rasied when validation fails. If
opt_return
is supplied then it will be return when validation fails and no error will be raised.opt_logger (Union[Logger, LoggerAdapter], optional) – Logger that logs exceptions when validation fails.