robot.parsing.model package

Submodules

robot.parsing.model.blocks module

classrobot.parsing.model.blocks.Container[source]

Bases:Node,ABC

propertylineno:int
propertycol_offset:int
propertyend_lineno:int
propertyend_col_offset:int
validate_model()[source]
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.File(sections:Sequence[Section]=(),source:Path|None=None,languages:Sequence[str]=())[source]

Bases:Container

save(output:Path|str|TextIO|None=None)[source]

Save model to the givenoutput or to the original source file.

Theoutput can be a path to a file or an already opened fileobject. Ifoutput is not given, the original source file willbe overwritten.

classrobot.parsing.model.blocks.Block(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Container,ABC

classrobot.parsing.model.blocks.Section(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Block

header:SectionHeader|None
classrobot.parsing.model.blocks.SettingSection(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Section

header:SectionHeader
classrobot.parsing.model.blocks.VariableSection(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Section

header:SectionHeader
classrobot.parsing.model.blocks.TestCaseSection(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Section

header:SectionHeader
propertytasks:bool
classrobot.parsing.model.blocks.KeywordSection(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Section

header:SectionHeader
classrobot.parsing.model.blocks.CommentSection(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Section

header:SectionHeader|None
classrobot.parsing.model.blocks.ImplicitCommentSection(header:Statement|None=None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:CommentSection

header:None
classrobot.parsing.model.blocks.InvalidSection(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Section

classrobot.parsing.model.blocks.TestCase(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Block

header:TestCaseName
propertyname:str
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.Keyword(header:Statement|None,body:Sequence[Statement|Block]=(),errors:Sequence[str]=())[source]

Bases:Block

header:KeywordName
propertyname:str
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.NestedBlock(header:Statement,body:Sequence[Statement|Block]=(),end:End|None=None,errors:Sequence[str]=())[source]

Bases:Block

classrobot.parsing.model.blocks.If(header:Statement,body:Sequence[Statement|Block]=(),orelse:If|None=None,end:End|None=None,errors:Sequence[str]=())[source]

Bases:NestedBlock

Represents IF structures in the model.

Used with IF, Inline IF, ELSE IF and ELSE nodes. Thetype attributespecifies the type.

header:IfHeader|ElseIfHeader|ElseHeader
propertytype:str
propertycondition:str|None
propertyassign:tuple[str,...]
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.For(header:Statement,body:Sequence[Statement|Block]=(),end:End|None=None,errors:Sequence[str]=())[source]

Bases:NestedBlock

header:ForHeader
propertyassign:tuple[str,...]
propertyvariables:tuple[str,...]
propertyvalues:tuple[str,...]
propertyflavor:str|None
propertystart:str|None
propertymode:str|None
propertyfill:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.Try(header:Statement,body:Sequence[Statement|Block]=(),next:Try|None=None,end:End|None=None,errors:Sequence[str]=())[source]

Bases:NestedBlock

header:TryHeader|ExceptHeader|ElseHeader|FinallyHeader
propertytype:str
propertypatterns:tuple[str,...]
propertypattern_type:str|None
propertyassign:str|None
propertyvariable:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.While(header:Statement,body:Sequence[Statement|Block]=(),end:End|None=None,errors:Sequence[str]=())[source]

Bases:NestedBlock

header:WhileHeader
propertycondition:str
propertylimit:str|None
propertyon_limit:str|None
propertyon_limit_message:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.Group(header:Statement,body:Sequence[Statement|Block]=(),end:End|None=None,errors:Sequence[str]=())[source]

Bases:NestedBlock

header:GroupHeader
propertyname:str
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.blocks.ModelWriter(output:Path|str|TextIO)[source]

Bases:ModelVisitor

write(model:Node)[source]
visit_Statement(statement:Statement)[source]
classrobot.parsing.model.blocks.ModelValidator[source]

Bases:ModelVisitor

visit_Block(node:Block)[source]
visit_Statement(node:Statement)[source]
classrobot.parsing.model.blocks.ValidationContext[source]

Bases:object

block(node:Block)Iterator[None][source]
propertyparent_block:Block|None
propertytasks:bool
propertyin_keyword:bool
propertyin_loop:bool
propertyin_finally:bool
classrobot.parsing.model.blocks.FirstStatementFinder[source]

Bases:ModelVisitor

classmethodfind_from(model:Node)Statement|None[source]
visit_Statement(statement:Statement)[source]
generic_visit(node:Node)[source]

Called if no explicit visitor function exists for a node.

classrobot.parsing.model.blocks.LastStatementFinder[source]

Bases:ModelVisitor

classmethodfind_from(model:Node)Statement|None[source]
visit_Statement(statement:Statement)[source]
classrobot.parsing.model.blocks.TemplatesNotAllowed(kind:str)[source]

Bases:ModelVisitor

check(model:Node)[source]
visit_TemplateArguments(node:None)[source]

robot.parsing.model.statements module

classrobot.parsing.model.statements.Node[source]

Bases:AST,ABC

lineno:int
col_offset:int
end_lineno:int
end_col_offset:int
errors:tuple[str,...]=()
classrobot.parsing.model.statements.Statement(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Node,ABC

type:str
handles_types:ClassVar[tuple[str,...]]=()
statement_handlers:ClassVar[dict[str,Type[Statement]]]={'ARGUMENT':<class'robot.parsing.model.statements.TemplateArguments'>,'ARGUMENTS':<class'robot.parsing.model.statements.Arguments'>,'BREAK':<class'robot.parsing.model.statements.Break'>,'COMMENT':<class'robot.parsing.model.statements.Comment'>,'COMMENTHEADER':<class'robot.parsing.model.statements.SectionHeader'>,'CONFIG':<class'robot.parsing.model.statements.Config'>,'CONTINUE':<class'robot.parsing.model.statements.Continue'>,'DEFAULTTAGS':<class'robot.parsing.model.statements.DefaultTags'>,'DOCUMENTATION':<class'robot.parsing.model.statements.Documentation'>,'ELSE':<class'robot.parsing.model.statements.ElseHeader'>,'ELSEIF':<class'robot.parsing.model.statements.ElseIfHeader'>,'END':<class'robot.parsing.model.statements.End'>,'ERROR':<class'robot.parsing.model.statements.Error'>,'EXCEPT':<class'robot.parsing.model.statements.ExceptHeader'>,'FINALLY':<class'robot.parsing.model.statements.FinallyHeader'>,'FOR':<class'robot.parsing.model.statements.ForHeader'>,'GROUP':<class'robot.parsing.model.statements.GroupHeader'>,'IF':<class'robot.parsing.model.statements.IfHeader'>,'INLINEIF':<class'robot.parsing.model.statements.InlineIfHeader'>,'INVALIDHEADER':<class'robot.parsing.model.statements.SectionHeader'>,'KEYWORD':<class'robot.parsing.model.statements.KeywordCall'>,'KEYWORDHEADER':<class'robot.parsing.model.statements.SectionHeader'>,'KEYWORDNAME':<class'robot.parsing.model.statements.KeywordName'>,'KEYWORDTAGS':<class'robot.parsing.model.statements.KeywordTags'>,'LIBRARY':<class'robot.parsing.model.statements.LibraryImport'>,'METADATA':<class'robot.parsing.model.statements.Metadata'>,'RESOURCE':<class'robot.parsing.model.statements.ResourceImport'>,'RETURN':<class'robot.parsing.model.statements.ReturnSetting'>,'RETURNSTATEMENT':<class'robot.parsing.model.statements.Return'>,'SETTINGHEADER':<class'robot.parsing.model.statements.SectionHeader'>,'SETUP':<class'robot.parsing.model.statements.Setup'>,'SUITENAME':<class'robot.parsing.model.statements.SuiteName'>,'SUITESETUP':<class'robot.parsing.model.statements.SuiteSetup'>,'SUITETEARDOWN':<class'robot.parsing.model.statements.SuiteTeardown'>,'TAGS':<class'robot.parsing.model.statements.Tags'>,'TASKHEADER':<class'robot.parsing.model.statements.SectionHeader'>,'TEARDOWN':<class'robot.parsing.model.statements.Teardown'>,'TEMPLATE':<class'robot.parsing.model.statements.Template'>,'TESTSETUP':<class'robot.parsing.model.statements.TestSetup'>,'TESTTAGS':<class'robot.parsing.model.statements.TestTags'>,'TESTTEARDOWN':<class'robot.parsing.model.statements.TestTeardown'>,'TESTTEMPLATE':<class'robot.parsing.model.statements.TestTemplate'>,'TESTTIMEOUT':<class'robot.parsing.model.statements.TestTimeout'>,'TESTCASEHEADER':<class'robot.parsing.model.statements.SectionHeader'>,'TESTCASENAME':<class'robot.parsing.model.statements.TestCaseName'>,'TIMEOUT':<class'robot.parsing.model.statements.Timeout'>,'TRY':<class'robot.parsing.model.statements.TryHeader'>,'VAR':<class'robot.parsing.model.statements.Var'>,'VARIABLE':<class'robot.parsing.model.statements.Variable'>,'VARIABLEHEADER':<class'robot.parsing.model.statements.SectionHeader'>,'VARIABLES':<class'robot.parsing.model.statements.VariablesImport'>,'WHILE':<class'robot.parsing.model.statements.WhileHeader'>}
options:dict[str,tuple|None]={}
propertylineno:int
propertycol_offset:int
propertyend_lineno:int
propertyend_col_offset:int
classmethodregister(subcls:Type[T])Type[T][source]

Register a virtual subclass of an ABC.

Returns the subclass, to allow usage as a class decorator.

classmethodfrom_tokens(tokens:Sequence[Token])Statement[source]

Create a statement from given tokens.

Statement type is got automatically from token types.

This classmethod should be called fromStatement, not fromits subclasses. If you know the subclass to use, simply create aninstance of it directly.

abstractmethodclassmethodfrom_params(*args,**kwargs)Statement[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertydata_tokens:list[Token]
get_token(*types:str)Token|None[source]

Return a token with any of the giventypes.

If there are no matches, returnNone. If there are multiplematches, return the first match.

get_tokens(*types:str)list[Token][source]

Return tokens having any of the giventypes.

get_value(type:str,default:str)str[source]
get_value(type:str,default:None=None)str|None

Return value of a token with the giventype.

If there are no matches, returndefault. If there are multiplematches, return the value of the first match.

get_values(*types:str)tuple[str,...][source]

Return values of tokens having any of the giventypes.

get_option(name:str,default:str|None=None)str|None[source]

Return value of a configuration option with the givenname.

If the option has not been used, returndefault.

If the option has been used multiple times, values are joined together.This is typically an error situation and validated elsewhere.

New in Robot Framework 6.1.

propertylines:Iterator[list[Token]]
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.DocumentationOrMetadata(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement,ABC

propertyvalue:str
classrobot.parsing.model.statements.SingleValue(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement,ABC

propertyvalue:str|None
classrobot.parsing.model.statements.MultiValue(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement,ABC

propertyvalues:tuple[str,...]
classrobot.parsing.model.statements.Fixture(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement,ABC

propertyname:str
propertyargs:tuple[str,...]
classrobot.parsing.model.statements.SectionHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

handles_types:ClassVar[tuple[str,...]]=('SETTINGHEADER','VARIABLEHEADER','TESTCASEHEADER','TASKHEADER','KEYWORDHEADER','COMMENTHEADER','INVALIDHEADER')
classmethodfrom_params(type:str,name:str|None=None,eol:str='\n')SectionHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertytype:str
propertyname:str
classrobot.parsing.model.statements.LibraryImport(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='LIBRARY'
classmethodfrom_params(name:str,args:Sequence[str]=(),alias:str|None=None,separator:str='   ',eol:str='\n')LibraryImport[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
propertyargs:tuple[str,...]
propertyalias:str|None
classrobot.parsing.model.statements.ResourceImport(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='RESOURCE'
classmethodfrom_params(name:str,separator:str='   ',eol:str='\n')ResourceImport[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
classrobot.parsing.model.statements.VariablesImport(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='VARIABLES'
classmethodfrom_params(name:str,args:Sequence[str]=(),separator:str='   ',eol:str='\n')VariablesImport[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
propertyargs:tuple[str,...]
classrobot.parsing.model.statements.Documentation(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:DocumentationOrMetadata

type:str='DOCUMENTATION'
classmethodfrom_params(value:str,indent:str='   ',separator:str='   ',eol:str='\n',settings_section:bool=True)Documentation[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Metadata(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:DocumentationOrMetadata

type:str='METADATA'
classmethodfrom_params(name:str,value:str,separator:str='   ',eol:str='\n')Metadata[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
classrobot.parsing.model.statements.TestTags(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:MultiValue

type:str='TESTTAGS'
classmethodfrom_params(values:Sequence[str],separator:str='   ',eol:str='\n')TestTags[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.DefaultTags(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:MultiValue

type:str='DEFAULTTAGS'
classmethodfrom_params(values:Sequence[str],separator:str='   ',eol:str='\n')DefaultTags[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.KeywordTags(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:MultiValue

type:str='KEYWORDTAGS'
classmethodfrom_params(values:Sequence[str],separator:str='   ',eol:str='\n')KeywordTags[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.SuiteName(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:SingleValue

type:str='SUITENAME'
classmethodfrom_params(value:str,separator:str='   ',eol:str='\n')SuiteName[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.SuiteSetup(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Fixture

type:str='SUITESETUP'
classmethodfrom_params(name:str,args:Sequence[str]=(),separator:str='   ',eol:str='\n')SuiteSetup[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.SuiteTeardown(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Fixture

type:str='SUITETEARDOWN'
classmethodfrom_params(name:str,args:Sequence[str]=(),separator:str='   ',eol:str='\n')SuiteTeardown[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.TestSetup(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Fixture

type:str='TESTSETUP'
classmethodfrom_params(name:str,args:Sequence[str]=(),separator:str='   ',eol:str='\n')TestSetup[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.TestTeardown(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Fixture

type:str='TESTTEARDOWN'
classmethodfrom_params(name:str,args:Sequence[str]=(),separator:str='   ',eol:str='\n')TestTeardown[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.TestTemplate(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:SingleValue

type:str='TESTTEMPLATE'
classmethodfrom_params(value:str,separator:str='   ',eol:str='\n')TestTemplate[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.TestTimeout(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:SingleValue

type:str='TESTTIMEOUT'
classmethodfrom_params(value:str,separator:str='   ',eol:str='\n')TestTimeout[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Variable(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='VARIABLE'
options:dict[str,tuple|None]={'separator':None}
classmethodfrom_params(name:str,value:str|Sequence[str],value_separator:str|None=None,separator:str='   ',eol:str='\n')Variable[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
propertyvalue:tuple[str,...]
propertyseparator:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.TestCaseName(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='TESTCASENAME'
classmethodfrom_params(name:str,eol:str='\n')TestCaseName[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.KeywordName(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='KEYWORDNAME'
classmethodfrom_params(name:str,eol:str='\n')KeywordName[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.Setup(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Fixture

type:str='SETUP'
classmethodfrom_params(name:str,args:Sequence[str]=(),indent:str='   ',separator:str='   ',eol:str='\n')Setup[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Teardown(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Fixture

type:str='TEARDOWN'
classmethodfrom_params(name:str,args:Sequence[str]=(),indent:str='   ',separator:str='   ',eol:str='\n')Teardown[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Tags(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:MultiValue

type:str='TAGS'
classmethodfrom_params(values:Sequence[str],indent:str='   ',separator:str='   ',eol:str='\n')Tags[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Template(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:SingleValue

type:str='TEMPLATE'
classmethodfrom_params(value:str,indent:str='   ',separator:str='   ',eol:str='\n')Template[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Timeout(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:SingleValue

type:str='TIMEOUT'
classmethodfrom_params(value:str,indent:str='   ',separator:str='   ',eol:str='\n')Timeout[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Arguments(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:MultiValue

type:str='ARGUMENTS'
classmethodfrom_params(args:Sequence[str],indent:str='   ',separator:str='   ',eol:str='\n')Arguments[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.ReturnSetting(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:MultiValue

Represents the deprecated[Return] setting.

This class was namedReturn prior to Robot Framework 7.0. A forwardcompatibleReturnSetting alias existed already in Robot Framework 6.1.

type:str='RETURN'
classmethodfrom_params(args:Sequence[str],indent:str='   ',separator:str='   ',eol:str='\n')ReturnSetting[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.KeywordCall(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='KEYWORD'
classmethodfrom_params(name:str,assign:Sequence[str]=(),args:Sequence[str]=(),indent:str='   ',separator:str='   ',eol:str='\n')KeywordCall[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertykeyword:str
propertyargs:tuple[str,...]
propertyassign:tuple[str,...]
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.TemplateArguments(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='ARGUMENT'
classmethodfrom_params(args:Sequence[str],indent:str='   ',separator:str='   ',eol:str='\n')TemplateArguments[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyargs:tuple[str,...]
classrobot.parsing.model.statements.ForHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='FOR'
options:dict[str,tuple|None]={'fill':None,'mode':('STRICT','SHORTEST','LONGEST'),'start':None}
classmethodfrom_params(assign:Sequence[str],values:Sequence[str],flavor:Literal['IN','INRANGE','INENUMERATE','INZIP']='IN',indent:str='   ',separator:str='   ',eol:str='\n')ForHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyassign:tuple[str,...]
propertyvariables:tuple[str,...]
propertyvalues:tuple[str,...]
propertyflavor:str|None
propertystart:str|None
propertymode:str|None
propertyfill:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.IfElseHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement,ABC

propertycondition:str|None
propertyassign:tuple[str,...]
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.IfHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:IfElseHeader

type:str='IF'
classmethodfrom_params(condition:str,indent:str='   ',separator:str='   ',eol:str='\n')IfHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.InlineIfHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:IfElseHeader

type:str='INLINEIF'
classmethodfrom_params(condition:str,assign:Sequence[str]=(),indent:str='   ',separator:str='   ')InlineIfHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.ElseIfHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:IfElseHeader

type:str='ELSEIF'
classmethodfrom_params(condition:str,indent:str='   ',separator:str='   ',eol:str='\n')ElseIfHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.ElseHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:IfElseHeader

type:str='ELSE'
classmethodfrom_params(indent:str='   ',eol:str='\n')ElseHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.NoArgumentHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement,ABC

classmethodfrom_params(indent:str='   ',eol:str='\n')[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

validate(ctx:ValidationContext)[source]
propertyvalues:tuple[str,...]
classrobot.parsing.model.statements.TryHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:NoArgumentHeader

type:str='TRY'
classrobot.parsing.model.statements.ExceptHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='EXCEPT'
options:dict[str,tuple|None]={'type':('GLOB','REGEXP','START','LITERAL')}
classmethodfrom_params(patterns:Sequence[str]=(),type:str|None=None,assign:str|None=None,indent:str='   ',separator:str='   ',eol:str='\n')ExceptHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertypatterns:tuple[str,...]
propertypattern_type:str|None
propertyassign:str|None
propertyvariable:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.FinallyHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:NoArgumentHeader

type:str='FINALLY'
classrobot.parsing.model.statements.End(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:NoArgumentHeader

type:str='END'
classrobot.parsing.model.statements.WhileHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='WHILE'
options:dict[str,tuple|None]={'limit':None,'on_limit':('PASS','FAIL'),'on_limit_message':None}
classmethodfrom_params(condition:str,limit:str|None=None,on_limit:str|None=None,on_limit_message:str|None=None,indent:str='   ',separator:str='   ',eol:str='\n')WhileHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertycondition:str
propertylimit:str|None
propertyon_limit:str|None
propertyon_limit_message:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.GroupHeader(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='GROUP'
classmethodfrom_params(name:str='',indent:str='   ',separator:str='   ',eol:str='\n')GroupHeader[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.Var(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='VAR'
options:dict[str,tuple|None]={'scope':('LOCAL','TEST','TASK','SUITE','SUITES','GLOBAL'),'separator':None}
classmethodfrom_params(name:str,value:str|Sequence[str],scope:str|None=None,value_separator:str|None=None,indent:str='   ',separator:str='   ',eol:str='\n')Var[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyname:str
propertyvalue:tuple[str,...]
propertyscope:str|None
propertyseparator:str|None
validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.Return(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

Represents the RETURN statement.

This class namedReturnStatement prior to Robot Framework 7.0.The old name still exists as a backwards compatible alias.

type:str='RETURNSTATEMENT'
classmethodfrom_params(values:Sequence[str]=(),indent:str='   ',separator:str='   ',eol:str='\n')Return[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyvalues:tuple[str,...]
validate(ctx:ValidationContext)[source]
robot.parsing.model.statements.ReturnStatement

alias ofReturn

classrobot.parsing.model.statements.LoopControl(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:NoArgumentHeader,ABC

validate(ctx:ValidationContext)[source]
classrobot.parsing.model.statements.Continue(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:LoopControl

type:str='CONTINUE'
classrobot.parsing.model.statements.Break(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:LoopControl

type:str='BREAK'
classrobot.parsing.model.statements.Comment(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='COMMENT'
classmethodfrom_params(comment:str,indent:str='   ',eol:str='\n')Comment[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.Config(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='CONFIG'
classmethodfrom_params(config:str,eol:str='\n')Config[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertylanguage:Language|None
classrobot.parsing.model.statements.Error(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='ERROR'
classmethodfrom_params(error:str,value:str='',indent:str='   ',eol:str='\n')Error[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

propertyvalues:list[str]
propertyerrors:tuple[str,...]

Errors got from the underlying``ERROR``token.

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

classrobot.parsing.model.statements.EmptyLine(tokens:Sequence[Token],errors:Sequence[str]=())[source]

Bases:Statement

type:str='EOL'
classmethodfrom_params(eol:str='\n')[source]

Create a statement from passed parameters.

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

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'.

This classmethod should be called from theStatement subclassto create, not from theStatement class itself.

classrobot.parsing.model.statements.VariableValidator[source]

Bases:object

validate(statement:Statement)[source]
classrobot.parsing.model.statements.AssignmentValidator[source]

Bases:object

validate(statement:Statement)[source]

robot.parsing.model.visitor module

classrobot.parsing.model.visitor.VisitorFinder[source]

Bases:object

generic_visit(node:Node)None|Node|list[Node][source]
classrobot.parsing.model.visitor.ModelVisitor[source]

Bases:NodeVisitor,VisitorFinder

NodeVisitor that supports matching nodes based on their base classes.

The biggest difference compared to the standardast.NodeVisitor,is that this class allows creatingvisit_ClassName methods so thattheClassName is one of the base classes of the node. For example,the following visitor method matches all node classes that extendStatement:

defvisit_Statement(self,node):...

Another difference is that visitor methods are cached for performancereasons. This means that dynamically addingvisit_Something methodsdoes not work.

visit(node:Node)None[source]

Visit a node.

classrobot.parsing.model.visitor.ModelTransformer[source]

Bases:NodeTransformer,VisitorFinder

NodeTransformer that supports matching nodes based on their base classes.

SeeModelVisitor for explanation how this is different comparedto the standardast.NodeTransformer.

visit(node:Node)None|Node|list[Node][source]

Visit a node.