ReturnRuleAll Class

class kwhelp.decorator.ReturnRuleAll(*args: kwhelp.rules.IRule, **kwargs)[source]

Decorator that decorates methods that require return value to match all rules specificed.

__init__(*args: kwhelp.rules.IRule, **kwargs)[source]

Constructor

Parameters

args (IRule) – One or more rules to use for validation

Keyword Arguments
  • ftype (DecFuncType, optional) – Type of function that decorator is applied on. Default DecFuncType.FUNCTION Default True

  • 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.