Enforce callback parameters rules
In latest version of callpyback
, when declaring callback functions, following rules must be obeyed:
a) on_call()
callback MUST eitheraccept no parameters or combination of the following:
func_kwargs
- will receive parameters passed to the function decorated withCallPyBack
b) on_success()
callback MUST either accept no parameters or combination of the following:
func_result
- will receive return value of the function decorated withCallPyBack
func_kwargs
- will receive parameters passed to the function decorated withCallPyBack
c) on_failure()
callback MUST either accept no parameters or combination of the following:
func_exception
- will receive exception raised by the function decorated withCallPyBack
func_kwargs
- will receive parameters passed to the function decorated withCallPyBack
d) on_end()
callback MUST either accept no parameters or combination of the following:
func_result
- will receive return value of the function decorated withCallPyBack
func_exception
- will receive exception raised by the function decorated withCallPyBack
func_kwargs
- will receive parameters passed to the function decorated withCallPyBack
func_scope_vars
- will receive local variables of the function decorated withCallPyBack
, whose names were specified in thepass_vars
decorator parameter.
These rules are enforced to allow omitting parameters in the callback function. This is useful when some of these parameters are not needed for the callback function. If those rules are not obeyed, error will be raised during the initialization of the CallPyBack
decorator class.