API

Variable

class faff.variable.VariableContext(data=None)
add(name, value=None)

Add value(s) to variable of name. If variable name is not set it is set by default.

Parameters:
  • name (str) – Variable name string.
  • value (str or list or tuple) – Variable value(s).
Returns:

None

data

Return dictionary of variable names and value lists.

Return type:dict
get(name)

Get variable value of name. Raises a VariableError exception if variable name is not set.

Parameters:name (str) – Variable name string.
Return type:list
restore(saved)

Restore saved variable names and value lists from dictionary returned by the .save() method.

Parameters:saved (dict) – Dictionary of saved variable names and values.
Returns:None
save(prefix='*')

Return dictionary of variable names and value lists. A prefix character can be used to limit which names and value lists are saved.

Parameters:prefix (str) – Variable name prefix character, defaults to ‘*’ which saves all variable names and values.
Return type:dict
set(name, value=None)

Set variable value of name.

Parameters:
  • name (str) – Variable name string.
  • value (str or list or tuple) – Variable value(s).
Returns:

None