RuleCheckAny Class
- class kwhelp.decorator.RuleCheckAny(*args: kwhelp.rules.IRule, **kwargs)[source]
Decorator that decorates methods that require args to match a rule specificed in
ruleslist.If a function arg does not match at least one rule in
ruleslist 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
Truethen an Exception will be raised if a validation fails. The kind of exception raised depends on the rule that is invalid. Typically aTypeErroror aValueErroris raised.If
Falsethen an attribute will be set on decorated function namedis_rules_any_validindicating if validation status. DefaultTrue.ftype (DecFuncType, optional) – Type of function that decorator is applied on. Default
DecFuncType.FUNCTIONopt_return (object, optional) – Return value when decorator is invalid. By default an error is rasied when validation fails. If
opt_returnis 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.