bilby.core.utils.introspection.infer_parameters_from_function

bilby.core.utils.introspection.infer_parameters_from_function(func)[source]

Infers the arguments of a function (except the first arg which is assumed to be the dep. variable).

Throws out *args and **kwargs type arguments

Can deal with type hinting!

Parameters:
func: function or method

The function or method for which the parameters should be inferred.

Returns:
list: A list of strings with the parameters
Raises:
ValueError

If the object passed to the function is neither a function nor a method.

Notes

In order to handle methods the type of the function is checked, and if a method has been passed the first two arguments are removed rather than just the first one. This allows the reference to the instance (conventionally named self) to be removed.