RequireArgs Class

class kwhelp.decorator.RequireArgs(*args: str, **kwargs)[source]

Decorator that defines required args for **kwargs of a function.

__init__(*args: str, **kwargs)[source]

Constructor

Parameters

args (type) – One or more names of wrapped function args to require.

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.