Provide arguments to process function as dictionary
frankenjoe opened this issue · 1 comments
frankenjoe commented
Currently, additional arguments to the process function are passed as additional keyword arguments. This means that a function cannot share argument names with the interface class. E.g.:
import numpy as np
import audinterface
def process_func(x, sr, verbose):
if verbose:
print('I was here')
return x
process = audinterface.Process(
process_func=process_func,
verbose=True,
)
sampling_rate = 16000
signal = np.zeros(sampling_rate)
process(signal, sampling_rate)
TypeError: process_func() missing 1 required positional argument: 'verbose'
Apart from that, it's difficult for the user to distinguish between arguments to the interface and to the function.
So I recommend we fix this in the same way as in audobject, i.e. deprecate **kwargs
and replace it with a dictionary process_func_args
.
hagenw commented
Hehe, I see you restart our very old discussion on this one. Seems like we decided for the wrong solution at that time. Fell free to change it.