RuleCheckAll Class
- class kwhelp.decorator.RuleCheckAll(*args: kwhelp.rules.IRule, **kwargs)[source]
Decorator that decorates methods that require args to match all rules specificed in
rules
list.If a function arg does not match all rules in
rules
list then validation will fail.See also
- __init__(*args: kwhelp.rules.IRule, **kwargs)[source]
Constructor
- Parameters
args (IRule) – One or more rules to use for validation
- Keyword Arguments
raise_error (bool, optional) –
If
True
then an Exception will be raised if a validation fails. The kind of exception raised depends on the rule that is invalid. Typically aTypeError
or aValueError
is raised.If
False
then an attribute will be set on decorated function namedis_rules_all_valid
indicating if validation status. DefaultTrue
.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_args_filter (DecArgEnum, optional) – Filters the arguments that are validated. Default
DecArgEnum.ALL
.opt_logger (Union[Logger, LoggerAdapter], optional) – Logger that logs exceptions when validation fails.