import inspect


def change_run_signature(run, run_inputs):
    """Modifies the signature of the run method of a neural_msi_model.

    Parameters
    ----------
    run: ``callable``
        Function that delegates all the parameters to the run method of
        a skneuromsi.Config class.
    run_inputs: ``set``
        Set containing the class attributes labeled as run inputs.

    Returns
    ----------
    run: ``callable``
        Run method with a new signature including the run_input parameters.
    """

    signature = inspect.signature(run)

    self_param = signature.parameters["self"]
    new_params = [self_param] + [
        inspect.Parameter(name, inspect.Parameter.KEYWORD_ONLY)
        for name in run_inputs
    ]

    new_signature = signature.replace(parameters=new_params)

    run.__signature__ = new_signature

    return run