(1) parameters with nargs=* or nargs=+ take a sequence of values. However, datalad is (almost?) universally implemented to also accept a single item in such cases. Internally values are fed to EnsureList() rather than exposing this fact as a proper constraint. Here we turn such nargs settings in an explicit
EnsureIterableOf(list, constraint) | constraint
alternative constrain specification.
(2) The first change makes it necessary to avoid duplicating parameter input widgets in such cases, because MultiValueWidget is capable of accepting a single item, making a dedicated single item input for the exact same data type superfluous (and ugly). Here we look for this case when generating input widgets, and we discard the single-item input in favor of the multi-value input.
(3) Both changes combined make it possible for MultiValueWidget to stop bypassing a parameter constraint, and actuall "set" values properly, rather then merely showing them in the input widget.
This is a three part change:
(1) parameters with
nargs=*
ornargs=+
take a sequence of values. However, datalad is (almost?) universally implemented to also accept a single item in such cases. Internally values are fed toEnsureList()
rather than exposing this fact as a proper constraint. Here we turn suchnargs
settings in an explicitEnsureIterableOf(list, constraint) | constraint
alternative constrain specification.
(2) The first change makes it necessary to avoid duplicating parameter input widgets in such cases, because
MultiValueWidget
is capable of accepting a single item, making a dedicated single item input for the exact same data type superfluous (and ugly). Here we look for this case when generating input widgets, and we discard the single-item input in favor of the multi-value input.(3) Both changes combined make it possible for
MultiValueWidget
to stop bypassing a parameter constraint, and actuall "set" values properly, rather then merely showing them in the input widget.