robot.parsing.model package

Submodules

robot.parsing.model.blocks module

class robot.parsing.model.blocks.Block[source]

Bases: _ast.AST

errors = ()
lineno
col_offset
end_lineno
end_col_offset
validate_model()[source]
validate()[source]
class robot.parsing.model.blocks.File(sections=None, source=None)[source]

Bases: robot.parsing.model.blocks.Block

save(output=None)[source]

Save model to the given output or to the original source file.

The output can be a path to a file or an already opened file object. If output is not given, the original source file will be overwritten.

col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.Section(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Block

col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.SettingSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.VariableSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.TestCaseSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

tasks
col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.KeywordSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.CommentSection(header=None, body=None)[source]

Bases: robot.parsing.model.blocks.Section

col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.TestCase(header, body=None)[source]

Bases: robot.parsing.model.blocks.Block

name
col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.Keyword(header, body=None)[source]

Bases: robot.parsing.model.blocks.Block

name
col_offset
end_col_offset
end_lineno
errors = ()
lineno
validate()
validate_model()
class robot.parsing.model.blocks.If(header, body=None, orelse=None, end=None, errors=())[source]

Bases: robot.parsing.model.blocks.Block

Represents IF structures in the model.

Used with IF, ELSE_IF and ELSE nodes. The type attribute specifies the type.

errors = ()
type
condition
validate()[source]
col_offset
end_col_offset
end_lineno
lineno
validate_model()
class robot.parsing.model.blocks.For(header, body=None, end=None, errors=())[source]

Bases: robot.parsing.model.blocks.Block

errors = ()
variables
values
flavor
validate()[source]
col_offset
end_col_offset
end_lineno
lineno
validate_model()
class robot.parsing.model.blocks.ModelWriter(output)[source]

Bases: robot.parsing.model.visitor.ModelVisitor

write(model)[source]
visit_Statement(statement)[source]
generic_visit(node)

Called if no explicit visitor function exists for a node.

visit(node)

Visit a node.

class robot.parsing.model.blocks.ModelValidator[source]

Bases: robot.parsing.model.visitor.ModelVisitor

visit_Block(node)[source]
visit_Statement(node)[source]
generic_visit(node)

Called if no explicit visitor function exists for a node.

visit(node)

Visit a node.

class robot.parsing.model.blocks.FirstStatementFinder[source]

Bases: robot.parsing.model.visitor.ModelVisitor

classmethod find_from(model)[source]
visit_Statement(statement)[source]
generic_visit(node)[source]

Called if no explicit visitor function exists for a node.

visit(node)

Visit a node.

class robot.parsing.model.blocks.LastStatementFinder[source]

Bases: robot.parsing.model.visitor.ModelVisitor

classmethod find_from(model)[source]
generic_visit(node)

Called if no explicit visitor function exists for a node.

visit(node)

Visit a node.

visit_Statement(statement)[source]

robot.parsing.model.statements module

class robot.parsing.model.statements.Statement(tokens, errors=())[source]

Bases: _ast.AST

type = None
handles_types = ()
lineno
col_offset
end_lineno
end_col_offset
classmethod register(subcls)[source]
classmethod from_tokens(tokens)[source]
classmethod from_params(*args, **kwargs)[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

data_tokens
get_token(*types)[source]

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)[source]

Return tokens having any of the given types.

get_value(type, default=None)[source]

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)[source]

Return values of tokens having any of the given types.

lines
validate()[source]
class robot.parsing.model.statements.DocumentationOrMetadata(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_params(*args, **kwargs)

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
type = None
validate()
class robot.parsing.model.statements.SingleValue(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

value
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_params(*args, **kwargs)

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
type = None
validate()
class robot.parsing.model.statements.MultiValue(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

values
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_params(*args, **kwargs)

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
type = None
validate()
class robot.parsing.model.statements.Fixture(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

name
args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_params(*args, **kwargs)

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
type = None
validate()
class robot.parsing.model.statements.SectionHeader(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

handles_types = ('SETTING HEADER', 'VARIABLE HEADER', 'TESTCASE HEADER', 'KEYWORD HEADER', 'COMMENT HEADER')
classmethod from_params(type, name=None, eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

type
name
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.LibraryImport(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'LIBRARY'
classmethod from_params(name, args=(), alias=None, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

name
args
alias
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.ResourceImport(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'RESOURCE'
classmethod from_params(name, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

name
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.VariablesImport(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'VARIABLES'
classmethod from_params(name, args=(), separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

name
args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.Documentation(tokens, errors=())[source]

Bases: robot.parsing.model.statements.DocumentationOrMetadata

type = 'DOCUMENTATION'
classmethod from_params(value, indent=' ', separator=' ', eol='\n', settings_section=True)[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

value
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.Metadata(tokens, errors=())[source]

Bases: robot.parsing.model.statements.DocumentationOrMetadata

type = 'METADATA'
classmethod from_params(name, value, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

name
value
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.ForceTags(tokens, errors=())[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'FORCE TAGS'
classmethod from_params(values, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
values
class robot.parsing.model.statements.DefaultTags(tokens, errors=())[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'DEFAULT TAGS'
classmethod from_params(values, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
values
class robot.parsing.model.statements.SuiteSetup(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Fixture

type = 'SUITE SETUP'
classmethod from_params(name, args=(), separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
name
classmethod register(subcls)
validate()
class robot.parsing.model.statements.SuiteTeardown(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Fixture

type = 'SUITE TEARDOWN'
classmethod from_params(name, args=(), separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
name
classmethod register(subcls)
validate()
class robot.parsing.model.statements.TestSetup(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Fixture

type = 'TEST SETUP'
classmethod from_params(name, args=(), separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
name
classmethod register(subcls)
validate()
class robot.parsing.model.statements.TestTeardown(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Fixture

type = 'TEST TEARDOWN'
classmethod from_params(name, args=(), separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
name
classmethod register(subcls)
validate()
class robot.parsing.model.statements.TestTemplate(tokens, errors=())[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TEST TEMPLATE'
classmethod from_params(value, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
value
class robot.parsing.model.statements.TestTimeout(tokens, errors=())[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TEST TIMEOUT'
classmethod from_params(value, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
value
class robot.parsing.model.statements.Variable(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'VARIABLE'
classmethod from_params(name, value, separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

name
value
validate()[source]
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.TestCaseName(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'TESTCASE NAME'
classmethod from_params(name, eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

name
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.KeywordName(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'KEYWORD NAME'
classmethod from_params(name, eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

name
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.Setup(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Fixture

type = 'SETUP'
classmethod from_params(name, args=(), indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
name
classmethod register(subcls)
validate()
class robot.parsing.model.statements.Teardown(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Fixture

type = 'TEARDOWN'
classmethod from_params(name, args=(), indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
name
classmethod register(subcls)
validate()
class robot.parsing.model.statements.Tags(tokens, errors=())[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'TAGS'
classmethod from_params(values, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
values
class robot.parsing.model.statements.Template(tokens, errors=())[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TEMPLATE'
classmethod from_params(value, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
value
class robot.parsing.model.statements.Timeout(tokens, errors=())[source]

Bases: robot.parsing.model.statements.SingleValue

type = 'TIMEOUT'
classmethod from_params(value, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
value
class robot.parsing.model.statements.Arguments(tokens, errors=())[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'ARGUMENTS'
classmethod from_params(args, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
values
class robot.parsing.model.statements.Return(tokens, errors=())[source]

Bases: robot.parsing.model.statements.MultiValue

type = 'RETURN'
classmethod from_params(args, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
values
class robot.parsing.model.statements.KeywordCall(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'KEYWORD'
handles_types = ('KEYWORD', 'ASSIGN')
classmethod from_params(name, assign=(), args=(), indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

keyword
args
assign
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.TemplateArguments(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'ARGUMENT'
classmethod from_params(args, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

args
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.ForHeader(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'FOR'
classmethod from_params(variables, values, flavor='IN', indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

variables
values
flavor
validate()[source]
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.IfHeader(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'IF'
classmethod from_params(condition, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

condition
validate()[source]
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.ElseIfHeader(tokens, errors=())[source]

Bases: robot.parsing.model.statements.IfHeader

type = 'ELSE IF'
classmethod from_params(condition, indent=' ', separator=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
condition
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.ElseHeader(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'ELSE'
classmethod from_params(indent=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

condition
validate()[source]
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.End(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'END'
classmethod from_params(indent=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

validate()[source]
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
class robot.parsing.model.statements.Comment(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'COMMENT'
classmethod from_params(comment, indent=' ', eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.Error(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'ERROR'
handles_types = ('ERROR', 'FATAL ERROR')
errors

Errors got from the underlying ERROR and FATAL_ERROR tokens.

Errors can be set also explicitly. When accessing errors, they are returned along with errors from from tokens.

col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_params(*args, **kwargs)

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

lineno
lines
classmethod register(subcls)
validate()
class robot.parsing.model.statements.EmptyLine(tokens, errors=())[source]

Bases: robot.parsing.model.statements.Statement

type = 'EOL'
col_offset
data_tokens
end_col_offset
end_lineno
classmethod from_params(eol='\n')[source]

Create statement from passed parameters.

Required and optional arguments should match class properties. Values are used to create matching tokens.

There is one notable difference for Documentation statement where settings_header flag is used to determine if statement belongs to settings header or test/keyword.

Most implementations support following general properties: - separator whitespace inserted between each token. Default is four spaces. - indent whitespace inserted before first token. Default is four spaces. - eol end of line sign. Default is '\n'.

classmethod from_tokens(tokens)
get_token(*types)

Return a token with the given type.

If there are no matches, return None. If there are multiple matches, return the first match.

get_tokens(*types)

Return tokens having any of the given types.

get_value(type, default=None)

Return value of a token with the given type.

If there are no matches, return default. If there are multiple matches, return the value of the first match.

get_values(*types)

Return values of tokens having any of the given types.

handles_types = ()
lineno
lines
classmethod register(subcls)
validate()

robot.parsing.model.visitor module

class robot.parsing.model.visitor.VisitorFinder[source]

Bases: object

class robot.parsing.model.visitor.ModelVisitor[source]

Bases: ast.NodeVisitor, robot.parsing.model.visitor.VisitorFinder

NodeVisitor that supports matching nodes based on their base classes.

Otherwise identical to the standard ast.NodeVisitor, but allows creating visit_ClassName methods so that the ClassName is one of the base classes of the node. For example, this visitor method matches all statements:

def visit_Statement(self, node):
    # ...
visit(node)[source]

Visit a node.

generic_visit(node)

Called if no explicit visitor function exists for a node.

class robot.parsing.model.visitor.ModelTransformer[source]

Bases: ast.NodeTransformer, robot.parsing.model.visitor.VisitorFinder

NodeTransformer that supports matching nodes based on their base classes.

See ModelVisitor for explanation how this is different compared to the standard ast.NodeTransformer.

visit(node)[source]

Visit a node.

generic_visit(node)

Called if no explicit visitor function exists for a node.