skshapes.input_validation.notnone_rules.one_and_only_one

skshapes.input_validation.notnone_rules.one_and_only_one(parameters)

Checker for only one not None parameter.

Parameters:

parameters (list[str]) – the list of parameters to check

Returns:

the decorated function

Return type:

callable

Raises:

InputStructureError – if more than one parameter is not None

Examples

from skshapes.input_validation import one_and_only_one

@one_and_only_one(["a", "b"])
def func(a=None, b=None):
    pass


func(a=1)
func(b=1)
func(a=1, b=1)
Traceback (most recent call last):
 ...
skshapes.errors.InputStructureError: One and only one of the parameters ['a', 'b'] must be not None and they must be passed as keyword arguments.