Basic Parameter Types

class versuchung.types.String(default_value='')[source]

Can be used as: input parameter

A String is the most simple input parameter.

value

The value of the string. This is either the default value or the parameter given on the command line

class versuchung.types.Integer(default_value=0)[source]

Can be used as: input parameter

A integer flag argument (will accept a number on the command line.

value

The value of the integer. This is either the default value or the parameter given on the command line

class versuchung.types.Bool(default_value=False)[source]

Can be used as: input parameter

A boolean flag parameter (will accept “yes” and “no” on the command line.

value

The value of the bool. This is either the default value or the parameter given on the command line

class versuchung.types.List(datatype, default_value=[])[source]

Can be used as: input parameter

Sometimes there is the need to give a variable length of other input types as argument to an experiment. Of course here the command line parsing is somewhat more difficult, because the argument count isn’t determined in before.

The datatype argument is the type of the input parameter which should be collected:

inputs = { "strings": List(String) }

The default_value must be a list of compatible instances. List list will be used, if no arguments are given. If any argument of this type on the command line is given, the default_value will not be used:

inputs = { "strings": List(String, default_value=[String("abc")]) }

On the command line the List parameter can be given multiple times. These will be collected, if you want collect the strings ["abc", "foobar", "Hallo Welt"] you can use the following parameters on the command line:

--strings abc --strings foobar --strings "Hallo Welt"

Note

mention that the list members will appear as separate fields in the metadata. all start with the name of the input, and have a running number -%d appended.

More complicated is the situation, when the subtype takes more than one command-line argument. There you can replace the name prefix with a colon. For example if you want to give a list of two GitArchive instances use the input definition "git": List(GitArchive) together with the command line:

--git ":clone-url /path/to/git1" --git ":clone-url /path/to/git2"

Note

Be aware of the quotation marks here!

In the experiment the input parameter behaves like a list (it inherits from list), so it is really easy to iterate over it:

for string in self.inputs.strings:
    print(string.value)

for git in self.inputs.git:
    # Clone all given Git Archives
    print(git.path)
value

Returns the object (which behaves like a list) itself. This is only implemented for a coherent API.