safe_call#

deeptrack.utils.safe_call(function, positional_args=[], **kwargs) Any#

Calls a function with valid arguments from a dictionary of arguments.

It filters kwargs to include only arguments accepted by the function, ensuring that no invalid arguments are passed. This function also supports positional arguments.

Parameters#

functionCallable

The function to call.

positional_argslist, optional

List of positional arguments to pass to the function.

kwargsdict

Dictionary of keyword arguments to filter and pass.

Returns#

Any

The result of calling the function with the filtered arguments.