datalad_next.patches.interface_utils

Uniform pre-execution parameter validation for commands

With this patch commands can now opt-in to receive fully validated parameters. This can substantially simplify the implementation complexity of a command at the expense of a more elaborate specification of the structural and semantic properties of the parameters.

For details on implementing validation for individual commands see datalad_next.commands.ValidatedInterface.

datalad_next.patches.interface_utils.get_allargs_as_kwargs(call, args, kwargs)[source]

Generate a kwargs dict from a call signature and *args, **kwargs

Basically resolving the argnames for all positional arguments, and resolving the defaults for all kwargs that are not given in a kwargs dict

Returns:

The first return value is a mapping of argument names to their respective values. The second return value in the tuple is a set of argument names for which the effective value is identical to the default declared in the signature of the callable. The third value is a set with names of all mandatory arguments, whether or not they are included in the returned mapping.

Return type:

(dict, set, set)