robot.variables package

Implements storing and resolving variables.

This package is mainly for internal usage.

Submodules

robot.variables.assigner module

class robot.variables.assigner.VariableAssignment(assignment)[source]

Bases: object

validate_assignment()[source]
assigner(context)[source]
class robot.variables.assigner.AssignmentValidator[source]

Bases: object

validate(variable)[source]
class robot.variables.assigner.VariableAssigner(assignment, context)[source]

Bases: object

assign(return_value)[source]
robot.variables.assigner.ReturnValueResolver(assignment)[source]
class robot.variables.assigner.NoReturnValueResolver[source]

Bases: object

resolve(return_value)[source]
class robot.variables.assigner.OneReturnValueResolver(variable)[source]

Bases: object

resolve(return_value)[source]
class robot.variables.assigner.ScalarsOnlyReturnValueResolver(variables)[source]

Bases: robot.variables.assigner._MultiReturnValueResolver

resolve(return_value)
class robot.variables.assigner.ScalarsAndListReturnValueResolver(variables)[source]

Bases: robot.variables.assigner._MultiReturnValueResolver

resolve(return_value)

robot.variables.filesetter module

class robot.variables.filesetter.VariableFileSetter(store)[source]

Bases: object

set(path_or_variables, args=None, overwrite=False)[source]
class robot.variables.filesetter.YamlImporter[source]

Bases: object

import_variables(path, args=None)[source]
class robot.variables.filesetter.PythonImporter[source]

Bases: object

import_variables(path, args=None)[source]

robot.variables.finders module

robot.variables.finders.get_java_property(name)
robot.variables.finders.get_java_properties()
class robot.variables.finders.VariableFinder(variable_store)[source]

Bases: object

find(name)[source]
class robot.variables.finders.StoredFinder(store)[source]

Bases: object

identifiers = '$@&'
find(name)[source]
class robot.variables.finders.NumberFinder[source]

Bases: object

identifiers = '$'
find(name)[source]
class robot.variables.finders.EmptyFinder[source]

Bases: object

identifiers = '$@&'
find(key)
class robot.variables.finders.ExtendedFinder(finder)[source]

Bases: object

identifiers = '$@&'
find(name)[source]
class robot.variables.finders.EnvironmentFinder[source]

Bases: object

identifiers = '%'
find(name)[source]

robot.variables.isvar module

robot.variables.isvar.is_var(string, identifiers='$@&')[source]
robot.variables.isvar.is_scalar_var(string)[source]
robot.variables.isvar.is_list_var(string)[source]
robot.variables.isvar.is_dict_var(string)[source]
robot.variables.isvar.contains_var(string, identifiers='$@&')[source]
robot.variables.isvar.validate_var(string, identifiers='$@&')[source]

robot.variables.notfound module

robot.variables.notfound.variable_not_found(name, candidates, msg=None, deco_braces=True)[source]

Raise DataError for missing variable name.

Return recommendations for similar variable names if any are found.

robot.variables.replacer module

class robot.variables.replacer.VariableReplacer(variables)[source]

Bases: object

replace_list(items, replace_until=None, ignore_errors=False)[source]

Replaces variables from a list of items.

If an item in a list is a @{list} variable its value is returned. Possible variables from other items are replaced using ‘replace_scalar’. Result is always a list.

‘replace_until’ can be used to limit replacing arguments to certain index from the beginning. Used with Run Keyword variants that only want to resolve some of the arguments in the beginning and pass others to called keywords unmodified.

replace_scalar(item, ignore_errors=False)[source]

Replaces variables from a scalar item.

If the item is not a string it is returned as is. If it is a ${scalar} variable its value is returned. Otherwise variables are replaced with ‘replace_string’. Result may be any object.

replace_string(string, ignore_errors=False)[source]

Replaces variables from a string. Result is always a string.

robot.variables.scopes module

class robot.variables.scopes.VariableScopes(settings)[source]

Bases: object

current
start_suite()[source]
end_suite()[source]
start_test()[source]
end_test()[source]
start_keyword()[source]
end_keyword()[source]
replace_list(items, replace_until=None, ignore_errors=False)[source]
replace_scalar(items, ignore_errors=False)[source]
replace_string(string, ignore_errors=False)[source]
set_from_file(path, args, overwrite=False)[source]
set_from_variable_table(variables, overwrite=False)[source]
resolve_delayed()[source]
set_global(name, value)[source]
set_suite(name, value, top=False, children=False)[source]
set_test(name, value)[source]
set_keyword(name, value)[source]
as_dict(decoration=True)[source]
class robot.variables.scopes.GlobalVariables(settings)[source]

Bases: robot.variables.variables.Variables

as_dict(decoration=True)
clear()
copy()
replace_list(items, replace_until=None, ignore_errors=False)
replace_scalar(item, ignore_errors=False)
replace_string(item, ignore_errors=False)
resolve_delayed()
set_from_file(path_or_variables, args=None, overwrite=False)
set_from_variable_table(variables, overwrite=False)
update(variables)
class robot.variables.scopes.SetVariables[source]

Bases: object

start_suite()[source]
end_suite()[source]
start_test()[source]
end_test()[source]
start_keyword()[source]
end_keyword()[source]
set_global(name, value)[source]
set_suite(name, value)[source]
set_test(name, value)[source]
set_keyword(name, value)[source]
update(variables)[source]

robot.variables.splitter module

class robot.variables.splitter.VariableSplitter(string, identifiers='$@%&*')[source]

Bases: object

get_replaced_variable(replacer)[source]
is_variable()[source]
is_list_variable()[source]
is_dict_variable()[source]
class robot.variables.splitter.VariableIterator(string, identifiers='$@%&*')[source]

Bases: object

robot.variables.store module

class robot.variables.store.VariableStore(variables)[source]

Bases: object

resolve_delayed()[source]
update(store)[source]
clear()[source]
add(name, value, overwrite=True, decorated=True)[source]
remove(name)[source]
as_dict(decoration=True)[source]

robot.variables.tablesetter module

class robot.variables.tablesetter.VariableTableSetter(store)[source]

Bases: object

set(variables, overwrite=False)[source]
class robot.variables.tablesetter.VariableTableReader[source]

Bases: object

read(variables)[source]
robot.variables.tablesetter.VariableTableValue(value, name, error_reporter=None)[source]
class robot.variables.tablesetter.VariableTableValueBase(values, error_reporter=None)[source]

Bases: object

resolve(variables)[source]
report_error(error)[source]
class robot.variables.tablesetter.ScalarVariableTableValue(values, error_reporter=None)[source]

Bases: robot.variables.tablesetter.VariableTableValueBase

report_error(error)
resolve(variables)
class robot.variables.tablesetter.ListVariableTableValue(values, error_reporter=None)[source]

Bases: robot.variables.tablesetter.VariableTableValueBase

report_error(error)
resolve(variables)
class robot.variables.tablesetter.DictVariableTableValue(values, error_reporter=None)[source]

Bases: robot.variables.tablesetter.VariableTableValueBase

report_error(error)
resolve(variables)

robot.variables.variables module

class robot.variables.variables.Variables[source]

Bases: object

Represents a set of variables.

Contains methods for replacing variables from list, scalars, and strings. On top of ${scalar}, @{list} and &{dict} variables, these methods handle also %{environment} variables.

resolve_delayed()[source]
replace_list(items, replace_until=None, ignore_errors=False)[source]
replace_scalar(item, ignore_errors=False)[source]
replace_string(item, ignore_errors=False)[source]
set_from_file(path_or_variables, args=None, overwrite=False)[source]
set_from_variable_table(variables, overwrite=False)[source]
clear()[source]
copy()[source]
update(variables)[source]
as_dict(decoration=True)[source]