Sequence
- class ase2sprkkr.common.grammar_types.Sequence(*types, format='', format_all=False, allowed_values=None, default_values=False, names=None, **kwargs)[source]
A sequence of values of given types
Class hierarchy
Constructor
- __init__(*types, format='', format_all=False, allowed_values=None, default_values=False, names=None, **kwargs)[source]
Create the object.
- Parameters
prefix – The string, that will be printed before the value
postfix – The string, that will be printed after the value
format – The (python) format string, that will be used for printing the value. The format is passed as format argument to
str.format
routine.default_value – The default value of the options of this type.
None
means no default value.condition – Function, that check the validity of the value. It should return
True
for a valid value, andFalse
or string for invalid. The string is interpreted as an error message that explains the invalidity of the value.after_convert – Function, that - if it is given - is applied to the (entered or parsed) value. The function is applied on the result of the
convert
method
- grammar_name()[source]
Human readable expression of the grammar. By default, this is what is set by grammar.setName, however, sometimes is desirable to set even shorter string
- _string(val)[source]
The string method do some additional transformation (add prefix, postfix etc.), so the actual way how to convert the value for the output should be here.
- enrich(option)[source]
Some types can add properties to the options that have the type, e.g. see Sequence.enrich, which adds the ability to access the items of the sequence using []
- static is_the_same_value(a, b)
The numpy arrays cannot be compared by =, that’s why this method. However, the method is still far from to be perfect, it can not compare nested numpy arrays.