robot.parsing.model.statements
¶
Statement
¶
Bases: Node
, ABC
Source code in src/robot/parsing/model/statements.py
from_tokens
classmethod
¶
Create a statement from given tokens.
Statement type is got automatically from token types.
This classmethod should be called from :class:Statement
, not from
its subclasses. If you know the subclass to use, simply create an
instance of it directly.
Source code in src/robot/parsing/model/statements.py
from_params
abstractmethod
classmethod
¶
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 the :class:Statement
subclass
to create, not from the :class:Statement
class itself.
Source code in src/robot/parsing/model/statements.py
get_token
¶
Return a token with any of the given types
.
If there are no matches, return None
. If there are multiple
matches, return the first match.
Source code in src/robot/parsing/model/statements.py
get_tokens
¶
get_value
¶
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.
Source code in src/robot/parsing/model/statements.py
get_values
¶
Return values of tokens having any of the given types
.
get_option
¶
Return value of a configuration option with the given name
.
If the option has not been used, return default
.
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.
Source code in src/robot/parsing/model/statements.py
ReturnSetting
¶
Bases: MultiValue
Represents the deprecated [Return]
setting.
This class was named Return
prior to Robot Framework 7.0. A forward
compatible ReturnSetting
alias existed already in Robot Framework 6.1.
Source code in src/robot/parsing/model/statements.py
from_tokens
classmethod
¶
Create a statement from given tokens.
Statement type is got automatically from token types.
This classmethod should be called from :class:Statement
, not from
its subclasses. If you know the subclass to use, simply create an
instance of it directly.
Source code in src/robot/parsing/model/statements.py
get_token
¶
Return a token with any of the given types
.
If there are no matches, return None
. If there are multiple
matches, return the first match.
Source code in src/robot/parsing/model/statements.py
get_tokens
¶
get_value
¶
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.
Source code in src/robot/parsing/model/statements.py
get_values
¶
Return values of tokens having any of the given types
.
get_option
¶
Return value of a configuration option with the given name
.
If the option has not been used, return default
.
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.
Source code in src/robot/parsing/model/statements.py
Return
¶
Bases: Statement
Represents the RETURN statement.
This class named ReturnStatement
prior to Robot Framework 7.0.
The old name still exists as a backwards compatible alias.
Source code in src/robot/parsing/model/statements.py
from_tokens
classmethod
¶
Create a statement from given tokens.
Statement type is got automatically from token types.
This classmethod should be called from :class:Statement
, not from
its subclasses. If you know the subclass to use, simply create an
instance of it directly.
Source code in src/robot/parsing/model/statements.py
get_token
¶
Return a token with any of the given types
.
If there are no matches, return None
. If there are multiple
matches, return the first match.
Source code in src/robot/parsing/model/statements.py
get_tokens
¶
get_value
¶
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.
Source code in src/robot/parsing/model/statements.py
get_values
¶
Return values of tokens having any of the given types
.
get_option
¶
Return value of a configuration option with the given name
.
If the option has not been used, return default
.
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.
Source code in src/robot/parsing/model/statements.py
Error
¶
Bases: Statement
Source code in src/robot/parsing/model/statements.py
from_tokens
classmethod
¶
Create a statement from given tokens.
Statement type is got automatically from token types.
This classmethod should be called from :class:Statement
, not from
its subclasses. If you know the subclass to use, simply create an
instance of it directly.
Source code in src/robot/parsing/model/statements.py
get_token
¶
Return a token with any of the given types
.
If there are no matches, return None
. If there are multiple
matches, return the first match.
Source code in src/robot/parsing/model/statements.py
get_tokens
¶
get_value
¶
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.
Source code in src/robot/parsing/model/statements.py
get_values
¶
Return values of tokens having any of the given types
.
get_option
¶
Return value of a configuration option with the given name
.
If the option has not been used, return default
.
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.