Add support for inference of method arguments
This MR closes #409 (closed).
- A new test has been added to ensure that method arguments are inferred correctly, complementing the same functionality for functions
- A new function is provided,
utils._infer_args_from_function_except_n_args
to allow an arbitrary number of arguments to be ignored. -
utils.infer_parameters_from_function
has been updated to infer if a passed argument is a function or a method (or will raise aValueError
if it is neither.
The behaviour of utils.infer_parameters_from_function
may not be considered optimal, as it will fail in the case that an object with a __call__()
method is passed as an argument. If you're keen for this form to be supported I can add an additional case for it.
Edited by Daniel Williams