Open
Description
Usage of formatter
together with xor
and mandatory
metadata may yield inconsistent command-line output.
Given the following spec:
import pydra
input_spec = pydra.specs.SpecInfo(
name="Input",
fields=[
(
"foo",
bool,
{
"help_string": "boolean option",
"mandatory": True,
"formatter": lambda foo: "--foo" if foo else "--no-foo"
"xor": {"bar"},
},
),
(
"bar",
str,
{
"help_string": "pathlike option",
"mandatory": True,
"argstr": "--bar {bar}",
"xor": {"foo"},
},
),
],
bases=(pydra.specs.ShellSpec,),
)
Attached to interface MyInterface
, one should only be able to construct the following valid instances:
task = MyInterface(foo=True) # (1)
task = MyInterface(foo=False) # (2)
task = MyInterface(bar="/some/path") # (3)
Cases (1) and (2) yield appropriate commandline values.
However, case (3) yields --no-foo --bar /some/path
instead of just --bar /some/path
hereby bypassing the xor
constraint.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
v1.0